Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 PROGRAMMING


  Singleton Pattern in Golang

Singleton pattern is the simplest design pattern in software design. It ensures that only one instance of an object exists globally, regardless of how many times the object is instantiated. Based on the characteristics of the singleton pattern, it can be applied to scenarios such as global unique configuration, database connection objects, file access objects, etc. In Go language, there are multiple ways to implement the singleton pattern. Today, let's learn together about some of these approaches.Eager InitializationImplementing the singleton pattern using eager initialization is very simple....

1,940 0       GOLANG SINGLETON PATTERN TUTORIAL


  What can select do in GoLang

In Go language, select is a keyword used to listen to and perform IO operations related to channels.With the select statement, we can simultaneously listen to multiple channels and perform corresponding operations when any of the channels are ready.This article will summarize the common uses of the select statement and provide some considerations when using it.Basic syntaxThe basic syntax of the select statement is as follows:select {case <-channel1: // when channel1 has data to processcase data := <-channel2: // when channel2 has data to processdefault: // if no channel has dat...

1,118 0       GOLANG SELECT USAGE SYNTAX TUTORIAL


  errGroup in GoLang explained

Today, let's talk about the usage and applicable scenarios of errGroup, which is often used. Why is it useful? Generally, when we use goroutine, we cannot return a value. If you want to pass out the result of the goroutine execution, you usually have to use the channel. The errGroup package is suitable if you want to know when the goroutine you opened encounters an error during execution and stop working, and I need to know the error value.errGroup usageThe package needs to be downloaded and installed first. go get -u golang.org/x/syncAn example of using it would bepackage mainimport ( ...

4,877 0       CONCURRENCY GOLANG ERRGROUP WAITHROUP


  Deep Understanding of ReentrantLock: Unlocking the Mysteries of Java Concurrent Programming

ReentrantLock introductionReentrantLock is a class in the Java concurrent package, java.util.concurrent.locks, and is an implementation of the Lock interface. As its name suggests, it is a reentrant mutual exclusion lock.A mutual exclusion lock is a synchronization tool used to protect shared resources, ensuring that only one thread can access the resource at a given time. Reentrant means that a thread can acquire the same lock multiple times without causing a deadlock.This lock provides some basic behaviors that are the same as those of the built-in synchronization mechanism. For example, a t...

2,853 0       MULTITHREADING CONCURRENCY REENTRANTLOCK JAVA


  Go是一门面向对象的编程语言吗

Golang已经开源了13年,在最近的TIOBE编程语言排名中,于2023年3月再次进入前十名,并比2022年底的排名上升了两个位置。Go在2022年底提高了2个排名许多第一次接触Go的开发者来自面向对象的编程语言,比如Java、Ruby等,他们在学习Go后第一个问题通常是:Go是一种面向对象的语言吗?在本文中,我们将探讨这个问题。追溯在广为人知的Go编程语言“圣经”《The Go Programming Language》中,有一个Go与其主要祖先编程语言之间的亲缘关系图表。Go与其主要祖...

1,058 0       OOP GO CHINESE GOLANG


  A Clash of Titans Between Elon Musk and Larry Page over AGI's Future

Artificial General Intelligence(AGI) has long been a topic of fascination and concern for technology leaders, with some seeing it as humanity's ultimate tool, while others view it as an existential threat. This clash of perspectives was on full display during the acquisition of DeepMind by Google in 2014, as two tech titans, Elon Musk and Larry Page, found themselves on opposite sides of the debate. While Page saw AGI as a necessary and desirable step in humanity's evolution, Musk was more wary of its potential to destroy humanity. Their differing perspectives set the stage for a fascinating c...

2,609 0       AI LARRY PAGE ELON MUSK AGI


  REST和gRPC对比全知道

长期以来,REST是构建API的唯一“标准”。它取代了混乱的“太多XML”的SOAP。但是近年来,出现了新的替代品。2015 年,Facebook 向公众发布了GraphQL,而 2016 年,Google 推出了gRPC。本文将重点介绍 gRPC,并与仍广泛使用的 REST 进行比较。概述以下表格将为您提供讨论点的概述,并显示 REST 和 gRPC 的优劣之处。主题RESTgRPC标准化没有标准定义明确范式基于资源RPC服务模式仅一元一元、客户端流、服务器流和双向流要求任何HTTP版本、JSON解析器HTTP/2...

1,359 0       COMPARISON REST GRPC


  Simplify Cloud Data Security: A Deep Dive Into Protecting Sensitive Data in Java

Featuring encryption, anonymization, hashing, and access controlNetwork security incidents occur now and then, mostly caused by data leakage. Data security has aroused widespread concern, and the community keeps working hard on approaches to simplify data security, especially in sensitive data protection.Sensitive data includes but is not limited to personally identifiable information (PII) like names, ID numbers, passport numbers, driver’s license numbers, contact information like addresses, phone numbers, account credentials like usernames, passwords, PINs, and financial information li...

868 0       TOKENIZATION DECRYPTION ENCRYPTION SECURITY JAVA