CNAME Records

 https://support.dnsimple.com/articles/cname-record/

What’s a CNAME record?

CNAME records can be used to alias one name to another. CNAME stands for Canonical Name.

A common example is when you have both example.com and www.example.com pointing to the same application and hosted by the same server. To avoid maintaining two different records, it’s common to create:

  • An A record for example.com pointing to the server IP address
  • CNAME record for www.example.com pointing to example.com

As a result, example.com points to the server IP address, and www.example.com points to the same address via example.com. If the IP address changes, you only need to update it in one place: just edit the A record for example.com, and www.example.com automatically inherits the changes.

A CNAME record must always point to another domain name, never directly to an IP address. DNSimple’s record editor will warn you if you try to point a CNAME record to an IP address. The sidebar to the right of editing the CNAME encourages you to visit the support article to learn the difference between A, CNAME, ALIAS, and URL records. It also warns you that CNAMEs must be unique to other records.

The DNS A record is specified by RFC 1035.

Restrictions

  1. A CNAME record must always point to another domain name and never directly to an IP address.
  2. A CNAME record cannot co-exist with another record for the same name. It’s not possible to have both a CNAME and TXT record for www.example.com.
  3. A CNAME can point to another CNAME, although this configuration is generally not recommended for performance reasons. When applicable, the CNAME should point as closely as possible to the target name in order to avoid unnecessary performance overheads.

CNAME record format

The structure of a CNAME record follows the standard top-level format definition defined RFC 1035. The RDATA section is composed of one single element:

ElementDescription
domain-nameA domain name which specifies the canonical or primary name for the record.

The canonical representation is:

CNAME <domain-name>

where <domain-name> is a fully-qualified domain name such as example.com.

In DNSimple, the CNAME record is represented by the following customizable elements:

ElementDescription
NameThe host name for the record, without the domain name. This is generally referred to as “subdomain”. We automatically append the domain name.
TTLThe time-to-live in seconds. This is the amount of time the record is allowed to be cached by a resolver.
ContentThe domain-name the CNAME maps to.

CNAME and Redirect

The CNAME record is sometimes improperly referred to as redirect, generally in the context of web (HTTP) redirects.

There’s no direct correlation between a CNAME and an HTTP redirect, nor does configuring CNAME automatically result in any HTTP redirect.
To perform an HTTP redirect, the server responding to the HTTP request must be configured to return an appropriate HTTP response. This is not directly achievable using a CNAME.

You can learn more by reading the differences between the A, CNAME, ALIAS and URL records. DNSimple provides a special URL record that can be used to configure an HTTP redirect.

Querying CNAME records

You can use dig in your terminal to determine the CNAME record associated to a domain name. The result contained in the ANSWER section has the fully-qualified domain name (FQDN), the remaining time-to-live (TTL), and the domain-name.

$ dig CNAME www.dnsimple.com

; <<>> DiG 9.10.6 <<>> CNAME www.dnsimple.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5274
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.dnsimple.com.		IN	CNAME

;; ANSWER SECTION:
www.dnsimple.com.	3599	IN	CNAME	dnsimple.com.

;; Query time: 52 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Nov 02 20:33:09 CET 2018
;; MSG SIZE  rcvd: 59

How do I render a Word document (.doc, .docx) in the browser using JavaScript?

 https://stackoverflow.com/questions/27957766/how-do-i-render-a-word-document-doc-docx-in-the-browser-using-javascript

<iframe src="https://docs.google.com/gview?url=http://ieee802.org/secmail/docIZSEwEqHFr.doc&embedded=true" frameborder="0">

</iframe>


<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=http%3A%2F%2Fieee802%2Eorg%3A80%2Fsecmail%2FdocIZSEwEqHFr%2Edoc' width='100%' height='100%' frameborder='0'>This is an embedded <a target='_blank' href='http://office.com'>Microsoft Office</a> document, powered by <a target='_blank' href='http://office.com/webapps'>Office Online</a>.</iframe>

Select rows with even or odd values in SQL

 https://tableplus.com/blog/2019/09/select-rows-odd-even-value.html

Syntax

To find and return the records with the odd or even values, the most simple way is to check the remainder when we divide the column value by 2. When the remainder is 0, that’s an even number, otherwise, that’s an odd number.

Here is the syntax:

In PostgreSQL, My SQL, and Oracle, we use MOD function to check the remainder.

  • To find rows where a specified column has even values:
SELECT * 
FROM table_name 
WHERE mod(column_name,2) = 0;
  • To find rows where a specified column has odd values:
SELECT * 
FROM table_name 
WHERE mod(column_name,2) <> 0;

In MS SQL Server, there is no MOD function and you can use %.

  • To find rows where a specified column has even values:
SELECT *
FROM table_name 
where column_name % 2 = 0;
  • To find rows where a specified column has odd values:
SELECT *
FROM table_name 
where column_name % 2 <> 0;

Example

We have table dept_manager in MySQL:

