- 5G — 5G is the fifth generation wireless technology for digital cellular networks that began wide deployment in 2019. As with previous standards, the covered areas are divided into regions called "cells", serviced by individual antennas.
- Ad Tech
- Ad Marker - CUE/CUE-OUT/CUE-IN and SCTE35
- CSAI vs SSAI
- Render Ad creatives using setSafeFrameConfig in Google IMA
- SafeFrame is a web standard developed by IAB — The Interactive Advertising Bureau (IAB) created the web standard SafeFrame to improve web users' security and privacy while enabling more secure and controlled interactions with embedded ads. SafeFrame allows advertisers to display their content within a predefined, isolated iframe, providing more control over how ads interact with the host webpage. You should try SafeFrame if you are experiencing some kind of performance issues when your app is combined with video/banner ads - unsafe creatives
- Apache HTTP server
- Apache Module mod_proxy_balancer
- Block abnormal user acess in Apache — You may have experience that your website is so slow without any huge traffic-it will be something associated with a bot developed by someone. We have three different options to block abnormal user access in Apache: 1) set a global policy in the Apache httpd.conf 2) set a local policy based on ReWrite Rule in .htaccess. 3) Make a 404 not found error based on the user agent.
- Enable CORS in httpd.conf — Due to security reason, some platform does not allow to access files on apache web server that is super great feature in order not to make server in-stable, but some device having no domain connection may have no solution when requiring in communicating with such kind of servers. To resolve that issue, you will need to enable CORS in httpd.conf
- When VirtualHost does not work in Apache 2.2 — If you wanted to use VirtualHost, but it shows Testing 123... only, you should check your server configuration. You cam simply check your server if configuration works or not by httpd -S
- Apache Spark — Apache Spark is an open-source distributed general-purpose cluster-computing framework.
- Apple
- Prevent Apple device from going into sleeping mode — It looks like Apple devices are automatically going into the sleep mode when user has no interaction like touch pad or remote controller on tvOS, and that is controllable by UIApplication.shared.isIdleTimerDisabled
- Asuswrt Merlin Wifi Router — Asuswrt-Merlin is an enhanced version of Asuswrt, the firmware used by Asus's modern wifi routers. It is a third party alternative firmware for Asus routers, with a special emphasis on tweaks and fixes rather than radical changes or collecting as many features as possible.
- How to add cron job on Asuswrt Merlin Wifi Router — cru enables you to check/add/delete cron job on your Asuswrt Merline Wifi Router. Because Asuswrt does not save all the cron job by the limited storage, you should add cron job at /jfss/scripts/init-start, so the cronjob will be done as designed.
- Atlassian Confluence — Confluence is a collaboration software program developed and published by Australian software company Atlassian.
- [Resolved] Error occurred during template rendering on confluence 8.5.3 — My confluence 8.5.3 makes template rendering error after upgrading from 8.0.4 - previously it worked normally on 8.0.4. v8.0.4 is always triggering error - ThreadLocalCache is not initialised. Could not retrieve value for key GLOBAL_SETTINGS
- 503 Service Unavailable Error displayed in Apache Reverse Proxy environment — If you see 503 Service Unavailable Error in Apache Reverse Proxy Environment with the perfect settings, it might be something associated with server security - it can be solved by /usr/sbin/setsebool
- Add a Jira Kanban board to Confluence — Jira Kanban board is super useful tool to manage tasks efficiently. The similar tool popular on internet might be Trello, but its concept may also similar to Kanban if you take a look in detail.
- Broken Access Control Vulnerability in Confluence Server (Oct 2023) — Atlassian is aware of a problem that a few customers have reported. Attackers from outside the company may have used a previously unknown flaw in publicly accessible Confluence Data Center and Server instances to make fake Confluence administrator accounts and get into Confluence instances.
- Change port number for collaborative editing — If you need to change the port number for collaborative editing of Confluence, you need to add following line on <confluence home directory>/bin/setenv.sh
- Combine Google AdSense with Confluence — If you want to add AdSense to your confluence, that is super easy by adding AdSense scripts at Settings → General configuration → Custom HTML
- Force links to open in a new tab or window on Confluence — By default, all links are opened in the same window on confluence. In order to open that link in new tab or window, we can open it by CTRL+Click Link on new tab or window.
- Hide the Space Tools menu for Anonymous Users in Confluence — When you want to hide some menu for anonymous users, Custom HTML is useful.
- How do I check confluence java settings on Centos 7? — If you want to check your java settings on Centos 7, you can simply check by "ps" command.
- How to solve when Confluence editor page loading takes too long? — I am running multiple Tomcat instances for confluence, and faced that confluence page loading takes too long. In addition, my server suddenly faced huge amount of CPU consumption including memory.
- Integrate Jira and Confluence together — Jira project chart like Kanban can be easily embedded on Confluence, Please take a look following steps.
- Limit access permission to Confluence by IP address — I wanted to setup a confluence for me and some limited organization, but confluence does not have that feature at the moment, and I was able to make it by modifying server.xml.
- My confluence server has no response without any errors — If you found that your server shows "Proxy Error" - "Error reading remote server", it might be associated with the system resources or settings.
- Page break on confluence content — In case that you need a page break between para graphs, you will need to add following HTML tags
- Recover/Reset confluence on the existing CentOS server when you have the backup(zip) file — Confluence is installed at /opt/atlassian/confluence in CentOS environment, and the home directory is usally installed at /var/atlassian/application-data/confluence that is known as home directory. To reset confluence, what you should do is simply ereasing home directory. If your server accidentally does not work but the daily backup data is available, you can simple recover it by erasing the home directory.
- Restart confluence on Centos 7
- Restrict the ability to export a Space in Confluence
- Stylesheet for exporting PDF
- Uninstall confluence standard in CentOS 7 — Unfortunately, confluence package does not provide uninstaller, so you need to erase all associated files and settings manually.
- Atlassian Jira
- Get Atlassian Jira API Key — Atlassian provides an API for Jira. The guide is provided at https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/ https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
- AutoHotkey - open-source custom scripting language a.k.a. RPA tool for Microsoft Windows — AutoHotkey is a free, open-source custom scripting language for Microsoft Windows, initially aimed at providing easy keyboard shortcuts or hotkeys, fast macro-creation and software automation that allows users of most levels of computer skill to automate repetitive tasks in any Windows application.
- AutoML — Automated Machine Learning provides methods and processes to make Machine Learning available for non-Machine Learning experts, to improve efficiency of Machine Learning and to accelerate research on Machine Learning.
- AVOD — AVOD stands for Advertising-based Video On Demand. Unlike SVOD(Subscription VOD) and TVOD(Transactional VOD), AVOD is free to consumers. However, much like broadcast television, consumers need to sit thorugh advertisements. You can see AVOD in action when watching DailyMotion, YouTube and 4OD, where ad revenue is to offset production and hosting costs.
- AWS (Amazon Web Service)
- AWS API Access Key ID and Secret Access Key — In AWS, you need Access Key ID and Secret Access Key to call AWS functions. If you don't have access keys, you can create them by using the IAM console at https://console.aws.amazon.com/iam/ https://console.aws.amazon.com/iam/
- IAM
- bash — GNU Bash or simply Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. First released in 1989, it has been used widely as the default login shell for most Linux distributions and Apple's macOS Mojave and earlier versions.
- bash case statements — Sometimes we may wish to take different paths based upon a variable matching a series of patterns. We could use a series of if and elif statements but that would soon grow to be unwieldily. Fortunately there is a case statement which can make things cleaner. It's a little hard to explain so here are some examples to illustrate:
- bash if statement — bash if statement is one of the key features you can cover various use cases
- bash pause — pause function can be easily implemented in bash by read function.
- Monitor incoming HTTPD traffics in bash — tail is useful utility can display logs in Linux bash. tail -f <filename> will help you to show the recent access continuously,
- Perfect solutions when you face "Argument list too long" — The reason this occurs is because bash actually expands the asterisk to every matching file, producing a very long command line. There are some workarounds for cp, mv, rm by find, xargs, and etc.
- reboot_if_ping_does_not_work — Sometimes servers need to update its status or reboot by the condition to return its status to the best working environment to remove junk process or something like that. You can check that status by shell script.
- sed - replacing a string in a text file on bash — "sed" provides a method for searching-and-replacing a text in a specified file in bash, so you can make some scripts which can replace necessary things easily.
- Tail - useful when debug/monitor based on log file on Linux
- tee - append to a file using the tee command — tee is a command-line utility in Linux that reads from the standard input and writes to both standard output and one or more files at the same time.
- The default bash scripts useful on CentOS server
- Thread implementation in shell script — When you execute a Bash script, it will at maximum use a single CPU thread, unless you start subshells/threads. If your machine has at least two CPU threads, you will be able to max-out CPU resources using multi-threaded scripting in Bash. The reason for this is simple; as soon as a secondary ‘thread’ (read: subshell) is started, then that subsequent thread can (and often will) use a different CPU thread.
- C++
- CMake file example for building a C++ project — CMake is cross-platform free and open-source software for build automation, testing, packaging and installation of software by using a compiler-independent method. CMake is not a build system itself; it generates another system's build files.
- Implement an HLS stream in C++ using two different sources based on .m3u8 files — In this example, the code reads the URLs from two different .m3u8 files source1.m3u8 and source2.m3u8, combines and sorts them, and writes the combined list of URLs to a new .m3u8 file stream.m3u8. The output file can be used as the manifest for an HLS stream.
- Inserts an SCTE-104/35 AD Marker into a .m3u8 file — There are two differents identifying markers aka SCTE-104, SCTE-35 that created for distinguishing media stream like the original broadcast and advertisement. SCTE-104 is mainly created at SDI Feed and SCTE-35 is created at Encoder.
- Makefile example for C++ Project — The makefile is a text file that contains the recipe for building your program. It usually resides in the same directory as the sources, and it is usually called Makefile . Each one of these commands should be a separate rule in a makefile.
- Sample Multi Thread Application in C++ — In this example, two threads t1 and t2 are created to run function1 and function2 respectively. The join method is used to wait for the completion of the threads before the main thread terminates.
- Save information in Redis on CentOS 7 using the C++ Redis client library cpp_redis — This code connects to a Redis server running on localhost at port 6379 and saves the key-value pair "key": "value" to the database.
- STL (STandard Library)
- Streams from multiple HLS (HTTP Live Streaming) manifest files with multiple resolutions in a 30-second window — There are several classes defined: Segment, Playlist, and HLSManifest. The Segment class has two properties: resolution and url. The Playlist class has a vector of Segment objects and a method addSegment to add segments to the vector. The HLSManifest class has a map of Playlist objects, where the key is the resolution and the value is the Playlist object. It also has a method addPlaylist to add playlists to the map and a method `
- Streams HLS based on two different files as a live service within a 30-second window in C++
- CDN — A content delivery network, or content distribution network, is a geographically distributed network of proxy servers and their data centers. The goal is to provide high availability and performance by distributing the service spatially relative to end users
- CDN77 — CDN77 provides relatively cheaper and good CDN service for global market. It covers not only North America and Europe, but also Asian countries like Korea and Hong Kong. If you are considering global content distribution to North America and Euope, CDN77 is a pretty much good option.
- INXY — Price: USD 1.99 per 1TB = 0.00019 per 1GB
- CentOS 7 — CentOS 7 is a Linux distribution that provides a free, enterprise-class, community-supported computing platform functionally compatible with its upstream source, Red Hat Enterprise Linux
- CentOS warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory on CentOS 7 — If you faced an error "cannot change locale (UTF-8)", it can be simply solved to add following lines at /etc/environment
- Change MySQL port number — The default port that MySQL database server is running under Linux and Unix is 3306/TCP. In order to change the default MySQL/MariaDB database port in Linux, open MySQL server configuration file for editing by issuing the below command.
- Checking apache web server (httpd) version on CentOS 7
- Check network port is open or not on CentOS 7 — To check listening port on CentOS 7, you can do it by "netstat" simply, or you can try it by "ss". I was easily able to check which port is open or not on CentOS 7.
- chmod by type (directory and file permission) — To change permission by type (directory or file), the easiest way can do it is using find command and do something as a follow up action.
- Copy updated/new files if the date is no later than the target in Linux — You can backup the latest updated/new files by cp command in Linux(CentOS 7)
- Count number of HTTP threads in CLI — You may want to check the traffics in your server prom time to time, and checking CPU and number of threads are actually essential.
- Count number of process in Linux shell — In some cases, you may want to know the number of processes working in the system. You can know it by grep -ef | grep <process name> | wc -l
- Enabling a service on boot in Centos 7 — In case that you have service on /etc/init.d/ but it does not start automatically, you can simply enable it by run chkconfig function.
- firewalld on CentOS 7 — When the server is directly connected to the internet, the firewall is to be setup for security purpose. On CentOS 7, FirewallD is a kind of minimum requirements in terms of security point of view. You can simply install FirewallD by sudo yum install firealld and add policy by sudo firewall-cmd --zone=public --permanent --add-service=http
- Force a immediate reboot of a remote linux machine — "reboot" or "shutdown" commands are executed daemons are gracefully stopped and storage volumes unmounted. This is usually accomplished via scripts in the /etc/init.d directory which will wait for each daemon to shut down gracefully before proceeding on to the next one. That environment triggers dead-lock situation when one of the daemons are not closing gracefully. To force the kernel to reboot the system will be adding an additional parameter "-f"
- Forward all incoming packets through a certain port to destination address by iptables on CentOS7
- Free SSL Certificate powered by Let's Encrypt on your CentOS server
- How do I send email on command line in Centos 7? — Unfortunately Centos 7 minimal version does not have mail client running on command line, but you can use it by installing mailx.
- How to avoid CORS errors on CentOS 7
- How to check CentOS version? — The simplest way to check CentOS version is reading release information on /etc/centos-release:
- How to Extract Files From a .tar.gz or .tar.bz2 File on CentOS 7
- How to monitor CPU temperature on CentOS 7 — One of the pain points I experienced was that ffmpeg makes CPU in high temperature, so server die. In that case, you may want to check CPU temperature, and watch sensors enables to see it in realtime.
- Increase Number of Open Files Limit in Linux — In Linux, there are some cases that application needs to open multiple files at the same time - probably database like MySQL is one of the cases accessing multiple files at the same time, because MySQL create files for table and its index on the file system, so it will cause opening multiple files at the same time.
- Install Git 2.x on CentOS 7 — You may want to higher version of Git if you use Visual Studio Code (a.k.a. vscode) - its version will be Git 2.x probably. In that case, you can install by WANDisco repo package easily.
- Install GitLab Community Edition on CentOS 7 — GitLab is an open source repository manager based on Rails developed by GitLab Inc. It is a web based git repository manager that allows your team collaborate on coding, testing and deploying applications. GitLab provides several features, including wikis, issue tracking, code reviews, and activity feeds. GitLab Community Edition is designed to self-hosted and free, but it does not provide technical supports. GitLab supports not only for CentOS but also other operating system as well.
- Install mod_url to support multi byte characters on CentOS 7 — mod_url enables httpd to support multibyte characters like Korean file, so you can download Korean file (한글파일) from your apache server without any error message. httpd basically does not support it, so you should install mod_url.
- Install MySQL 5.7 on CentOS 7 — To install MySQL 5.7, you should enable MySQL 5.7 community release yum repository on your system.
- Install PHP on CentOS 7 — You need to run yum in order to use PHP after setup your CentOS 7. Even though you have httpd, PHP may need to be installed manually. For compatibility with various applications like PHPMyAdmin, PHP-based server management, you will need to install additional libraries.
- Install PIP on CentOS
- Install Python 3.8 on CentOS 7
- Install the latest version of Python on CentOS 7 — This is the easier method of the two for installing Python on your machine. Here, we simply add a repository that has the pre-compiled version ready for us to install. In this case, we are adding the Inline with Upstream Stable repository, a community project whose goal is to bring new versions of software to RHEL-based systems.
- libstdc++.so.6: version `GLIBCXX_3.4.20' not found error
- List the current process by CPU occupation rates — ps is useful command to check process. It also supports to check CPU occupation rates.
- Method to check if OS is 32bit or 64bit on CentOS — To know whether your system is 32-bit or 64-bit, type uname -m
- Mount remote directory by SSHFS in CentOS 7 — SSHFS is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection.
- Mount samba shares on CentOS 7
- Mount USB mass storage device in exfat on CentOS 7 — To mount USB mass storage device on CentOS 7, you need to add a package repository first and install some exfat utilities.
- My Centos does not have X Windows, how do I install it? — I haven't installed any graphical interface like X Window on Centos, and found its solution how to install it for my personal purpose. Please take a look below steps to install "Gnome Shell" as a main graphical interface.
- NTP on CentOS 7 to synchronize date time clock — NTPD enables you to synchronize the system clock with public ip server.
- Prevent yum command from updating kernel on CentOS 7 — You can simply prevent yum command from updating kernel by adding excluding=kernel* to /etc/yum.conf
- ps aux to json — In case that you need to get process status in JSON, you can generate it by awk combined with ps.
- pstree on CentOS — pstree is useful tool, but it is not a default application when you setup CentOS. So you will need to install it by yum.
- Reboot server if Google DNS does not respond — The below sh script trigger rebooting server if Google DNS does not respond
- Set locale to en_US.utf8 — If you need to change character set to en_US.utf8 or ko_KR.utf8 on CentOS 7, you can change it by localectl r changing locale.conf. Please take a look belows
- Setup a reverse proxy with mod_proxy on CentOS 7
- Set user in sudoers and run commands with no authentication password in CentOS — You usually need to put password to run commands in sudo. You don't need to put user password if your account belongs to sudoers even though that is not that safer in terms of security point's of view.
- systemd-journald extremely high CPU usage reaching 100% on CentOS — You may want to remove systemd-journald if you faced a case like below situation that reaches 100% of CPU usage by systemd-journald in a limited environment. journald is one of the important service in the linux environment. You can enhance that situation by modifying log level.
- Turn SELinux off on CentOS — SELinux(Security-Enhanced Linux) is a Linux kernel security module that provides a mechanism for supporting access control security policies, including mandatory access controls. SELinux is a set of kernel modifications and user-space tools that have been added to various Linux distributions.
- Upgrade PHP on CentOS 7/RHEL 7
- Using Redis in PHP on CentOS 7
- CentOS 8 — CentOS 8 is based on Fedora 28 and upstream kernel 4.18: Python 3.6 and limited support for Python 2.7, PHP 7.2, Ruby 2.5, Perl 5.26, MariaDB 10.3, MySQL 8.0, PostgreSQL 10, PostgreSQL 9.6, Redis 5, and etc,
- Configure Firewall on CentOS 8 — On CentOS 8, the default firewall is firewalld, which is used to manage iptables rules on the server. To enable and start the firewalld service on the server, run the following commands.
- Enable/disable network interface on CentOS 7 / CentOS 8 — Once you are done with network configuration, you need to run nmtui-connect to enable/disable network interface based on your need.
- Install htop on CentOS 7 / CentOS 8 — htop is a good option to monitor your system interactively. In order to install htop, you will need to use dnf. If you cannot install htop by yum, you will need to follow following procedure on CentOS 8.
- Install lynx on CentOS 7 / CentOS 8 — I usually use lynx to check website on my terminal, because and it does not require to be on graphical environment - meaning I can see its content on terminal console. It can be installed by adding PowerTools repository in Yum.
- Install MySQL on CentOS 8 — When you install MySQL on CentOS 8, you will need to install other associated packages as well. It can be easily solved by @ option when you call yum command.
- Install PHP on CentOS 8 — You need to run yum in order to use PHP after setup your CentOS 8. Even though you have httpd, PHP may need to be installed manually. For compatibility with various applications like PHPMyAdmin, PHP-based server management, you will need to install additional libraries.
- Remove/Manage services on CentOS 8 — ss or netstat are useful command line tool can list up open ports combined with network services for TCP/UDP. And you can stop/disable/remove that service by systemctl and dnf. Finally you can see process tree by pstree or htop to discover and identify all the process running on your server.
- Set Hostname on CentOS 7 / CentOS 8 — nmtui-hostname is useful command in CentOS 8 which promt you to enter your machine hostname and press OK to finish.
- Set static IP address on CentOS 7 / CentOS 8 — CentOS provides a command line tool - mntui-edit - it will help you to change the necessary internet settings easily.
- Chatbots
- Chrome Extension — Extensions are software programs built on web technologies (such as HTML, CSS, and JavaScript) that enable users to customize the Chrome browsing experience.
- Sample manifest for Chrome Extension Version 3 — The manifest file is a JSON file. Here we list the name, description, icons, and manifest version--among other things--of our Chrome extension. For this tutorial, we're working with manifest version 3; think of it like the software version.
- Save values on Chrome Extension
- Data Visualization Tools
- Delphi
- Accessing Registry Keys and Items on Windows — TRegistry is a useful class can access Windows Registry which can check if the key exists or not, create a key, write a key, and etc.
- Adding a secret key in a program file — I had some projects needs to put its own secret key when they needed, and the secret key should not be exist as an alternative file or stored in any secret place in order to have mobility - meaning that application having a secret key should be able to use in any PC/Laptop. The easiest approach can do that is adding an additional information at the end of the binary file.
- Associate a Delphi application with a file extension — When user register a application by user choice, there are some registry entries automatically created by windows. By doing the same behaviors like windows, application can be launched automatically by clicking associated files.
- Capture Console Output To Memo in RealTime — The below code captures console outputs and send it in real time to callback function, so the application can handle it such as displaying its progress by adding to memo, so end user may not think the application is hanging while program performing the command.
- Combo box in readonly mode — Sometimes you may want to make user to select item on combo box without any editing permission. For your information, Combo Box is basically allowed user to edit its internal content.
- Downloading a web page as string from web site in Delphi — One of the easiest way can get web page as string is to use TIdHTTP.Get function.
- Enable internet proxy on windows by changing registry key — The code here simply set EnableProxy property to checked on Control Panel like below
- Encrypting a text string based on a key in Delphi — There are lots of way can encrypt a text string based on a key. By the approach, you can use a single numerical key, or text string. In terms of security's point of view, text string-based key has better security performance.
- Exec and Wait with new Thread
- Execute a Console Program and Capture Its Output
- ExtractFileExt — Delphi provides useful filename functions for file drive, file dir, file path, file name, and file ext.
- Find Files in Delphi — The custom procedure FindFiles locates files in a given directory (folder) and its subdirectories, and adds their complete path to a stringlist. Note that recursion is used: FindFiles calls itself at the end of the procedure!
- Get Current Directory
- Get local IP address in Delphi — Introducing three different approaches to get local IP address in Delphi: Winsock, TIdStack and TIdIPWatch.
- Get My Document Folder Location by TPath
- Get remote filename from URL in delphi — To get the filename from a URL, you can retrieve the HEAD information and check Content Disposition header field. For this task, you can use the TIdHTTP indy component. If the Content Disposition does not have the file name, you can try parsing the URL.
- Get Timezone Information in local machine in Delphi — GetTimeZoneInformation() enables you to get timezone information in standard name, standard bias, daylight name, and daylight bias.
- Get Windows Temp Directory — GetEnvironmentVariable() enables to get get environmental variables like TEMP.
- Get year, month, day from current date time — When getting system date time information, DecodeDate() is useful.
- Kill a process directly by program name — In order to terminate process on the current process list, you will need to refer Process Entry - by comparing process name and process entry, you can terminate it by comparing process name.
- Message Dialog in Delphi — MessageDlg() enables you to display system dialog based on various dialog type as well as system buttons,
- Put administrator permission to the Delphi application
- Read/Write data in Windows Registry — TRegistry enables you to read registry entry.
- RunAsAdminAndWaitForCompletion - replacement of ShellExecute
- Run as Administrator and Wait for Completion in Delphi — You may use ShellExecute to run DOS command in Delphi, but it causes lots of run-time error in Windows 10+ based on my experience, because system requires to have some sort of permission. Custom function RunAsAdminAndWaitForCompletion() will help you to clear that issue.
- Running with Delphi application with parameters — If you are considering taking parameters when starting your app, you can take it by ParamCount and ParamStr.
- Save/Load using file in Windows Registry — When application use a certain file, and there are some needs to use the previous file in many reason. In that case, Windows Registry is useful.
- Save Text in TStringList in UTF8 in Delphi — Delphi provides a straightforward way when saving text in TStringList in Unicode. Please see following example.
- Select Directory in Delphi — Below code is an example to select directory by TFileOpenDialog:
- Simple function can select directory in Delphi — Instead of using TOpenDialog, Delphi provides super simple function can select directory as following:
- Simple Thread Example in Delphi
- String replace by regular expression in Delphi — TRegEx is a useful class for regular expression. You can define a instance with a regular expression, and match the case by TMatch. If the case exists, the search can be continued by TMatch.NextMatch.
- StringReplace in Delphi — Delphi provides a straight forward function can replace string - StringReplace
- Update domain name at DNSZI in Delphi — To update IP address at DNSZI(http://dnszi.com) http://dnszi.com), you need user ID, auth key, your domain name, and its hostname.
- Difference between Host and Guest Operating System — The main difference between Host and Guest Operating System is that the host operating system runs directly on the hardware while the guest operating system runs on the virtual machine. You can run hypervisor like QEMU, VMWare, and etc, and setup virtual machines based on your design.
- Docker
- Installing docker on Centos 7
- Installing docker on Mac
- Installing docker on RedHat
- Installing docker on windows — Just tested it on windows 10, so other OS version may not able to run as I have done.
- EmEditor — EmEditor is a text editor for Windows that supplies larger files and Unicode, macros, plug-ins and more
- Escort
- ffmpeg — ffmepg is a integrated tool for video encoding/decoding processing as open source project - http://ffmpeg.org http://ffmpeg.org
- Add an image overlay in front of video using ffmpeg — ffmpeg enables you to overlay image on top of the video.
- Burnt-in SRT subtitle based on ffmpeg — ffmpeg provides the straight and easy way to burn-in SRT subtitle. By forece_style, you can customize your subtitle format like font, fontsize,outline,outlinecolor,borderstyle and so on. The disadvantage of burnt-in caption is that can make bad TV experience for those who does not want to see the subtitle on top of the screen. On the contrary, the benefit of the burnt-in subitie is that doesn't require any additional technical tools/modules on the client.
- CEA-608/708 Closed Caption — CEA-608/708 cpations are the standard for Digital Video Broadcasting supporting closed caption as a part of video stream. CEA-608 captions are for NTSC vodeos only and its captions are encoded in the signal's VBI for NTSC. CEA-708 captions are considered for digital television only and are encoded directly into the MPEG data packages. The captions follow the CEA-708-D FCC recommendations.
- Creating a master HLS playlist.m3u8 in FFmpeg — FFmpeg kindly provides a straightforward way can create master HLS playlist. You can simply do it by adding master_pl_name as a part of ffmpeg encoding options. Make sure to require a closed GOP when encoding and to set the GOP size to fit your segment time constraint. For more information, please refer at https://ffmpeg.org/ffmpeg-formats.html#hls https://ffmpeg.org/ffmpeg-formats.html#hls
- Encode mp4 with multi subtitles in ffmpeg — ffmpeg can embed subtitles as a part of tracks in a single file.
- Encoding videos in .ts by FFmpeg — Below example shows how to encode video in .ts by FFmpeg
- ffmpeg overlay effect with fade in/out and alphablending — ffmpeg has a feature to overlay image on top of the video with fade-in and fade-out. It also able to combine with alpha value, so its interaction could be more smoother.
- ffmpeg with NVIDIA CUDA GPU
- Installing FFmpeg on CentOS 7 — sdsds
- Splitting video file by size in bash
- Firebase — Firebase is a mobile and web application development platform developed by Firebase, Inc. in 2011, then acquired by Google in 2014.
- Git — Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
- Block accessing .git directory in the Apache Server — You should block accessing your precious source code when you use Apache web server and manage your code based in Git - meaning Hacker can easily stole your precious information from your source code directly when you have .git on your repository directory.
- Clone a git repository to another directory — To clone to another directory at git, just add the target directory in the clone command.
- Setup Git Client with TortoiseGit on Windows 10 — TortoiseGit is a kind of family project with TortoiseSVN and TortoiseCVN, so if you are familiar with that, you will be easy to use it.
- Setup Git server on CentOS 7 — Git is a part of CentOS 7 repository, so you can install it easily by yum.
- Setup Git server on CentOS 8 — Just like CentOS 7, CentOS 8 provides git as a part of repository. You can simply install it by yum - it is super straightforward and easy in terms of server's point of view. It requires just creating an account for git and running couple of commands.
- Useful git command scripts in bash — git provides a straight forward and strong commands, but sometimes scripts will help you to make things simpler.
- GitHub
- GitLab - Cloud-Native CI — GitLab is a web-based DevOps lifecycle tool that provides a Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features, using an open-source license, developed by GitLab Inc.
- 502 - Whoops, GitLab is taking too much time to respond — If you face 502 error from gitlab server, it means that server is busy for doing something in most of cases. It might be associated with server performance.
- Apache settings when GitLab Web IDE does not work under proxypass environment
- Changing GitLab repository — In order to change the data directory, you need to add git_data_dirs in /etc/gitlab/gitlab.rb
- Creating multiple GitLab merge requests in CLI. — Whenever I need to create multiple merge requests for Git, I use shell scripts in CLI.
- GitLab bash commands useful — While collaboration, you may need to pull, commit, and push in CLI. Followings are bash scripts I use in my system.
- GitLab Project Title with a special character
- GitLab Tutorials
- SSH based code sync up with GitLab on Windows 11
- Google Cloud Printer — Google Cloud Printer enables you to print on any network environment once that is connected to the internet. The requirements for you to use it is google account and your printer connected to your host computer.
- GraphQL — GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data.
- gRPC — gRPC (gRPC Remote Procedure Calls) is an open source remote procedure call (RPC) system initially developed at Google. The first g seems like Google.
- G Suite
- Getting an email in a single mailbox with multiple domain name at G Suite — I have lots of domain name and use G Suite for a single domain. I needed to create a mail account for one of another domain names, and tried to find a way to combine with the existing G Suite domain. Following procedure enables you to combine your G Suite with multiple domain names.
- HLS Live
- An example of an HLS manifest file (.m3u8) that includes a subtitle track — HLS supports subtitle as a part of HLS manifest (.m3u8)
- Apple's Media Stream Validator (mediastreamvalidator) to verify HLS — Apple provides HTTP Live Streaming Tools to help you set up an HTTP Live Streaming service. Media Stream Validator(mediastreamvalidator) is a tool to verify if your HLS has no compatibility issue or not. You can download it at https://developer.apple.com/documentation/http_live_streaming/about_apple_s_http_live_streaming_tools https://developer.apple.com/documentation/http_live_streaming/about_apple_s_http_live_streaming_tools
- Example HLS Manifest (m3u8)
- EXT-X-DISCONTINUITY in HLS — EXT-X-DISCONTINUITY marks a discontinuity between two consecutive segments. Your discontinuity is between segment1.060.ts and file.000.ts. There is no discontinuity between file.000.ts and file.001.ts so no need to re-insert the tag
- PlutoTV HLS Manifest (m3u8) example
- Resolve MUST fix issues for Measured peak bitrate in HLS with mediastreamvalidator — You need to set buff_size = max_buffer_size * 1.5, min_buffer_size = max_buffer_size * 0.92, avg_buffer_size = max_buffer_size * 0.96, gop=60, fps=30 in ffmpeg to avoid MUST fix issues with Apple meadiastreamvalidator.
- SCTE 35 PID(Packet IDentifier)
- Video bandwidth comparison for MPEG-1, MPEG-2, MPEG-4 — Usually MPEG-4 is 2-2.5 times smaller than MPEG-2 and 3-4 times smaller than MPEG-1. MPEG-2 is 30% smaller than MPEG-1.
- HTML / HTML5 — HTML5 is a software solution stack that defines the properties and behaviors of web page content by implementing a markup based pattern to it. HTML5 is the fifth and current major version of HTML, and subsumes XHTML.
- Adding HTML content dynamically by innerHTML — When you assign ID for HTML entity for <p> tag or <div> tag, we can dynamically update its content. You can find the object by getElementById(), and do the necessary actions into innerHTML. For instance, you can do it like document.getElementById( "element_id").innerHTML = "hello, world!";
- Change text color, font size and background color in textarea — You can assign text color, font size, background color by style sheet in textarea
- Combo box (drop-down list) in HTML — To implement Combo box also known as drop-down list, you should use <select> tag
- Creating a beautiful table with CSS(style sheet) in HTML5
- CSS cursor Property in HTML5 — CSS can generate a bunch of different mouse cursors:
- Drag and drop image in div tag in Javascript/HTML5 — Drag and drop is a very common feature. It is when you "grab" an object and drag it to a different location. In HTML5, drag and drop is part of the standard: Any element can be draggable. The element you should keep in mind is draggable="true" ondragstart="func(event)" for starting drag, and ondrop="drop(event)" ondragover="allowDrop(event)" for accepting dragging.
- Draggable DIV tag combined with Javascript — For draggable DIV tag, what you need to keep in mind is "position: absolute" in style sheet.
- Drawing circle — arc( x, y, radius, sAngle=0, eAngle=0) enables you to draw a circle easily.
- Drawing rectangle — In order to draw rectangle, you can use rect( x, y, width, height).
- Enable Word-Wrap with Pre Tags — pre tags are super-useful for code blocks in HTML and for debugging output while writing scripts, but how do I make the text word-wrap instead of printing out one long line?
- HTML5 Canvas — The HTML5 <canvas> tag is used to draw graphics, on the fly, via scripting (usually JavaScript). However, the <canvas> element has no drawing abilities of its own (it is only a container for graphics) - you must use a script to actually draw the graphics. The getContext() method returns an object that provides methods and properties for drawing on the canvas.
- HTML5 File Upload Progress Bar — By the combination of PHP + HTML + Ajax, you can render an file upload progress bar in your file upload forms. It will help for user to understand what is going on on server side, and the user may able to recognize if anything wrong is happen.
- Playback Video in HTML5 — In HTML5, playback video is super easy by <video width="...." height="...." autoplay> tag. You can also set its source by <source src="movie.mp4" type="video/mp4"> tag.
- Redirect from an HTML page — Page redirection is a situation where you clicked a URL to reach a page A but you were directed to another page B. It happens due to page redirection. To redirect from an HTML page, use the META Tag. With this, use the http-equiv attribute to provide an HTTP header for the value of the content attribute. The value in the content is the number of seconds; you want the page to redirect after.
- Set text and background color in HTML body — You can simply set text and background color by style in HTML body
- Viewport for optimizing web pages for computer and tablets
- IAB Categories (a.k.a. OpenRTB Code) — The IAB categories are an industry standard and are heavily used in services like advertising and Internet security and filtering appliances. There are 26 tier-1 (top level) categories, 366 tier-2 (sub level) categories, and an additional 12 tier-3 categories that are specific to the Webshrinker category service. The total number of categories are 404.
- Java
- Javascript — JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat.
- Bootstrap
- Bootstrap Datepicker Working Sample — Datepicker is a useful library wihch can provide user friendly interface just like a real calendar. The tagging method needs to be changed by Bootstrap version
- Modal Dialog Example based on Bootstrap 4 — Modal Dialog Example based on Bootstrap 4 is super easy as long as you understand the concept.
- Browser Memory Checking — In JavaScript, you can't directly access the amount of memory consumed by your code or variables using a standard API. JavaScript does not provide a built-in method to check the memory consumption of objects or variables. However, you can make use of browser-specific tools and techniques to monitor memory usage for debugging purposes.
- Close tabs in a browser that are associated with a specific domain like "foo.com" using JavaScript code — You can close tabs in a browser that are associated with a specific domain like "foo.com" using the following JavaScript code
- Disable console.log() in javascript — Sometimes console.log() causes a lot of performance and memory issues while its application leaves the repossess for service monitoring/debugging. You can disable console.log() by redefine its functional prototype like console.log = () => {};
- Javascript code snipets
- Array.forEach( function(currentValue, index, arr) {} ); — forEach() method calls a function for each element in an array.
- Array Length in JavaScript — In JavaScript, <array>.length returns the total number of item.
- Check if the variable is object or not — typeof <variable name> shows its type in string in JavaScript
- Check whether a checkbox is checked in Javascript — Checkbox object in HTML has a property checked as boolean - it has true or false, so javascript can check its status easily.
- Count number of lines in the string in Javascript — Counting number of lines in the string in Javascript is able to implement by regular expression.
- Create empty array and add its elements in JavaScript — You have two main ways to create empty array: const myArray=[] or const myArray = new Array();
- Error count when loading remote JS script when considering Ad Blocker Detector — Ad Blocker usually blocks the browser to load remote scripts and it causes error on the browser. In this case, we may able to count the number of errors when the page does not load the javascript as designed. Ad Blocker Extension blocks loading remote script in the browser based on its filtering logic, so we can assume if the Ad Blocker is installed or not by counting number of scripts blocked.
- Extract Filename or Path from URL in JavaScript — You can get filename and its path easily by the string operation function included in JavaScript.
- file_exists( url ) to check availability of the file with javascript without jQuery — XMLHttpRequest() enables you to check file availability by its methods: open, send and status.
- Find images in HTML with javascript — document.getElementByTagName() enables you to find objects based in tag name like img, a, ...
- Get file extension in Javascript
- Input Text readOnly Property in Javascript — Set a text field to read-only in javascript
- Loading javascript file conditionally — If you need to load javascript by the case like domain name, you can do that by getElementByTagName() and appendChild(). For instance, you can run application by the screen width.
- Load JSON file parsed from the text in JavaScript Variable
- Load remote javascript code dynamically — A common approach load remote JS code is to use <script src="..."></script>, but sometimes you will be required to load the remote JavaScript code dynamically. Then you can simple do it by creating script element by document.createElement('script')
- Open window in the center of the screen
- pathinfo() to parse protocol, hostname and pathname from the given url path with javascript — createElement() with javascript enables you to have all the necessary properties easily
- Play beep sound in Javascript — Javascript does not have a built-in function to produce a beep sound directly. However, you can achieve a similar effect using the HTML5 Audio API to play a short audio file or use the 'navigator.vibrate()' API to vibrate the device if it supports it.
- Recognizing a 404 not found error in an iframe — When the iframe fails to load due to a 404 error or any other error, the 'onerror' event will be triggered, alloing you to handle the situation accordingly.
- Remove all associated child objects to avoid memory leaks — To avoid memory leaks in JavaScript, you need to make sure that you remove all references to an object when you're done with it. This includes event listeners, timers, and any other objects that might hold references to the object you want to clean up.
- Run a specific function by certain interval — The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds). The setInterval() method will continue calling the function until clearInterval() is called, or the window is closed. The ID value returned by setInterval() is used as the parameter for the clearInterval(obj) method.
- Run a specific function by timer in Javascript — Javascript provides a straightforward function setTimeout() to implement timer-based application easily.
- Stop timer in Javascript — clearTimeout() can stop the running timer based on the variable. Below code shows the simple example to stop running timer.
- String to ISO Dates, Date to String in Javascript — If you want to put date information as string like "2020-07-30" to date in javascript, bingo! - it works correctly.
- jQuery — jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
- $.ajax({ async:true, url:url, success: function(v), error: function(xhr,status,err), timeout:3000}); — The ajax() method is used to perform an AJAX (asynchronous HTTP) request. All jQuery AJAX methods use the ajax() method. This method is mostly used for requests where the other methods cannot be used.
- $.ajax with formdata — To pass an array variable from a form through jQuery's ajax() method, you can serialize the form data and send it as the data parameter. Here's an example:
- $.get( url, function(data,status) {} ) — $.get( url, function(data, status) {} ); is the straightforward and easy solution can download remote files or API response.
- Get POST method result from a server in jQuery — By jQuery, you can call server API by jQuery.ajax() in synchronus/asynchronous manner, and use that response on your code. The parameter can be added to FormData() in real-time.
- jQuery Example: $.ajax() example to load external content and display on the div area in HTML — In jQuery, $.ajax() gives you full control over the Ajax request. You should use it if the other methods don't fullfil your needs.
- jQuery Example: get JSON feed directly — $.getJSON() helps you to load JSON data from the remote server.
- jQuery Example: Run JavaScript code when the HTML page gets ready — $(document).ready(function()) {} helps you to run certain javascript when the HTML page is fully loaded
- Pop up a floating window in HTML
- Showing and Hiding content in jQuery
- node.js — Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- Prevent web app into sleep mode by Javascript — You need to take a look at navigator.wakeLock object if you do not want to prevent your web app into the sleep mode. Unfortunately it is not supported in Safari and Firefox, but Chrome browser supports very well.
- react.js — React is a JavaScript library for building user interfaces. It is maintained by Facebook and a community of individual developers and companies. React can be used as a base in the development of single-page or mobile applications.
- tensorflow.js — tensorflow.js is a JavaScript library for training and deploying ML models in the browser and on node.js.
- The page visibility API to check if the browser’s tab is active or not in JavaScript — You can use the page visibility API to check whether the current tab is active, closed, or minimized. Whenever the user changes the tab, minimizes it, or opens it again, the visibilitychange event gets triggered in the document.
- TinyMCE — TinyMCE is an online rich-text editor released as open-source software under the LGPL. It has the ability to convert HTML textarea fields or other HTML elements to editor instances.
- Disable TinyMCE absolute to relative URL Conversions — TinyMCE kindly converts my URLs to relative links, but eventually it breaks the content link in my case. In order to avoid that situation,
- Paste image from clipboard in TinyMCE — You may want copy & paste images just like Microsoft Word - it will be technically pasting from clipboard in your system memory. You can simply do it by adding paste in plugin and paste_as_text=true, paste_as_image=true.
- TinyMCE example for Self-hosted release — In order to use TinyMCE self-hosted version, you need to download the latest version of TinyMCE package. It can be downloaded at https://www.tiny.cloud/get-tiny/self-hosted/ https://www.tiny.cloud/get-tiny/self-hosted/.
- TinyMCE Sample based on TinyCloud — TinyMCE based on TinyCloud needs to register its website to TinyMCE. You can get a guide at https://www.tiny.cloud/docs/quick-start/ https://www.tiny.cloud/docs/quick-start/
- Uploading images/files in TinyMCE — You may need to upload files like images and other files together with TinyMCE in some cases. In that case, you need to 1) include 'image media' in plugins, and file_picker_callback, 2) add a hidden button for uploading files, 3) create an additional php code(upload.php) on the server.
- Useful Javascript Snifets — is_empty(), _size(), _() are useful javascript code snifets frequently used for development
- Vue.js — Vue (pronounced /vjuː/, like view) is a progressive framework for building user interfaces that based on MVVM(Model–View–ViewModel). Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable. The core library is focused on the view layer only, and is easy to pick up and integrate with other libraries or existing projects. On the other hand, Vue is also perfectly capable of powering sophisticated Single-Page Applications when used in combination with mod
- Bootstrap
- libcaption - open source based closed caption — libcaption is a library written in C to aid in the creating and parsing of closed caption data, open sourced under the MIT license to use within community developed broadcast tools. To maintain consistency across platforms libcaption aims to implement a subset of EIA608, CEA708 as supported by the Apple iOS platform.
- List of Social Networks Share URLs
- Mac
- How do I fix "Java Command-Line Tool Pop-Up" on Mac OS
- How to fix when Mac book pro fan is too loud(noisy)? — When your Mac book pro fan is loud without any dependency in running application, you should have a doubt. Usually the fan could be noisy when your Mac book needs to cool system's heat. But if that is not the case and fan is working loud, it might be caused by some kind of complex conditions triggering that in SMC(System Management Control) associated with temperature sensor in Mac book pro.
- When command key + buttons does not work like command + c, command + w, ... on Mac or Windows — You can simply solve the situation if you keyboard is locked by fn + command. You can return it by fn + command again.
- Microsoft EXCEL — Microsoft Excel is a spreadsheet developed by Microsoft for Windows, macOS, Android and iOS. It features calculation, graphing tools, pivot tables, and a macro programming language called Visual Basic for Applications.
- Microsoft Windows — Microsoft Windows is a group of several graphical operating system families, all of which are developed, marketed and sold by Microsoft. Each family caters to a certain sector of the computing industry.
- Batch file can kill explorer running on background and start new instance
- Disable windows update on Windows 10
- How to stop kicking user out while remote desktop connection is established on server
- How to view saved Wi-Fi passwords in Windows 10
- Install OpenSSH on Windows 7
- Install SSH on Windows 10
- Kill chrome.exe to escape slow computer performance
- List tasks running on the system
- Logon automatically when power is on
- Port forwarding in Microsoft Windows by PortProxy in NetSh
- Update windows on command line — Microsoft Windows Update can be done by command line tool. What you should do is very simple: wuauclt /detectnow /updatenow
- Virtual desktop on windows 10
- Windows 10 built-in alarm clock - you can set alarm easily
- MikroTik Router — MikroTik is a Latvian network equipment manufacturer. The company develops and sells wired and wireless network routers, network switches, access points, as well as operating systems and auxiliary software. The company was founded in 1996 with the focus of selling equipment in emerging markets.
- How do I open WebFig for External User in Mikrotik Router — In order to allow connect to Mikrotik Router WebFig remotely, you should add a firewall filter and NAT rule for remote connection in WebFig.
- How to setup a hairpin to certain local server — I have a web server needs connection from external/internal location, but just opening a port, by NAT Port Forwarding, may not good enough as far as I experienced in MikroTik router - you cannot connect to your server by domain name. Following configuration enables you to connect to your local server by domain name like you do on external network.
- MySQL
- Backup (dump) and restore database in mysql — mysqldump enables you to backup all the necessary database you need, and mysql enables you to restore the dumped data on linux console.
- Essential problem solving method for MySQL query containing emoticon like '\xF0\x9F\x94\x8A S...' — You should alter table charset to use utfmb4 collate utf8mb4_unicode_ci if you face query error when the query string containing emoticon like 📺 or 🔊. Its error message will be something like SyntaxError: Non-UTF-8 code starting with '\xed' ...
- Increase max_open_files for Mysql max-connections in Ubuntu 15
- Insert a record in array into MySQL database with PHP — Technically you cannot insert array values into MySQL database table directly without understanding its data type correctly. If it's data type is all the same, you can implement it by array_keys()
- MySQL connection status — CLI command to check # of network connections for MySQL (port:3306)
- MySQL Query based in RegExp
- MySQL Replication for enhancing performance or backup — If you are considering securing more performance in MySQL, Replication is one of the options you can take. You may able to setup a main database for Write, and the other option you can take is to setup a replication connection between main and another MySQL server. Another server could be used for read-only.
- Repair / Optimize MySQL Database
- Restore dumped MySQL data on CentOS 7 — Restoring dumped MySQL data is something painful. _restore_mysql.sh enables you to restore the dumped MySQL data easily.
- Setup MySQL 8.x on Mac — There are some differences in between Mac and Linux(CentOS) for my.cnf and some command line interfaces. There are two different approach to install MySQL on MAC: 1) Install by dmg file can download at https://www.mysql.com/downloads/ https://www.mysql.com/downloads/ and 2) installing by brew. I will talk about the installation based on brew here.
- NGINX — Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004. Nginx is free and open-source software, released under the terms of the 2-clause BSD license.
- npm — npm stands for Node Package Manager for the JavaScript programming language maintained by npm, Inc. npm is the default package manager for the JavaScript runtime environment Node.js. It consists of a command line client, also called npm, and an online database of public and paid-for private packages, called the npm registry.
- ownCloud
- Add local system directory to ownCloud as external storage in options — You may not able to add your local system storage in the system ownCloud installed. It's conceptually system local storage, but treated as external storage in terms of ownCloud's point of view.
- PHP — PHP: Hypertext Preprocessor is a general-purpose programming language originally designed for web development. It was originally created by Rasmus Lerdorf in 1994; the PHP reference implementation is now produced by The PHP Group.
- 32bits simple hash function in PHP — PHP provides a simple function can hash in 32bits - hash( $algorithm, $key) - it will provide 8 bytes string as hash result.
- Array of arguments passed to script in PHP — $argv is an array of arguments passed to script in PHP, so you can know the parameters when user run the script
- Bob Jenkins' One-At-A-Time hashing algorithm in PHP — Bob Jenkins' One-At-A-Time hashing algorithm is simply known as jenkins_hash() providing 8 bytes long hash value.
- Call PHP-based server URL without its extenstion (.php) — If you develop software based in PHP but you don't know to show its extension(.php) like http://foo.com/auth http://foo.com/auth instead of http://foo.com/auth.php http://foo.com/auth.php, you can make your PHP page work without its extension by adding ForceType application/x-httpd-php on .htaccess
- Check CPU - is AMD or Intel? — In CentOS 7, CPU information is stored in /proc/cpuinfo, so you can implement to acquire CPU information in the system.
- Check if user is root or sudo in php — posix_getuid() returns non-zero if user is root or sudo, so you can warn user to use an appropriate permission if required.
- Checking XML element by preg_match — Below code shows how to check XML element by preg_match
- Clearing a PHP value/array — Sometimes, you will need to reset variables, and unset() will help you to do it.
- Client IP address in PHP
- Codes need to be changed when upgraded from PHP 5.6 to PHP 7.3
- Copy array in PHP — array_merge() is a straightforward and easy function can copy/merge/concat in PHP
- Count number of processes and do something in PHP — You can limit number of cron jobs, if you use PHP for DevOps software in CentOS 7, which can be easily implemented by checking process by shell_exec.
- Crontab run parts in every 5mins
- Custom URLEncode encoding multi-byte character only
- Date Time conversion for RSS / Sitemap in PHP
- Delete one element in PHP array — The unset() function in PHP resets any variable. If unset() is called inside a user-defined function, it unsets the local variables. If a user wants to unset the global variable inside the function, then he/she has to use $GLOBALS array to do so. The unset() function has no return value.
- Display an array as an HTML table with the index value in PHP — foreach($array as $key => $value) is useful when you need key and its value at the same time.
- Display the result of a MySQL query in an HTML table — You can obtain the results of a MySQL server query using the mysqli extension.
- Display the result of running python code by shell command (shell_exec) in PHP — I usually use shell_exec when I need to run python code. The benefit of shell_exec is returning the result as string, so I can use it for other purpose.
- Downgrade PHP from version 7.3 to 7.2 on CentOS — You can downgrade PHP from version 7.3. to 7.2 by yum and yum-config-manager.
- file_exists covers local and internet in PHP — file_exists() is useful function can check the availability of a file. Below customized function enables you to check file availability not only local but also remote file as well.
- file_get_contents() gets no content from HTTPS URL — You can resolve above issue by adding additional parameters not to check SSL certificate in file_get_contents(), s
- file_get_contents with custom User-Agent in PHP — To put custom User-Agent value with file_get_contents, you will need to create a stream_content.
- Find files in PHP — scandir( $path) returns the searched result in array. If you want to implement recursive scan for sub directories, you can implement it by checking filetype().
- Find image objects from the plain HTML text with PHP — DOMDocument object enables you to find the necessary HTML objects easily.
- Function as a part of parameter in PHP — PHP provides super easy feature can put a function as a part of function parameter. You can just put it like function exampleMethod( $customFunc).
- get_headers() with timeout — To set timeout in get_headers(), you will need to set stream_context_set_default(), so you can optimize communication cost as you designed.
- Get array keys in PHP — array_keys() return array keys in a string array
- Get Client's IP Address in PHP — I had got client's IP address by $REMOTE_ADDR or $_SERVER['REMOTE_ADDR'], but it does not work on latest version of PHP.
- Get DB field name in PHP PDO from MySQL query result — PDO provides a method to get database field name (column name) from the query result.
- Get elements in GET, POST, COOKIE, SERVER as variable — The extract() Function is an inbuilt function in PHP. The extract() function does array to variable conversion. That is it converts array keys into variable names and array values into variable value. In other words, we can say that the extract() function imports variables from an array to the symbol table.
- Get file extension in PHP — pathinfo() in PHP enables you to have file extension easily.
- Get file path in PHP — pathinfo() provides various information like dirname, basename, extension, and full filename. You can get intended result by pathinfo( $filename)['dirname']
- Get local IP Address in PHP on CentOS — The easiest way to get local IP Address in PHP on CentOS is using shell command like "hostname -I". I tried several methods to get it, but most of them returns the wrong answer.
- Hash value for a file — If you want to make a simple logic to get hash value for file, hash_file() gives you a straightforward solution.
- Heredoc widely used for SQL in PHP — Heredoc provides an alternative way of defining strings in PHP. They are particularly useful when we need to define a string over multiple lines. They work by defining an identifier that will mark the start and end of the string. The identifier can be any alphanumeric value following the same rules we’d use for variable names. One important thing to note with the identifier is that as of PHP 7.3 you need to make sure that it does not appear within the string itself.
- JSON file management in PHP — PHP provides strong solutions for JSON. json_encode($src_obj) converts obj to JSON text. json_decode($src_text) converts text string to JSON object.
- Loading a text file in PHP — PHP provides useful functions can read text file directly instead of open → read → close: readfile(), file_get_contents() - personally I prefer to use file_get_contents(), because it does not display anything after reading the content.
- MySQL combination with Heredoc in PHP — Heredoc is one of the useful solution to secure better readability when we code SQL Query in PHP
- No match for argument: php-mcrypt on CentOS 7 — mcrypt package is not included in the default CentOS repositories. It can be installed from the Remi repository.
- No match for argument: php-pecl-memcache on CentOS 7 — php-pecl-memcache package is not included in the default CentOS repositories. It can be installed from the Remi repository.
- No match for argument: php-tidy on CentOS 7 — php-tidy package is not included in the default CentOS repositories. It can be installed from the Remi repository.
- PHP_SELF — PHP_SELF is a variable that returns the current script being executed. This variable returns the name and path of the current file (from the root folder). You can use this variable in the action field of the FORM or any place when you write a code dynamically.
- PHP configuration I commonly use — In the PHP, error_reporting does not need to be detail necessarily for security purpose, and short_open_tag could cause coding error easily, but needs to be used for backward compatibility in some cases.
- PHP does not show any errors
- PHP Frameworks — There are lots of frameworks available in PHP
- PHP Server RESTful API example to get message body — When call RESTful API containing JSON data in the body, server needs to take its content, but getting it by parameters may have some restrictions like data length or etc. To avoid that error, the easiest way can do it will be taking it from entity body directly. file_get_contents('php://input') will help you to solve it easily.
- preg functions as replacement of ereg/eregi functions in PHP — In PHP 7.x, ereg functions are no longer supported. Based on my search on internet, ereg functions use a very limited regex flavor called POSIX ERE - meaning pref functions can cover more REGEX syntax as designed.
- Preparing production and staging environment in PHP project — When developing live service but requiring continuous maintenance/development in agile manner, codes needs to be handled by the operation environment (staging/production) - you may able to add development environment by your situation. In that case include_path is super useful.
- Queue implementation in PHP — To implement Queue, the easiest way can do it is using array() to store elements, and array_shift() to extract elements at the front of the Queue.
- Recognize Korean text in string in PHP
- Remote all class tags in HTML by preg_replace — Removing all class tags in HTML by preg_replace is super easy.
- Removing memory limit in PHP — One of the case you need to remove memory limit in PHP will be that your application use memory dynamically and sometimes faces out of memory. In that case, you can simply remove memory limit in your PHP application by setting memory_limit=-1 in /etc/php.ini
- Resize image with keeping aspect ratio (width x height) in PHP — The code cfolderResizeImage() will enable you to resize the source image with keeping aspect ratio in PHP.
- Restart server daemon by checking dead processes in PHP — PHP is a good language to manage remote/local server. Below code shows how to restart daemons like httpd, mysqld, Confluence and Jira by PHP.
- Run PThread in PHP for Thread Safe Application — To run thread safe application in PHP, you will need to install PThread manually, because it's not included in the common distribution.
- Run shell commands on remote server in SSH — I wanted to run a specific command through ssh protocol on my server. And this is super helpful to do some kind of remote processing by PHP easily, so I do not need to log on remote server.
- Run time consuming (background) tasks as post processing with no connection with browser client in PHP — You can flushe all response data to the client and finishes the request to run time consuming tasks with no connection with brower client by fastcgi_finish_request(). This allows for time consuming tasks to be performed without leaving the connection to the client open.
- Save a image file in PHP from a image in HTML that encoded in base64 — By copy & paste, we can embed image in the HTML that is mainly supported WYSWYG editor, but it may cause heavy loading time for the web browser. The web browser may work very well if such kind of image files are removed in the HTML. Below PHP code enables you to work more compactly.
- Saving a text file in PHP — file_put_contents($filename, $src) is useful function if you want to save a text file in PHP
- Set default timezone by date_default_timezone_set — When you want to set the default timezone used by all date/time functions, you can take one of two options: 1) put date_default_timezone_set() on your code, 2) put value in php.ini
- Simple function appending strings to a text file
- Simple PHP Web Shell — Simple & tiny PHP Web shell for executing unix commands from web page.
- Stacked bar chart for PHP
- substr( $str, $start, $length) in PHP — substr() returns part of a string
- Thread implementation in PHP — A thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically a part of the operating system. In the PHP, you can divide and conquer your planned process efficiently by Thread.
- Unicode Escape in PHP — PHP requires to implement a simple function to escape unicode. Some severs send uncode encoded string for supporting multi byte characters. Its encoded result will be something like \uBBF8\uC158 \uC774\uC2A4\uD0C4\uBD88 4: \uC775\uC2A4\uD2B8\uB9BC \uB370\uC774
- Update/Reload php.ini on MacOS to add include_path for PHP shared libraries — You can find the location for php.ini on Mac by calling php --ini
- Uploading a large sized file more than 2G — To upload a large sized file more than 2G in PHP, the OS must be based in 64bits instead of 32bits, and you should change some settings in /etc/php.ini and LimitRequestBody=0 in httpd.conf or virtualhost
- Upload multiple files serially and show its progress in real-time with XMLHttpRequest and PHP — Uploading files serially is strongly needed when uploading large files to the server, because it helps user to ensure the uploaded file is correctly delivered or not, so they can do the necessary things easily.
- Upload multi selected files with single array variable in PHP — Array in HTML5 is useful when upload files with multi selection on file management dialog. Note that you should add tag (multiple="multiple") to the "file" type element. In the PHP, you will be able to manage uploaded files easily by index.
- PostgreSQL — PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and technical standards compliance. It is designed to handle a range of workloads, from single machines to data warehouses or Web services with many concurrent users.
- Create a database in PostgreSQL
- Create read only user at PostgreSQL
- Install PostgreSQL on CentOS 7 — PostgreSQL is a part of default CentOS repositories, so yum can be used to install it.
- PostgreSQL Automated backup on CentOS — PostgreSQL provides pg_dump to backup your database in a single file easily. You can backup your database based on your schedule combined with cron job on your CentOS.
- Python — Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python's design philosophy emphasizes code readability with its notable use of significant white space.
- _tkinter.TclError: no display name and no $DISPLAY environment variable — If you face _tkinter.TclError when you run your python application based on MatPlotLib on CentOS 7, it might be caused by MatPlotLib choose Xwindows backend by default.
- Array as an HTML table with both the array key and the index value in Python
- Default module path in Python
- Django
- Easy Python Launcher based on PHP — You can run your python code easily based on your web browser if you have Apache+PHP server. Below code enable you to run your code by click
- Encode/decode JSON in Python
- Google Cloud Client Library for Python to run a query on BigQuery — You can use the Google Cloud Client Library for Python to run a query on BigQuery
- Install mysql.connector for Python on CentOS 7 — MySQL Connector/Python enables Python programs to access MySQL databases, using an API that is compliant with the Python Database API Specification v2.0 (PEP 249). It also contains an implementation of the X DevAPI, an Application Programming Interface for working with the MySQL Document Store.
- Install Pandas, NumPy and MatPlotLib on CentOS 7 — For data processing in Python, Pandas and NumPy are super useful. Before installing Pandas and NumPy, you should have pip on your CentOS 7.
- Install the Google Cloud SDK and the necessary components using yum on CentOS 7 — No, there is no official yum repository for the Google Cloud BigQuery Python module. You can install it manually using the wheel files as described in my previous answer, or you can use pip or easy_install to install it as part of the Google Cloud SDK.
- Install Tkinter on CentOS 7 — Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de facto standard GUI.
- Keys (i.e., column names) of the records in the result set — The mysql.connector module in Python provides functions for connecting to a MySQL database and executing SQL statements. When you execute a SELECT statement that retrieves records from a table, you can use the cursor object's description property to get the keys (i.e., column names) of the records in the result set.
- Python Code Snippets
- Query result from mysql in Python — You can get the result of a query using Pythong mysql-connector-python library
- Query result from postgresql db in Python — You can run your query by psycopg2 that is widely used to use Postgresql database in Python
- Sample Class in Python
- Scrape web through BeautifulSoup in Python — A type of Python library called BeautifulSoup makes it simple to manage HTML objects. The real scraping is enabled by "requests. get(url)," and BeautifulSoup makes it possible to manage elements based on html.parser.
- Set default encoding method as UTF-8 in Python — Python is basically encoding in ascii mode, so you should declare your encoding method you want to use in the code.
- Simple HLS server in Python using the Flask web framework — In this example, the Flask application has two routes: /live/<stream_id>.m3u8 and /live/<stream_id>/<int:sequence>.ts. The first route uses the ffmpeg command-line tool to convert an RTMP stream into an HLS stream, and returns the contents of the .m3u8 playlist file. The second route returns the contents of individual .ts segments.
- Useful Heredoc in Python — Heredoc is frequently used when develop web app in various platform - it can be easily used by starting """ and ending """
- QEMU — QEMU is a generic and open source machine emulator and virtualizer a.k.a. hypervisor. QEMU works like VMWare, VirtualBox and etc.
- Sample DOS Shell scripts to create/run QEMU image — In order to run QEMU Image on Windows, DOS Shell scripts are useful which helps doing the necessary things easily.
- Raspberry Pi
- Redis (Remote Dictionary Server) — Redis is an open-source in-memory data structure project implementing a distributed, in-memory key-value database with optional durability. Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, hyperloglogs, bitmaps, streams and spatial indexes.
- Redis CLI(Command Line Interface) Examples — redis-cli is a useful tool can handle Redis KEYs in the system. You can search / delete / get / clear / check its status simple on your terminal.
- Redis Installation on CentOS 7 — Redis package is not included in the default CentOS repositories. It can be installed from the Remi repository.
- Redis thread implementation in PHP without compilation on CentOS — Redis is a useful solution when design systems on server and required the minimum latency between the client and server for handling message. We can easily build a thread application if we use shell_exec based on & and wait. PHP also provides a solution named as pthreads. but unfortunately the pthreads extension cannot be used in a web server environment. Threading in PHP should therefore remain to CLI-based applications only.
- Redis with High Availability by Replication
- Uncaught RedisException: Permission denied error in your PHP code — When you face an error Uncaught RedisException: Permission denied in your PHP code, you will need to check if that is working normally in the command line but happening in the web page. If it is, that is 100% caused by your linux security policy. In that case, you will need to turn SELinux policy off that located at /etc/selinux/config.
- Ruby — Ruby is a dynamic, interpreted, reflective, object-oriented, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan. According to the creator, Ruby was influenced by Perl, Smalltalk, Eiffel, Ada, and Lisp.
- SEO (Search Engine Optimization)
- SSL — SSL means Secure Socket Layer widely used in World Wide Web. In order to support SSL on Web Server, you should purchase certificate that compatible with known commercial browsers such as internet explorer, chrome, opera and so on.
- SSO (Single Sign On) — Single sign-on, or SSO, is one of the best solutions for managing account access and mitigating the problems caused by the growing number of apps and logins.
- OAuth — OAuth is simply a secure authorization protocol that deals with the authorization of third party application to access the user data without exposing their password. eg. (Login with fb, gPlus, twitter in many websites..) all work under this protocol.
- SAML (Security Assertion Markup Language) — SAML(Security Assertion Markup Language) allows security credentials to be shared by multiple computers across a network. It describes a framework that allows one computer to perform some security functions on behalf of one or more other computers (Authentication, Authorization)
- Sublime Text — Sublime Text is a shareware cross-platform source code editor with a Python application programming interface. It natively supports many programming languages and markup languages, and functions can be added by users with plugins, typically community-built and maintained under free-software licenses.
- Set F1 key to reindent in Sublime Text — You may often need reindent your code. You can set F1 key to reindent your code by following steps:
- Using FTP/SFTP in Sublime Text — SFTP package is super useful if you want to have a development environment like Visual Studio Code. You can open the cloned remote folders on navigation pane, open, modify and sync-up with remote server easily.
- Televsion
- Tensorflow
- tmux — tmux is a terminal multiplexer for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window. It is useful for running more than one command-line program at the same time. It can also be used to detach processes from their controlling terminals, allowing SSH sessions to remain active without being visible.
- Vercel — Vercel is a cloud platform for static sites and Serverless Functions that fits based on the workflow. It enables developers to host websites and web services that deploy instantly, scale automatically, and requires no supervision, all with no configuration.
- vim — vim is a highly configurable text editor for efficiently creating and changing any kind of text. It is included as "vi" with most UNIX systems and with Apple OS X.
- Visual Studio Code
- Writing codes on remote server via SSH/SFTP by 'Remote - SSH' plugin on Visual Studio Code — When we need accessing remote server to develop software on Microsoft Visual Studio Code, 'Remote - SSH' is really useful as far as I experienced, so you can manage files remotely just like your local hard disk. One of the benefit compared to other SSH plugins is 'Remote - SSH' checks if there is any change in the file or not, so you can avoid mistake to overwrite to the latest code.
- Writing codes on remote server via SSH/SFTP by SSH FS plugin on Visual Studio Code — When we need accessing remote server to develop software on Microsoft Visual Studio Code, SSH FS is really useful as far as I experienced, so you can manage files remotely just like your local hard disk. If you are in collaborative development using GitHub or BitBucket, you should not try this method, because you may able to spoil someone's source code that you haven't aware.
- VPN
- PPTP
- pptp[3186] : anon warn[decaps_gre:pptp_gre.c:439]: discarding bogus packet — When pppd is running as installed, but sometimes pppd does not work and showing warning message - discarding bogus packet: pppd is dropping its packet intentionally, so VPN is actually not working from that time. The workaround I can do is just disconnect the VPN and reconnect.
- PPTP Command line setup on CentOS 7 — CentOS provides an PPTP solutions in the repository,
- PPTP
- WebVTT — This specification defines WebVTT, the Web Video Text Tracks format. Its main use is for marking up external text track resources in connection with the HTML <track> element. WebVTT files provide captions or subtitles for video content, and also text video descriptions, chapters for content navigation, and more generally any form of metadata that is time-aligned with audio or video content.
- WYSIWYG Editors based on the web — WYSIWYG(What You See is What You Get) Editor is one of the strong features we need to have when we want to have fancy editors like Microsoft Word, Power Point and etc. One of the popular editors available on the web will be CKEditor 5 and Tiny MCE.
- YAML — YAML is not a Markup Language. YAML is a human-readable data-serialization language. It is commonly used for configuration files and in applications where data is being stored or transmitted. YAML targets many of the same communications applications as Extensible Markup Language but has a minimal syntax which intentionally differs from SGML.
- zsh — zsh(Z Shell) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. zsh is an extended Bourne shell with man improvements, including some features of Bash, ksh and tcsh.
- Default profile scripts for zsh in Mac OSX — For my easier use in Mac OSX, I usually add below scripts at /etc/zshrc
Overview
Content Tools