Top Bug Net
1,566 FOLLOWERS
Top Bug Net (short for Topologically Buggy Network) is a tech blog
offered by Hong (@xuhdev). It mainly discusses open source technologies,
GNU/Linux, programming in Python and C/Cpp, and programming tools such
as Emacs.
Top Bug Net
4M ago
Last updated on December 25, 2023
With GnuTLS, we can view the certificate details of a website with the following commands (replace "example.com" with the website of your interest):
gnutls-cli --print-cert example.com
In the command above, gnutls-cli --print-cert example.com prints the certificate of the website in PEM format to the standard output. Its output is then sent as the standard input to certtool --certificate-info, which prints information on the given certificate.
The output from the command above looks like the follows:
X.509 Certificate Information:
Version: 3 ..read more
Top Bug Net
3y ago
When testing Python programs, Coverage.py is often used in measuring code coverage, and enforcing 100% code coverage is regarded as a good practice:
# .coveragerc
[coverage:report]
# Enforce 100% coverage test
fail_under = 100
show_missing = True
However, if there are some lines of code that are platform dependent (i.e., they are never executed on at least one platform), code coverage tests usually fail. For example, the following code snippet would always lead to a coverage that is less than 100% on a platform other than Windows:
if os.name != 'nt':
# Do something if the OS is not Wind ..read more
Top Bug Net
3y ago
Image by Shahadat Rahman (license)
Mobile apps have emerged as a competitive alternative to websites. Although websites are still irreplaceable parts of digital presence for business brands, mobile apps have been forcing them to change. The emergence of Progressive Web Apps (PWA) showcases this shift.
In spite of this overwhelming popularity of mobile apps, many web developers still hesitate to improve their skills and extend their focus on mobile app development. What misconceptions the web developers mostly harbor regarding app development? Well, this is what we are going to explain here ..read more
Top Bug Net
3y ago
In Python, FileNotFoundError is an exception that is raised when a requested file does not exist. Many people assume that when their programs fail to open a file in read-only mode or delete a file, FileNotFoundError must be raised and they should only need to process that. For example, some people would write code similar to:
def process_file(path):
import sys
try:
f = open(path, 'r') # or os.remove(path)
except FileNotFoundError as e:
print(f"File {path} not found!", file=sys.stderr)
return
# process the file...
However, this code may actually trigg ..read more
Top Bug Net
3y ago
Image by Esi Grünhagen
For any business, while building a mobile app it is the priority to create apps for reaching their target audience with ease and optimize the app for this specific audience. But among the millions of apps that populate the Play Store and iOS App Store, perhaps only a few thousand can claim to be perfect in terms of user experience and unique value proposition: Many of the vast majority of apps that just fill up app marketplaces without contributing any substantial value is made up of less reliable architecture. Hence we are here to explain what mobile app architecture ..read more
Top Bug Net
4y ago
[Image Source]
One of the most renowned programming languages at present is Java. Furthermore, Java application development continues to be a lucrative source of income for many people who are into the tech industry. The language is used to create web platforms and web apps, designed for flexibility, which enables developers to write code that runs on any machine, whatever the platform or architecture may be. Billions of computers and mobile phones throughout the world run Java.
What is Java Casting?
Casting, a process of creating a variable as a variable to another type. Software and app d ..read more
Top Bug Net
4y ago
tl;dr: Save the following file as Makefile and change the source files to the ones that you intend.
# Makefile template for a shared library in C
# https://www.topbug.net/blog/2019/10/28/makefile-template-for-a-shared-library-in-c-with-explanations/
CC = gcc # C compiler
CFLAGS = -fPIC -Wall -Wextra -O2 -g # C flags
LDFLAGS = -shared # linking flags
RM = rm -f # rm command
TARGET_LIB = libtarget.so # target lib
SRCS = main.c src1.c src2.c # source files
OBJS = $(SRCS:.c=.o)
.PHONY: all
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CC) ${LDFLAGS} -o $@ $^
$(SRCS:.c=.d):%.d:%.c
$(CC ..read more
Top Bug Net
4y ago
A large number of C++ functions in the standard library are extended from standard C functions, such as qsort(), memcpy(), etc. Among these functions, many have overloaded their C counterparts. For example, abs() in C++ is overloaded for both integral and floating-point types, while it is only defined for int in C. These functions, however, are often unwittingly misused as global functions and produce unexpected results.
Functions in the C++ standard library are usually put in the namespace std, including those that are extended from their C counterparts. For example, the C function sqrt() co ..read more
Top Bug Net
5y ago
Machine Learning is nothing but one of the subdomains of science that deals with computers or applications that are not explicitly coded to perform the task. The combination of machine learning, cognitive technology, and AI will make a lot more smooth the processing of big chunks of data and information.
Machine Learning is an application of AI (Artificial Intelligence) which ables the machines or software to adapt, learn from itself, provided the data is resourceful and sensible. Simply saying the efforts are implying to develop expert systems.
Mainly we have three categories of machine learn ..read more