アプリ関連ニュース
- 2021年5月12日
- 他の話題
個人用ファイルサーバー機の作成(HDDの組み込み)
tanaka at 2021年05月12日 10:00:04
- 2021年5月10日
- 技術情報
Basic Auth by PHP
There are several ways to add a basic authentication using php. Today I would like to share a snippet to add basic authentication easily.
Lets get started.
<?php
//you can define your custom username and password here.
$AUTH_USER = 'username';
$AUTH_PASS = 'password';
header('Cache-Control: no-cache, must-revalidate, max-age=0');
$credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));
//check credentials existence or wrong credentials
$auth_fail = (
!$credentials ||
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS
);
//Ask for the auth. If credentials are not correct, deny the access.
if ($auth_fail) {
header('HTTP/1.1 401 Authorization Required');
header('WWW-Authenticate: Basic realm="Access denied"');
exit;
}
After the coding process, you will get a confirmation alert box for authentication before accessing the website as below.

Well, I think you can now add basic auth in any of your PHP application neat and easily.
If you want to add basic authentication for contents like html and images etc , you can also do that by configuring .htaccess
Yuuma
yuuma at 2021年05月10日 11:00:09
- 2021年5月07日
- 技術情報
Visual Studio Code for PHP developers
Makes it clean and pretty code each time you open VS Code to help us all become better engineers! I want to share some important VS Code tips and tricks.
Quickly open files
Keyboard Shortcut: Ctrl+P
Access all available commands.
Keyboard Shortcut: Ctrl+Shit+P
Navigate between recently opened folders and workspace
Keyboard Shortcut: Ctrl+R
There are many things you can do to customize your code format.
- Change your theme
Firstly Keyword Shortcut: Ctrl+Shit+P then go to type >theme and select your preference theme.
If you want to add color theme, I recommend Gruvbox Material. It’s totally pretty color theme that I’ve used.
Customize your keyboard shortcuts
Keyboard Shortcut: Ctrl+K Ctrl+S
Search and Install extensions
Keyboard Shortcuts : Ctrl+Shift+X
You can find extensions in the VS Code Marketpalce.
Integrated Terminal
Keyboard Shortcut: Ctrl+`
Toggle SideBar
Keyboard Shordcut: Ctrl+B
Toggle Panel
Keyboard Shordcut: Ctrl+J
Zen mode
Keyboard Shortcut: Ctrl+K Z
Press Esc twice to exit Zen mode.
Move to Explorer window
Keyboard Shortcut: Ctrl+Shit +E
Navigation entire history
Keyboard Shordcut: Ctrl+Tab
Multi Cursor selection
Keyboard Shortcut: Ctrl+Shit+Left
To set cursors above or below the current position use
Keyboard Shortcut: Ctrl+Alt+Up or Ctrl+Alt+Down
Copy line up / down
Keyboard Shortcut: Shift+Alt+Up or Shift+Alt+Down
Code Formatting
Whole document format: Shift+Alt+F
Code Folding
Keyboard Shortcut: Ctrl+Shift+[ or Ctrl+Shift+]
Select Current Line
Keyboard Shortcut: Ctrl+L
Navigate to beginning and end of file
Keyboard Shortcut: Ctrl+Home and Ctrl+End
Move line up and down
Keyboard Shortcut: Alt+Up or Alt+Down
Git integration
Keyboard Shortcut: Ctrl+Shift+G
You can install other SCM providers from the Extension Marketplace. Most of the time I’m preferred GitLens extension. It’s incredible useful.
Diffs
From the Source Control view, select a file to open the diff.
Views
The default view for diffs is the side by side view.
Toggle inline view by clicking the More Actions (…) button in the top right and selecting Toggle Inline View.
Branches
Easily switch between Git branches via the Status Bar.
Staging
Hover over the number of files and click the plus button.
Click the minus button to unstage changes.
Undo Last Commit
Click the (…) button and then select Undo Last Commit to undo the previous commit. The changes are added to the Staged Changes section.
See Git output
VS Code makes it easy to see what Git commands are actually running. This is helpful when learning Git or debugging a difficult source control issue
Use the Toggle Output command (Ctrl+Shift+U) and select Git in the dropdown.
By Ami
asahi at 2021年05月07日 10:00:42
- 2021年4月28日
- 他の話題
仮想通貨によってハードディスクも枯渇しだしました
tanaka at 2021年04月28日 10:00:35
- 2021年4月26日
- Mac
A new colorful iMac introduced by Apple
Recently, Apple released a new dramatic iMac redesign, making the design thinner with a variety of colorful designs and these are so eye-catching. Naturally, the latest version of the 24-inch all-in-one desktop is based on the company’s new proprietary M1 chips.

The display has a 4.5K Retina display, along with a 1080p camera which is a pretty good move. I am always wondering when they will improve this and this finally has come. The company is also working on audio and video more seriously. True Tone is naturally on board for better color balance, and the sound has been enhanced with the six-speaker setup. The display features 11.3 million pixels, a P3 color gamut, and 500 nits of brightness. Like the latest iMac models, it features an anti-reflective coating to reduce screen glare.
According to the company, the new iMacs are significantly thinner and the total volume is cut in half. The rear is also flat rather than a curved design. They are also using a new chip that enables much faster performance than previous models, a huge performance boost. The company says it’s up to 85% faster than the latest model, along with a GPU that’s up to twice as fast and triples machine learning.
There are four USB-C ports, including two Thunderbolts, for faster speed and a new magnetic power adapter that also offers 1Gbps Ethernet. The system comes in seven colors. There are also some new accessories for the system, including a new colorful Magic Keyboard that supports built-in TouchID.
I am also hoping for larger 27inch version soon.
Yuuma
yuuma at 2021年04月26日 11:00:57