What is the DATABASE_URL in Postgres

Hi!

When getting started on Heroku with Node.js here, You will have a new database in  Postgres.

Type:

        heroku config

and here is what you have:

DATABASE_URL: postgres://tpkhetigbqignwgqid:2d866e51149688dbfd15eafa2f3aae18f81697418e7a73e72625a1ac21c008a4@ec2-54-225-227-125.compute-1.amazonaws.com:5432/dftroisg8ps8r9

So, what is the database url mean? Hmm, it is a combination of username,password, host and database name

here is the syntax:

var conString = "postgres://UserName:Password@Host:5432/Database";

It means:

UserName = tpkhetigbqignwgqid
Password = 2d866e51149688dbfd15eafa2f3aae18f81697418e7a73e72625a1ac21c008a4
Host = ec2-54-225-227-125.compute-1.amazonaws.com
Database = dftroisg8ps8r9

And here is how you connect it to your pgAdmin:

connecttopostgres

connecttopostgresconnectionstring

Congratulation, you have successful to connect to the first Postgres database ever.

Advertisements

Work with Datetime RegionalSettings in SharePoint

https://stackoverflow.com/questions/2292334/difference-between-utc-and-gmt-standard-time-in-net

Greenwich Mean Time or GMT is the clock time at the Royal Observatory in Greenwich, London. It is the same all year round and is not affected by Summer Time or Daylight Saving Time.

UTC – The World’s Time Standard – Coordinated Universal Time (UTC) is the basis for civil time today. This 24-hour time standard is kept using highly precise atomic clocks combined with the Earth’s rotation.

Day Light Saving Time (DST) on the other hand is advancing clocks To and for with season changes, To make max use of day light.

C#:

var siteTimeZone = Ctx.Web.RegionalSettings.TimeZone;

TimeZoneInfo timeZoneInfo = GetTimeZoneInfo(siteTimeZone);
DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timeZoneInfo);

public TimeZoneInfo GetTimeZoneInfo(Microsoft.SharePoint.Client.TimeZone timezone)
{
TimeZoneInfo webTimezoneInfo;
string timezoneInfoId = GetTimezoneInfoIdBySiteTimezoneId(timezone.Id);
if (timezoneInfoId == “”){
webTimezoneInfo = null;}
else{
webTimezoneInfo = TimeZoneInfo.FindSystemTimeZoneById(timezoneInfoId);}

return webTimezoneInfo;
}

public static string GetTimezoneInfoIdBySiteTimezoneId(int id)
{
switch (id)
{
case 86:
return “Morocco Standard Time”;
case 2:
return “GMT Standard Time”;
case 93:
return “UTC”;
case 31:
return “Greenwich Standard Time”;
case 4:
return “W. Europe Standard Time”;
case 6:
return “Central Europe Standard Time”;
case 3:
return “Romance Standard Time”;
case 57:
return “Central European Standard Time”;
case 69:
return “W. Central Africa Standard Time”;
case 79:
return “Jordan Standard Time”;
case 5:
case 101:
return “GTB Standard Time”;
case 80:
case 98:
return “Middle East Standard Time”;
case 49:
return “Egypt Standard Time”;
case 50:
return “South Africa Standard Time”;
case 59:
return “FLE Standard Time”;
case 27:
return “Israel Standard Time”;
case 7:
return “E. Europe Standard Time”;
case 26:
return “Arabic Standard Time”;
case 74:
return “Arab Standard Time”;
case 51:
return “Russian Standard Time”;
case 56:
return “E. Africa Standard Time”;
case 25:
return “Iran Standard Time”;
case 82:
return “Georgian Standard Time”;
case 24:
return “Arabian Standard Time”;
case 54:
return “Azerbaijan Standard Time”;
case 89:
return “Mauritius Standard Time”;
case 84:
return “Caucasus Standard Time”;
case 48:
return “Afghanistan Standard Time”;
case 58:
return “Ekaterinburg Standard Time”;
case 87:
return “Pakistan Standard Time”;
case 47:
return “West Asia Standard Time”;
case 23:
return “India Standard Time”;
case 66:
return “Sri Lanka Standard Time”;
case 62:
return “Nepal Standard Time”;
case 46:
return “N. Central Asia Standard Time”;
case 71:
return “Central Asia Standard Time”;
case 61:
return “Myanmar Standard Time”;
case 22:
return “SE Asia Standard Time”;
case 64:
return “North Asia Standard Time”;
case 45:
return “China Standard Time”;
case 63:
return “North Asia East Standard Time”;
case 21:
return “Singapore Standard Time”;
case 73:
return “W. Australia Standard Time”;
case 75:
return “Taipei Standard Time”;
case 20:
return “Tokyo Standard Time”;
case 72:
return “Korea Standard Time”;
case 70:
return “Yakutsk Standard Time”;
case 19:
return “Cen. Australia Standard Time”;
case 44:
return “AUS Central Standard Time”;
case 18:
return “E. Australia Standard Time”;
case 76:
return “AUS Eastern Standard Time”;
case 43:
return “West Pacific Standard Time”;
case 42:
return “Tasmania Standard Time”;
case 68:
return “Vladivostok Standard Time”;
case 41:
return “Central Pacific Standard Time”;
case 17:
return “New Zealand Standard Time”;
case 40:
case 92:
return “Fiji Standard Time”;
case 67:
case 16:
return “Tonga Standard Time”;
case 29:
return “Azores Standard Time”;
case 53:
return “Cape Verde Standard Time”;
case 30:
return “Mid-Atlantic Standard Time”;
case 8:
return “E. South America Standard Time”;
case 85:
return “Argentina Standard Time”;
case 60:
return “Greenland Standard Time”;
case 90:
return “Montevideo Standard Time”;
case 28:
return “Newfoundland Standard Time”;
case 9:
return “Atlantic Standard Time”;
case 33:
return “Central Brazilian Standard Time”;
case 65:
case 91:
return “Pacific SA Standard Time”;
case 88:
return “Venezuela Standard Time”;
case 35:
return “SA Pacific Standard Time”;
case 10:
return “Eastern Standard Time”;
case 34:
return “US Eastern Standard Time”;
case 55:
return “Central America Standard Time”;
case 11:
return “Central Standard Time”;
case 37:
return “Central Standard Time (Mexico)”;
case 36:
return “Canada Central Standard Time”;
case 38:
return “US Mountain Standard Time”;
case 77:
return “Mountain Standard Time (Mexico)”;
case 12:
return “Mountain Standard Time”;
case 13:
return “Pacific Standard Time”;
case 78:
return “Pacific Standard Time (Mexico)”;
case 14:
return “Alaskan Standard Time”;
case 15:
return “Hawaiian Standard Time”;
case 39:
return “Dateline Standard Time”;
default:
return “”;
}
}

