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.

graphql: Serving over HTTP

 https://www.apollographql.com/blog/graphql/examples/4-simple-ways-to-call-a-graphql-api/

https://graphql.org/learn/serving-over-http/

https://graphql.org/learn/pagination/

3. Fetch

You can make a GraphQL HTTP request in literally any programming language, as long as you can set the above 4 parts correctly. So let’s convert that curl request into some JavaScript code with fetch, the new standard for getting HTTP results with promises. This will work in modern browsers with no libraries, but will require a polyfill in Node and some browsers. Let’s check out the code:

require('isomorphic-fetch');

fetch('http://localhost:4000', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ query: `
    query {
      todos {
        edges {
          node {
            completed
            id
            text
          }
	}
      }
    }` 
  }),
})
.then(res => res.json())
.then(res => console.log(res.data));

If you run this code Chrome’s DevTools, you’ll notice that the following output is printed to the console.

Neat, right? As you can see, the way we request GraphQL data using Fetch is pretty similar to the request we constructed with curl, but there are a few things here that would become pretty repetitive if we had to type them out every time. Not only that, but to effectively work with GraphQL data in most applications, you’ll likely want to cache it, display the data somehow, and re-render your view when it changes.

That sounds like something that a GraphQL client can help us with.

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, ...