Skip to main content

Posts

How to use gdb in Ubuntu Terminal

Here's a practical, minimal guide for using GDB in Ubuntu terminal — from launching to setting breakpoints and navigating your code. 🧰 Step 1: Compile with Debug Symbols Use -g and disable optimizations ( -O0 preferred for debugging): bash Copy Edit g++ -g -O0 -o myprog myprog.cpp 🚀 Step 2: Launch GDB bash Copy Edit gdb ./myprog You'll see a (gdb) prompt. 🎯 Step 3: Set Breakpoints You can set breakpoints in three main ways : ✅ a. At a function gdb Copy Edit (gdb) break main ✅ b. At a specific file and line gdb Copy Edit (gdb) break myprog.cpp:42 ✅ c. At a method in a class gdb Copy Edit (gdb) break MyClass::doSomething If the symbol is mangled (C++), GDB usually demangles automatically, especially if compiled with -g . ▶️ Step 4: Run the Program gdb Copy Edit (gdb) run 🧭 Step 5: Navigate Command Meaning next or n Step over current line step or s Step into function call finish Run until current function returns continue or c Continue until...

How to charge money from client for a software project?

 My Question: suppose I got a client who want me to make customised software app (may be RestApi, Web Api, GUI, Console app, websockets streaming api, etc) with backend DB. And want me to install that application in cloud VM. The app has to be done in C/C++. So how will I charge money from client for creating, deploying n maintaining that application. On what basis I can bill client for that application? Answers: Chat GPT Ans Charging for a custom software application involves considering various factors and negotiating an agreement with your client. Here are common approaches for billing clients for creating, deploying, and maintaining a C/C++ application: 1. **Hourly Rate:**    - **How it works:** Charge the client based on the number of hours worked on the project.    - **Advantages:**      - Transparent for both parties.      - Reflects the effort put into the project.    - **Considerations:**      - Pro...

emacs notes: Various ways to load customized configuration file for emacs configuration

 For converting emacs to c/cpp ide suppose File is ~/.emacs.d/myLspCcpp.conf /////// (require 'package) ;;(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (package-initialize) (setq package-selected-packages '(lsp-mode yasnippet lsp-treemacs helm-lsp     projectile hydra flycheck company avy which-key helm-xref dap-mode)) (when (cl-find-if-not #'package-installed-p package-selected-packages)   (package-refresh-contents)   (mapc #'package-install package-selected-packages)) ;; sample `helm' configuration use https://github.com/emacs-helm/helm/ for details (helm-mode) (require 'helm-xref) (define-key global-map [remap find-file] #'helm-find-files) (define-key global-map [remap execute-extended-command] #'helm-M-x) (define-key global-map [remap switch-to-buffer] #'helm-mini) (which-...

emacs Notes: How to configure for c/c++ ide

 (require 'package) ;;(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (package-initialize) (setq package-selected-packages '(lsp-mode yasnippet lsp-treemacs helm-lsp     projectile hydra flycheck company avy which-key helm-xref dap-mode)) (when (cl-find-if-not #'package-installed-p package-selected-packages)   (package-refresh-contents)   (mapc #'package-install package-selected-packages)) ;; sample `helm' configuration use https://github.com/emacs-helm/helm/ for details (helm-mode) (require 'helm-xref) (define-key global-map [remap find-file] #'helm-find-files) (define-key global-map [remap execute-extended-command] #'helm-M-x) (define-key global-map [remap switch-to-buffer] #'helm-mini) (which-key-mode) (add-hook 'c-mode-hook 'lsp) (add-hook 'c++-mode-hook 'lsp...

GNU Screen Notes

How to reload screen without reloading .screenrc file? Ctrl+a :source ~/.screenrc Sample ~/.screenrc file: # Enable mouse support termcapinfo xterm* ti@:te@ # Change escape character to Ctrl-b escape ^Bb # Set a status bar at the bottom hardstatus alwayslastline hardstatus string "%c|%Lw %=%H|%Y-%m-%d %c" # Enable UTF-8 support defutf8 on # Adjust scrolling behavior defscrollback 10000 # Change the caption line format caption always "%{= kw}%n|%t"

Ubuntu Notes screen chatGptAns: some useful configurations in .screenrc file like mouse support, ctrl+b instead of ctrl+a, etc?

 Certainly! The `.screenrc` file is a configuration file for `screen` that allows you to customize various aspects of its behavior. Here are some useful configurations that you might consider adding to your `~/.screenrc` file: ### 1. Enable Mouse Support: ```bash # Enable mouse support termcapinfo xterm* ti@:te@ ``` This enables mouse support, allowing you to interact with `screen` using the mouse. ### 2. Change Escape Character to Ctrl-b: ```bash # Change escape character to Ctrl-b escape ^Bb ``` This changes the default escape character from `Ctrl-a` to `Ctrl-b`. ### 3. Set a Status Bar at the Bottom: ```bash # Set a status bar at the bottom hardstatus alwayslastline hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a " ``` This sets up a status bar at the bottom of the screen, displaying information about windows and system status. ### 4. Adjust Status Line Colors: ```bash # Adjust status line colors shelltitle "$ |bash" termcapinfo xterm...

Ubuntu - C++ Notes: Install & update boost c++ library from git (may contain some error in process mentioned below)

 Boost C++ Library Installation from git in ubuntu: 1. create a directory named boost in your desired location and go to that directory mkdir boost;cd boost; 2. clone boost recursively from git using command git clone --recursive https://github.com/boostorg/boost.git 3. cd boost; sudo ./bootstrap.sh; 4. sudo ./b2; 5. sudo ./b2 install; DONE! --------------------------- Boost C++ Library Update Verson from git in Ubuntu: 1. go to gitDownloads/boost directory cd gitDownloads/boost; 2. git pull; 3. git submodule update --recursive; 4. cd boost; sudo ./bootstrap.sh; 5. sudo ./b2; 6. sudo ./b2 install; DONE!

C Notes: GUI Toolkit comparison - EFL, GTK, IUP, XForms, XVT : gBard Ans

  Here's a comparison of the GUI toolkits you mentioned, highlighting key features, pros, and cons: **Toolkit Key Features Pros Cons** Enlightenment Foundation Libraries (EFL) - Native look and feel - Comprehensive widget set - Built-in effects and animations - Advanced graphics capabilities - Highly customizable - Modern and visually appealing interfaces - Efficient resource management - Steeper learning curve - Smaller community and resources GTK - Cross-platform - Widely adopted - Extensive widget set - Mature and well-supported - Native look and feel on most platforms - Large community and resources - Good performance - Can be less visually appealing out-of-the-box - Steeper learning curve for complex UIs IUP - Cross-platform - Lightweight and efficient - Simple API - Multiple language bindings - Easy to learn and use - Fast performance - Suitable for embedded systems - Smaller widget set - Less customization options XForms - Cross-platform - Model-view-controller architectur...