Typescript:

private convertFromLocalTimeToGMT0 = (eventPage: Models.IEventPage) => {
var obj = {};

var executor: Models.IExecutor = (resolve, reject) => {
this.getTimeZoneInformation().then((tzInformation) => {
var timeZoneInformation = tzInformation.Information;
var hourDiff = timeZoneInformation.Bias / 60;
var timeDiff = hourDiff * 60 * 60 * 1000;

var startDate = new Date(eventPage.startDate);

var siteStartDateAsGMT0 = startDate.setTime(startDate.getTime() + timeDiff);

var startDateWithoutUTC = this.convertDateTimeToStringWithoutUTC(new Date(siteStartDateAsGMT0));

obj[Constants.SharePoint.Fields.START_DATE] = startDateWithoutUTC;

resolve(obj);
});
};

return new Promise(executor);
}

public getDateTimeSiteRegionalSettings = (localDateTime: string) => {
var siteUrl = this.getCurrentSiteUrl();
var executor: Models.IExecutor = (resolve, reject) => {
$.ajax({
url: siteUrl + “/_api/web/RegionalSettings/TimeZone/utcToLocalTime(@date)?       @date='” + new Date(localDateTime).toUTCString() + “‘”,
method: “GET”,
headers: { “Accept”: “application/json; odata=verbose” },
success: (data) => {
var newValue = this.parseDate(data.d.UTCToLocalTime);
resolve(newValue);
},
error: () => {
reject(null);
}
});
};

return new Promise(executor);
}

private getTimeZoneInformation = () => {
var siteUrl = this.getCurrentSiteUrl();
var executor: Models.IExecutor = (resolve, reject) => {
$.ajax({
url: siteUrl + “/_api/web/RegionalSettings/TimeZone”,
method: “GET”,
headers: { “Accept”: “application/json; odata=verbose” },
success: (data) => {
resolve(data.d);
},
error: () => {
reject(null);
}
});
};

return new Promise(executor);
}

private convertDateTimeToStringWithoutUTC = (dateTime?: Date) => {
return Utils.isNullOrEmpty(dateTime) ? null : dateTime.format(“yyyy-MM-ddTHH:mm:ss”);
}

How to restore to azure vm with cloudberry backup

Please read this article:

https://www.cloudberrylab.com/blog/how-to-restore-to-azure-vm-with-cloudberry-backup/

 

https://www.cloudberrylab.com/blog/how-to-use-cloudberry-backup-with-windows-azure/
https://www.cloudberrylab.com/blog/how-to-restore-to-azure-vm-with-cloudberry-backup/
https://www.cloudberrylab.com/blog/image-based-backup-feature-in-cloudberry-backup-4-2/
https://www.cloudberrylab.com/download/Backup_Installation_and_Configuration_Guide.pdf