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

SEARCH KEYWORD -- Error



  A Sip of Go Log

Logging is indispensable in any code that we need its support both in debugging and in statistics. However, a package that filled withfmt.Println/fmt.Printf printing various messages can never be considered a read-to-be-adopted package, which can be optimized by a simple change, using Golang’s native log package to print information to standard output or to a file. Then, how to apply the log package? Are there any limitations? If so, can we seek open-source packages? Let&rsq...

   GOLANG,LOGGING     2022-06-16 05:43:24

  Significance and use of do{...}while(0)

In some Linux kernel and other open source codes, we can see some codes like below: do{ ... }while(0) This code snippet is not a loop, it seems there is no significance of using do...while this way, then why should we use it? In fact, the significance of do{...}while(0) is better than optimizing your code. After some research, we summarize some benefits of it. 1. Help define complex macro to avoid error #define DOSOMETHING()\ foo1();\ foo2(); The me...

   do{...}while(0), optimization     2012-10-21 21:13:22

  Understand unsafe in GoLang

Before going to understand unsafe package in GoLang, the first thing needs to talk about is the pointer in GoLang. If you have a background of C language, you must know what pointer means and its usage. With pointer, you are free to operate any data at memory level which means you have great power, but this means that you have great responsibility as well. That's why it might be considered unsafe in lots of cases. Take a look at a simple example of doubling an integer. package main import "fmt"...

   GOLANG,UNSAFE,ZERO-COPY     2020-03-14 23:18:00

  Substitute of Right Click Computer to Open Manage

I believe some of us may encounter some strange problems when we expect something normal to happen when we operate on our computer. On Windows 7, we may sometimes want to manage our service or applications by opening service manager.But somehow we may find that we cannot open it by clicking on Start->Right click on Computer->Manage.It may prompt some error message to tell us we cannot open the service manager. Then what to do? Here is a way to open it,goto Start->Run,then type "com...

   Computer Management,Win 7,compmgmt.msc,S     2011-03-31 01:09:44

  10 rules of PHP-masters

1. Use PHP only when it is necessary – Rasmus Lerdorf There is no better source than the creator of PHP, to learn what he can do. Rasmus Lerdorf created PHP in 1995. Since then, the language has spread like a wildfire rate in the developer community, incidentally changing the face of the Internet. However, Rasmus did not create PHP with these intentions. PHP was created for the needs of web development. As is the case with many other projects wi...

   PHP,Master,Experience,Advice     2011-12-16 09:38:07

  Tips for improving PHP efficiency

0. Using single quote to replace double quote to enclose string literal, this will be a bit faster. Because PHP engine will search variables in double quoted string. 1. If a method in class can be declared as static, then make it static, this will be 4 times faster. 2. $row["id"] is 7 times faster than $row[id] 3. echo is faster than print, and you should use multiple parameters instead of string concatenation, i.e use comma(,) instead of dot(.) to concatenate string. For example echo $str1,$str...

   PHP, efficiency, tips     2012-10-01 19:39:06

  Unknown system variable 'query_cache_size' in DbVisualizer while accessing MySQL

DbVisualizer is a very popular GUI application to view the data stored on a database. It supports various databases such as Oracle, MySQL etc. It relies on different database drivers to connect to the database server and access the data stored there.  In this post, we will try to solve one problem when accessing the latest MySQL database(8.0+) through DbVisualizer. MySQL database starting from 8.0 has lots of changes which may not be compatible with old version of software or libraries whic...

   MYSQL,MYSQL 8,DBVISUALIZER,QUERY_CACHE_SIZE     2018-06-30 03:48:17

  Designing Great API Docs

Writing documentation is one of those things that is dreaded by many developers. It takes a lot of effort and time to get right. And too often, people take shortcuts. This is sad, because well designed documentation is the key to getting people excited about your project, whether it's open source or a developer focused product. In fact, I argue that the most important piece of UX for a developer product isn't the homepage or the sign up process or the SDK download. It's the API documentati...

   API docs,Design API docs,Advice     2012-03-09 23:15:00

  Writing great JavaScript

I probably could have named this post something like “Writing clean, validating and portable JavaScript”, but that would be no where near as catchy. The problem with “great” is it means different things to different people. I am going to show you my idea of great which may differ from many developers views, but I hope it helps someone improve their code. So what’s the point in this, why can’t you just carry on writing JavaScript as you have been for a...

   JavaScript,Great,Clean,Tips     2012-03-24 05:18:12

  About go get and go install in Go 1.16

Go version 1.16 beta1 has been released on 18 Dec 2020, major features of Go 1.16 have been finalized with this beta release. Many people are discussing about the support of Apple M1, however, this post will not cover this topic. Instead the focus will be on go get and go install changes. There are lots of changes related to modules in Go 1.16, the details can be found in the release note. Below are some of the key highlights. GO111MODULE is on by default, if wanna keep old behavior, needs...

   GOLANG,GO 1.16,GO INSTALL     2020-12-26 00:26:58