emp_iddept_idfrom_dateto_date
110022d0011985-01-011991-10-01
110039d0011991-10-019999-01-01
110085d0021985-01-011989-12-17
110114d0021989-12-179999-01-01
110183d0031985-01-011992-03-21
110228d0031992-03-219999-01-01
110303d0041985-01-011988-09-09
110344d0041988-09-091992-08-02
110386d0041992-08-021996-08-30
110420d0041996-08-309999-01-01
110511d0051985-01-011992-04-25
110567d0051992-04-259999-01-01
110725d0061985-01-011989-05-06
110765d0061989-05-061991-09-12
110800d0061991-09-121994-06-28
110854d0061994-06-289999-01-01
111035d0071985-01-011991-03-07
111133d0071991-03-079999-01-01
111400d0081985-01-011991-04-08
111534d0081991-04-089999-01-01
111692d0091985-01-011988-10-17
111784d0091988-10-171992-09-08
111877d0091992-09-081996-01-03
111939d0091996-01-039999-01-01

Now find all the rows having emp_id as even number:

SELECT *
FROM dept_manager
WHERE MOD(emp_id, 2) = 0;

The results is:

emp_iddept_idfrom_dateto_date
110022d0011985-01-011991-10-01
110114d0021989-12-179999-01-01
110228d0031992-03-219999-01-01
110344d0041988-09-091992-08-02
110386d0041992-08-021996-08-30
110420d0041996-08-309999-01-01
110800d0061991-09-121994-06-28
110854d0061994-06-289999-01-01
111400d0081985-01-011991-04-08
111534d0081991-04-089999-01-01
111692d0091985-01-011988-10-17
111784d0091988-10-171992-09-08

Need a good GUI tool for databases? TablePlus provides a native client that allows you to access and

Multiple TXT DNS records for domain

 https://webmasters.stackexchange.com/questions/85256/multiple-txt-dns-records-for-domain

Multiple TXT DNS records are perfectly acceptable. In fact, I think one of my domains has about 6 of them. If you append it to the end of another TXT record, it is likely to stop that one performing it's correct function.

Sending and email using python - Problem causes by last Google policy update (on less secure apps)

 https://stackoverflow.com/questions/72478573/sending-and-email-using-python-problem-causes-by-last-google-policy-update-on?fbclid=IwAR1N--0GV5ua_K5mWu8SWgHugydiHmTuvEUlI2QvJ27MFY1sy1IwSSr78Oc

Solved it by creating App password. You must got to Google account. Security tab, active 2 Step Verification. After this new option under "Signing in to Google" the "App passwords" option will be actived. Just create one app password and use as password to authenticate


Here is a more precise answer with all the main steps. I hope it will help other people.

  1. Log in into your email account: https://myaccount.google.com

  2. Then go to the security part

enter image description here

Be sure that you have turn on two steps verification and click on "App password"

enter image description here

  1. After select email and the corresponding device

enter image description here

  1. It will generate a password that will look like this; it is this password that you have to use in your python script.

enter image description here

  1. This password will appear here; in this place, you will have the option to erase it (so it will be no longer be useful to connect to your email account).

enter image description here

Hope it will help other people!

What toolbar buttons are available in CKEditor 4?

 https://stackoverflow.com/questions/13828383/what-toolbar-buttons-are-available-in-ckeditor-4

https://ckeditor.com/old/forums/CKEditor/Complete-list-of-toolbar-items#comment-123266

Here is a nice list of button names:

Complete List of Toolbar Items for CKEditor

items

  • "Source"
  • "Save"
  • "NewPage"
  • "DocProps"
  • "Preview"
  • "Print"
  • "Templates"
  • "document"

items

  • "Cut"
  • "Copy"
  • "Paste"
  • "PasteText"
  • "PasteFromWord"
  • "Undo"
  • "Redo"

items

  • "Find"
  • "Replace"
  • "SelectAll"
  • "Scayt"

items

  • "Form"
  • "Checkbox"
  • "Radio"
  • "TextField"
  • "Textarea"
  • "Select"
  • "Button"
  • "ImageButton"
  • "HiddenField"

items

  • "Bold"
  • "Italic"
  • "Underline"
  • "Strike"
  • "Subscript"
  • "Superscript"
  • "RemoveFormat"

items

  • "NumberedList"
  • "BulletedList"
  • "Outdent"
  • "Indent"
  • "Blockquote"
  • "CreateDiv"
  • "JustifyLeft"
  • "JustifyCenter"
  • "JustifyRight"
  • "JustifyBlock"
  • "BidiLtr"
  • "BidiRtl"

items

  • "Link"
  • "Unlink"
  • "Anchor"

items

  • "CreatePlaceholder"
  • "Image"
  • "Flash"
  • "Table"
  • "HorizontalRule"
  • "Smiley"
  • "SpecialChar"
  • "PageBreak"
  • "Iframe"
  • "InsertPre"

items

  • "Styles"
  • "Format"
  • "Font"
  • "FontSize"

items

  • "TextColor"
  • "BGColor"

items

  • "UIColor"
  • "Maximize"
  • "ShowBlocks"

items

  • "button1"
  • "button2"
  • "button3"
  • "oembed"
  • "MediaEmbed"

items

  • "About"

Gatsby pageContext empty in GraphQL

 https://stackoverflow.com/questions/59071358/gatsby-pagecontext-empty-in-graphql

Yes, Gatsby by default creates a page for every js file in src/pages. Try moving your template to some other folder like src/templates and adjust the value of component in createPage() accordingly.

anti-pattern là gì

  Trong công nghệ và lập trình, Anti-pattern (mẫu phản diện) là những giải pháp bề ngoài có vẻ hiệu quả để giải quyết một vấn đề phổ biến, ...