Category: Tips

How to scroll the source code in WordPress

How can I show all of the source code for mobile sites with plugin “Enlighter – Customizable Syntax Highlighter” in WordPress?

GOAL

To scroll source code embedded with Enlighter – Customizable Syntax Highlighter.

When my blog is seen in mobile, part of the source code is hidden and invisible.

Environment

WordPress 5.5.1
Enlighter – Customizable Syntax Highlighter 4.3.1

Method

Open Elighter>Appearance

Change the drop-down menu “Text overflow” to “Add scrollbar” and save changes.

Result

The scroll bar is add and I can see all of the source code from left end to the right end.

[Tips]How to Select a Face Loop in Blender -Element select-

I tried to select thin side of cube, but I couldn’t select by double-click.

What I want to do

GOAL

To summarize some ways to select elements in Blender.

Environment

Blender 2.8a

Keymap

Selection methods are different depending on keymap.

How to check and change keymap in Blender

Edit > Preference > Keymap

When Keymap is “Blender”, alt + click(left) is the key to select loop element.

When Keymap is “Industry Compatible”, double-click is the key to select loop element. I usually use this keymap.

The method to select loop elements

Vertices

Change the select mode into “vertex select” and double-click the edge on the vertex loop you’d like to select.

Example

Edges

Change the select mode into “edge select” and double-click the edge on the edge loop you’d like to select.

Example

Select another side.

Faces

Change the select mode into “face select” and double-click the side that is near the on the face loop you’d like to select.

Example

Select another side.

Other selection methods

Select one element

Click face, edge or vertex.

Multiple selection

Shift + click

Select continuous elements

Ctrl + click

Select All

Press A key

[Tips]How to use Image for Normal map in Blender

GOAL

To create normal map from RGB image.

Environment

Windows10
Blender 2.8a

Method

Create new Principled BSDF material.

Set “NormalMap” to the parameter “Normal”. And set “Image Texture” to the parameter “Calor”.

Open and select normal map to apply.

Open UV editor and adjust the UV Mapping.

You can use Nodes to change the scale of input image.

[error]No such file or directory (header file)

Error Detail

When I compile c++ file using g++ command as below, the fatal error: numpy/arrayobject.h: No such file or directory occurred.

>g++ filename.cpp -std=c++11 -IC:\Python27\include -lpython2.7
In file included from filename.cpp:1:
../libs/matplotlibcpp.h:17:12: fatal error: numpy/arrayobject.h: No such file or directory
   17 | #  include <numpy/arrayobject.h>

matplotlibcpp.h in the source code is c++ header file to plot a graph.

numpy/arrayobject.h is in the directory C:\Python27\Lib\site-packages\numpy\core\include\numpy.

Cause

The compiler could not find arrayobject.h because that file is not included in the include search path.

Solution

Add the path to arrayobject.h using -I command line option as follows.

>g++ filename.cpp -std=c++11 -IC:\Python27\include -lpython2.7 -IC:\Python27\Lib\site-packages\numpy\core\include

How To Post Formula on Your WordPress Website

GOAL

To add formula on your WordPress posts as below.

$$\frac{A}{B}$$

Method

Install MathJax-LaTeX Plugin

MathJax-LaTeX” is the plugin for rendering of embedded LaTeX or MathML in HTML pages. It convert LaTeX style code ” \int^{ \infty}_{a} f(x) dx = \lim_{n \to \infty} \int^{n}_{a} f(x) dx” into the formula as below.
$$\int^{ \infty}_{a} f(x) dx = \lim_{n \to \infty} \int^{n}_{a} f(x) dx$$

Input shortcode

Input shortcode “mathjax” on your post. (Input mathjax with [ and ])

Input formula

Input LaTex style code of the formula enclosed in $$s.

Trouble shooting

If the shortcode “mathjax” doesn’t work well, open “Plugins” panel and click the setting of “MathJax-LaTeX” on your Dashboard. Check the “Force Load”.

How to embed tweet button in WordPress article

GOAL

To embed Tweet button in each WordPress articles.

Environment

WordPress 5.2.5

Method

1. Get the source code of Tweet button.

Get the source code of tweet button from https://publish.twitter.com/#

Select “Twitter Buttons”.

Customize the style of tweet button and copy the code displayed.

from https://publish.twitter.com/

2. Embed the source code.

Click the Theme Editor on your WordPress Dashboard. And open content.php.

Put the code copied from https://publish.twitter.com/ on any place you want.

<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>

<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-via="nako_new_high" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Then change the code to get the target source URL and the title.

<a href="https://twitter.com/share" data-url="<?php the_permalink(); ?>" data-text="<?php echo get_the_title(); ?>" class="twitter-share-button" data-via="nako_new_high" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

php funtions to get information of the article can be searched by Documentation.

Put the link and add php functions in content-single.php and content-page.php.

3. Check the Tweet button.

4. Create Tweet card with

Install All in One SEO on your WordPress.

Open All in One SEO > Feature Manager

Activate “Social Meta” and open the page of Social Meta. Input information about thumbnail image and your twitter account.

Access the Card validator and check your card preview.

5.

When you add new post, input information about the article and select thumbnail image in Social Setting Area of All In One SEO Pack.

Result

How to embed twitter timeline on your WordPress web site

GOAL

To embed twitter timeline on your WordPress web site as below.

Method

Access https://publish.twitter.com/#

And input URL of your twitter home.

from https://publish.twitter.com/

Choose one of the two styles. If you want to change the size, looking or language of this area, click “set customization options”.

Change the style and click “Update” button.

Copy code.

Open your WordPress Dashboard and click Appearance>Widgets.

Create Text widget and put it into any space you like.

Paste the code copied from https://publish.twitter.com/ and save the widget.

How Can I change the language in Windows10?

GOAL

Change language in Windows10

Environment

Windows10

Method

Open setting window.

Click “Time & Language”.

Click and open “language” panel. Then select windows display language.

If the system doesn’t have language set you want, add a preferred language.

homebrew install Error

Problem

An error “Permission denied @ apply2files – /usr/local/share/ghostscript/9.23/Resource/CIDFSubst/Deng.ttf” occurred when I tried to update homebrew.

What is homebrew?

Homebrew is a package management system to install and update software for macOS.
(Official link: https://brew.sh/index_en)

What is ghostscript?

Homebrew is a package management system to install and update software for macOS.
(Official link: https://brew.sh/index_en)
Ghostscript is invoked and started by other software including homebrew.

The Resource / CIDFSubst directory is a directory to store TrueType fonts (but there is no problem here).

Cause of the error

Because the error message says “Permission denied”, the current user does not have access. So it seems that homebrew cannot use the required files.

Solution

As an immediate solution, give access to the ghostscript directory with the following command. You will be prompted for a password.

sudo chown -R <UserName>:admin /usr/local/share/ghostscript

Now you can run without error. It remains unclear why the access was lost.