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

SEARCH KEYWORD -- debug



  How to do pprof for gRPC service

gRPC is a RPC framework based on HTTP and is frequently used for communications among micro service inside the same organization network. However,  the service functions cannot be accessed via normal HTTP URL as it's not a WEB framework. In this case, how to do pprof on a gRPC service? The trick is starting a HTTP server asynchronously while starting the gRPC service. This HTTP server can be accessed to run prrof debug. go func(){ http.ListenAndServe(":10001", nil) }() Since it uses the de...

   GOLANG,PPROF,GRPC     2021-01-29 23:11:33

  Use Delve to debug GoLang program

If you don't know how to debug program, you are not a real programmer. gdb can be used to debug go program, but according to golang website, delve is a better option.   Note that Delve is a better alternative to GDB when debugging Go programs built with the standard toolchain. It understands the Go runtime, data structures, and expressions better than GDB. Below is a simple go program. package main type Person struct { Name string Age int } func main() { var me Person me.Nam...

   GOLANG,DEBUG,DELVE     2018-11-09 23:28:43

  Fix WampServer offline issue

WampServer is a web server on Windows which provides easy to use features for PHP developers. You can easily setup a web server by installing WampSserver without much hard to understand configurations. After installing it and with a simple configuration, you just need to double click it and start all services and your server is gonna up.  If the server starts up normally, you will see a green icon which indicates the working status at the taskbar. But if you don't see the green icon shown u...

   APACHE,PHP,WAMPSERVER     2015-09-13 01:59:38

  Be careful when running knife vault command

While using Chef, one would frequently use knife commands which are used to manage resources on the Chef server. One can list all nodes, data bags, vault items and many other stuff on the Chef server. In this post, we would cover one command which may need your attention when using it -- knife vault. On Chef server, one can store data to data bags which can be accessed by registered clients. These data bags usually store the data in plain text format. In some cases, one would need to store data ...

   KNIFE VAULT,KNIFE DATA BAG,CHEF-VAULT,CHEF     2017-08-19 00:26:54

  A small trick on using console.log to print data in JavaScript

When debugging JavaScript application, one may frequently use console.log to print data so that it is easy to debug when issue occurs and also helps on understand the data flow. The common way of printing a variable would be something like.  let user = { name: "test" }; console.log(user); In this case it will print: { name: 'test' } This is OK when there is no much logging or the program is not complicated. But it becomes difficult to debug if there are lots of variables to be printed ...

   JAVASCRIPT,CONSOLE.LOG,DEBUGGING     2019-09-03 10:24:24

  An easy way to log client side information to server

JavaScript debug is a very troublesome thing in web application development. Because many web browsers will not notify you if there is any error in the JavaScript codes you write. They just silently fail and block the following codes execution. In order to debug JavaScript codes, we need a good log mechanism which will help us log the error information,, we often need to log errors in JavaScript codes to server for debug purpose in a production web application, What should we do? The first ...

   JavaScript log, Ajax,Image,Debug     2012-12-30 09:16:50

  An experience of fixing a memory-corruption bug

During the last 4 months, I was disturbed by a memory-corruption bug, and this bug will cause program crash. Until last Monday, I found the root cause and fixed it. This debug process is a difficult but memorable experience, so I will share it in this article.   My program works as a SMS Hub. When it receives a SMS, it will allocate a structure in heap memory like this: typedef struct { ...... int *a[8]; ...... } info; After processing the SMS, the program will free the m...

   c, debug, unix, solaris, multi-thread     2014-05-04 03:52:43

  PHP to output string to client terminal

It is a common task to echo messages to the user using PHP. There are lots of ways where the message can be echoed to the client terminal(browser or console window) through PHP. These includes some well know debug methods like var_dump() and var_export() etc. In this post, we will show you some other methods shared by Laruence, one of the core members of PHP development team. 1. echo First comes with the most common one : echo. $str = "Hello PHP\n"; echo $str; 2. print Then comes another c...

   TRICKS,DEBUG,OUTPUT,PHP     2015-10-01 03:16:56

  Use of log in programming

Usually, The purposes of log are for troubleshooting and displaying program running status. Good log will help us locate the error easier. Many programmers think log in programs is very simple, but it's not an easy task to write log codes to efficiently locate the error. Here we discuss about program log in three aspects: Where to log What to log Log styles to be avoided Where to log 1. When calling external functions When your program is calling some external functions which are not written b...

   Log, Programming,Debug     2012-11-28 11:42:23

  Using public key authentication in SSH

SSH is a popular cryptographic network protocol for secure network service operation. It is frequently used in remote server login. For a system administrator or software developer, SSH is frequently used to access remote servers or development servers or testing servers etc.  To login with SSH, there are different authentication mechanisms : password, public key and interactive etc. If a remote server needs to be accessed frequently, password authentication may be too troublesome as p...

   LINUX,DEBUG,SSH,PUBLIC KEY     2016-09-10 05:55:46