Tuesday, January 8, 2019

Decision tree for Azure compute services

The following flowchart will help you to choose a compute service for your application. The flowchart guides you through a set of key decision criteria to reach a recommendation. 


Saturday, November 3, 2018

Split and Deploy Google Cloud Functions Code (Simple Way)

1- Suppose you already created your new app and have index.ts file contain the following:

import * as functions from 'firebase-functions';

export const helloWorld = functions.https.onRequest((request, response) => {
const message = request.query.message || request.body.message || 'Hello World!';
response.status(200).send(message);
});


2- Create a new file called groupA.ts contain the following :

import * as functions from 'firebase-functions';

exports.groupA = {
function1: functions.https.onRequest((request, response) => {
response.send('Hello from function1!');
}),
function2: functions.database.ref('path').onWrite((change, context) => {
response.send('Hello from function2!');
})
};

exports.modifyUser = functions.firestore
.document('users/{userID}')
.onWrite((change, context) => {
// Get an object with the current document value.
// If the document does not exist, it has been deleted.
const document = change.after.exists ? change.after.data() : null;

// Get an object with the previous document value (for update or delete)
const oldDocument = change.before.data();

// Get the user object with the new changes,
const newData = change.after.data();

});


You have now 3 functions:
- function1 &  function2 inside groupA 
- modifyUser as separate one

3- Inside index.ts file add :
exports.groupA = require('./groupA');

4- Now you can deploy to your Google cloud using one of the following:
    firebase deploy --only functions
    firebase deploy --only functions:groupA
  firebase deploy --only functions:groupA.function1,modifyUser
    firebase deploy --only functions:function1,functions:function2


Thursday, March 22, 2018

VS Code Angular Stop Automatic Rebuilds

VS Code Angular Stop Automatic Rebuilds :

ng serve --watch=false


Reference
https://github.com/angular/angular-cli/wiki/serve

Running VS Code In Mac Terminal


1- Open VS Code 
2- Open the Command Palette (⇧⌘P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
3- Restart the terminal. 
4- Type 'code .' in any folder to start editing files in that folder Using VS Code.

Reference :
https://code.visualstudio.com/docs/setup/mac 



Thursday, November 16, 2017

SQL Server, Add New Login as sysadmin without Management Studio (SSMS)

How to Control MS SQL Server  without Management Studio (SSMS) :
For E.g:
We need to create new user account and we do not have SSMS installed on the server, for a quick Solution we did the following :

1- Prepare our SQL script in txt file :
--------------- Script.txt --------------------
USE [master]
GO
CREATE LOGIN [nady] WITH PASSWORD=N'123', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
EXEC master..sp_addsrvrolemember @loginame = N'nady', @rolename = N'sysadmin'
GO
------------------------------------------------

2- Prepare Command :
--------------- CMD.txt --------------------
sqlcmd -S dpqdevecom01 -i C:\nady\Script.txt -o C:\nady\Exec_Output.txt
------------------------------------------------

3- Open Windows command line, CMD ( Windows + R) then Paste your Command Script :) .




Tuesday, October 10, 2017

.net Core HTTP Error 405.0 - Method Not Allowed

When you try to do PUT and DELETE request using .net Core you get  "HTTP Error 405.0 - Method Not Allowed",

The solution is :
The WebDAVModule set PUT and DELETE request methods disabled by default. so you should disable it.

inside your Web.config :

  <system.webServer>   
    <modules runAllManagedModulesForAllRequests="false">
          <remove name="WebDAVModule" />
    </modules>
  </system.webServer>