Skip to main content

Posts

Showing posts from July, 2025

Making vanilla web-fontend (project with lit, web component) secured (discussions with chatGpt)

Query: I wn complete seperate .css/.scss and .html template file for my webcomponent.js like in angular. But with complete security. In lit. Use any js lib like domPurify, etc. But I wan complete safety. How? ChatGPT said: Thought for 16s Totally doable. Here’s a secure Lit setup with fully separate .html + .scss files , sanitized with DOMPurify , and rendered into the Shadow DOM without sacrificing performance. Folder layout src / lib/ safe- html .js components/ app-shell .html app-shell .scss app-shell .js 1) Install deps npm i dompurify npm i -D sass Vite will compile .scss . We’ll import the compiled CSS as text and attach it via adoptedStyleSheets (fast + memory-friendly). 2) app-shell.html (pure template file) Put your Carbon UI Shell markup here (no scripts). Example stub: < cds-header aria-label = "My App" > < cds-header-name prefix = "IBM" >[Platform] </ cds-header-name > < cds-header-glo...

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...

Install gcc-15.1 form source in Ubuntu (chatGpt reply)

✅ Step-by-step: Build and Install GCC 15.1 on Ubuntu ⚠️ Estimated time : ~30–60 mins ✅ Works on Ubuntu 20.04 / 22.04 / 24.04 1. Install dependencies bash Copy Edit sudo apt update sudo apt install -y build-essential wget curl git \ libgmp-dev libmpfr-dev libmpc-dev libisl-dev \ flex bison libzstd-dev 2. Download GCC 15.1 source bash Copy Edit cd ~/Downloads wget https://ftp.gnu.org/gnu/gcc/gcc-15.1.0/gcc-15.1.0.tar.xz tar -xf gcc-15.1.0.tar.xz cd gcc-15.1.0 ./contrib/download_prerequisites This will fetch GMP, MPFR, MPC, and ISL into the source tree. 3. Create build directory bash Copy Edit mkdir ../gcc-15.1-build cd ../gcc-15.1-build 4. Configure build bash Copy Edit ../gcc-15.1.0/configure \ --prefix=/opt/gcc-15.1 \ --disable-multilib \ --enable-languages=c,c++,fortran \ --enable-bootstrap \ --enable-checking=release 5. Build (takes time) bash Copy Edit make -j$( nproc ) 6. Install bash Copy Edit sudo make install 7. Use GCC 15.1 Add it to y...