Posted in MySQL, MySQL Shell

Create New User with admin rights on MySQL Shell

Creating new user through MySQL Shell commands below, grant access to the user then connect to MySQL (through Workbench or Shell) with that user:

MySQL JS> \sql

MySQL JS> \connect root@localhost


Then enter password and Y (to save the password). Or root@{ip address or hostname).


MySQL  localhost:33060+ ssl  SQL >  CREATE USER ‘user’@’serverhostname’ IDENTIFIED BY ‘password’;

MySQL  localhost:33060+ ssl  SQL >  GRANT ALL PRIVILEGES ON *.* TO ‘user’@’serverhostname’ WITH GRANT OPTION;

MySQL  localhost:33060+ ssl  SQL >  CREATE USER ‘user’@’%’ IDENTIFIED BY ‘password’;

MySQL  localhost:33060+ ssl  SQL > GRANT ALL PRIVILEGES ON *.* TO ‘user’@’%’ WITH GRANT OPTION;

Posted in Alexa, Alexa Lambda Function Skill, Amazon Web Service, AWS, JSON, Node.js

Create a custom Alexa Lambda Function Skill


  1. Login to Amazon Developer account, Navigate to “AWS Lambda”; then create a new Lambda function using a blueprint with code for the basic functions that implements a simple skill in Node.js or Python. To start with sample code, click Blueprints, then select one of the skill kits, for instance “alexa-skills-kit-color-expert”
  2. Then Enter a “name” for the function.
  3. Select the “Role”, use the role under “Existing role”.
  4. and then “Create function”.
  5. This will create a sample that we can edit later as needed.


Then in another browser login to your “AWS Management Console” and navigate to AWS Lambda.

  • Select “US East (N. Virginia) Region on upper-right corner of the console.


  • Select “Enable” for Skill ID Verification.


  • And copy the Skill ID from Developer Console > Your Skills > Skill-Name> Endpoint tab>


and past it into the Skill ID edit box as shown below:


  • Then click “Add” and “Save”. And copy the ARN from AWS Console and past into Skill Function > Endpoint > Default Region. In this way they can interact and handshake together.



To test our sample Lambda Function code in the Console:


  • In the Function list, click the function name to open the details for the function and click the “select a test event > configure test events > Create new test event > Select one of the sample Alexa requests from the Event template, I choose “Alexa Start Session” > Enter the Event name > Create.


Then click the “Test” button. The Execution result should be succeeded.


This test was for testing the interaction. To test the skill itself, we open the skill at developer amazon console; there is a “Skill builder checklist” that I modified as needed;


“Invocation Name” is the name of the skill to begin interaction with a particular custom skill; for instance, if invocation name is: business library then user can say: hey Alexa, open / start {Skill Invocation Name}.


An “Intent” represents an action that fulfills a user’s spoken request. Intents can optionally have arguments called “Slots”. For example, in a Library Skill; defining librarians contact define an intent name “librarianContact” that has slots named name or contact.

There are two json files to modify/ import the custom function skill; one in developer console to “Json editor” that defines the interaction and one at AWS Console “index.js”.

Then Click “Build Model”.


Then Click “Test” menu, to test the custom skill;

  • In the text box in Alexa Simulator, type: Alexa, open {Invocation Name};

It will show the content we provided in the “WELCOME_MESSAGE” in the json file (index.js).6


Then we can ask or type more questions to interact with the simulator.

Posted in C#, Object Oriented Programming, Static

Static keyword in C#

Static class cannot be instantiated using the “new” keyword


Static items only access other static items. Share resources between multiple users


Static constructor in non-static class: runs only once when class instantiated first time


In static class: runs only once when any of its static members accessed for the first time
Static members are allocated in high frequency heap area of the memory



Posted in Abstract Class, C#, Interface, Object Oriented Programming

C# – Abstract Class vs Interface

Abstract Class Interface
Multiple inheritance Doesn’t support support
Data Member contains Doesn’t contain
Constructor declaration contains Doesn’t contain
Definition May contain definition with no implementation Just a pattern, an empty shell
Methods Can have both abstract & non-abstract methods Can only have abstract methods
Implementation Can contain both definition and its implementation

Incomplete class, cannot be instantiated

Can only have the signature of the functionality without any code
Access Modifier Can have all access modifiers for member declaration of functions, subs and properties. Not allowed (all methods must be implicitly defined as public).

All the members assumed as implicitly public.

Homogeneity is used for implementations of the same type, behavior and status Is used for implementations that share only method signatures
Declaration Acts as a base class for all other classes, can declare/ use any variable Not allowed to declare any variables
Core vs Peripheral Core identity of a class & for objects of the same data type Used to define Peripheral ability of a class
Rigid vs Supple More supple More rigid
Fields definition Predefined fields & constants Fields cannot be defined in interfaces
Posted in Abstract Class, C#, Concrete Class, Object Oriented Programming

Abstract classes vs Concrete Classes


Abstract Class Concrete Class
Type Base class Default class
Methods May contain partially implemented methods All methods are completely implemented
Functions Some or all declared functions are purely virtual No purely virtual functions
Instantiation Cannot be instantiated Can be instantiated

Image Courtesy:,



JSON: JavaScript Object Notation XML: eXtensible Markup Language
data-oriented document-oriented
Types Number, Array, Boolean, String, Object and Null All string
Data JSON Objects are typed XML data is typeless
Simplicity of read/ write shorter & faster, no end tag
Easy to learn
Capability to display No Yes,

capable to display data because it is a markup language

Support array
secured more
Human readable more
Datatype support only text and number text, number, images, charts, graphs etc.

Also, XML offers options for transferring the format/structure of the data with actual data

Parsed by a standard JavaScript function into ready-to-use JavaScript object An XML parser
Posted in ASP .Net, C#, MVC, SQL Server Report Services, SSRS

SSRS (SQL Server Reporting Services)

SSRS is a server side report by Microsoft. I used that to create interactive and printed  reports in my C#, ASP .Net MVC project when I need to have export the report from the view page to a file (PDF or Excel).

I design the reports by using MS Visual Studio 2012 and be able to test the preview of the reports.


It can connect to the MS SQL Server database as a data source



and have the specific data set that can use queries or stored procedures,


calculated fields and parameter values (entries for queries/ stored procedures).


Then the report will be created and we can add table, text box and etc. from the toolbox and design the report like this:


There is an option to edit the page layout and design the report or even have an expression for a specific textbox of the report; for instance if the calculated number is greater than zero make the field green and if it is less than zero make the field background red.


=IIF(VAL(ReportItems!MeetExp.Value) = 0,”No Color”,IIF(VAL(ReportItems!MeetExp.Value) >0,”GREEN”,”RED”))

After all these, we can test the report by preview tab and verify it is working correctly.

There was an issue that in the PDf I had some blank pages; the solution is: modifying the Margins of the report.

In the Design tab of the rdl report, right click on the grey part (outside of the report’s body) then select “Report Properties” and then change the width and Height to a bigger number.


This can fix the problem.


Posted in Data Structure



(Data Definition Language)


(Data Manipulation Language)


(Data Control Language)


(Transaction Control Language)

Create Select Grant Commit
Alter Insert Revoke Savepoint
Drop Update   rollback
Truncate Delete   Set transaction
Comment Merge    
Rename Call    
  Explain plan