Skip to main content

Posts

Showing posts from 2020

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 make Eggless Chocolate Cake in Home in microwave

  Ingredients: 1> 1 glass wheat floor 2> 2 tbs sooji 3> 3 tbs coca powder 4> 1 tbs baking powder 5> 0.25 tbs baking soda 6> 0.75 glass sugar 7> 2 spoon refined oil 8> 1pc leamon 9> 1 tbs vanila essence Procedure to prepare cake: I> Prepration of dry mixture 1> Sheve (chal le chalni se) Wheat floor, coca powder, baking powder, sooji and keep the mixture in dry vessel. II> Prepration of fluid: 1> Powder sugar in mixi 2> In a pot add milk, powdered sugar, refine oil and mix them well. III> Greese microwave pot with oil and kept asside IV> Mixing dry mixture and fluid, and setting it to microwave pot and keeping in microwave: 1> To the fluid pot, add dry mixture and mix them well so that there is no lumps 2> If you want mix them in Mixi Jar to form a smooth paste 3> To that paste, add vanila essence, lemon and mix well 4> Add baking soda and mix well and quickly pour mixture in microwave pot 5> Then by hammering microwave p...

Debian Server Useful Commands (Dynamic Post, updated very frequently, for notes use)

For System Restart: sudo reboot ============================================ For Using 7z: To install 7z-full: sudo apt-get update sudo apt-get install p7zip-full To add a files file to 7z archive: 7z a <7z-archive-file-name>.7z {files to be archived} e.g 7z a Apache-NetBeans-12.0-bin-windows-x64.exe.7z Apache-NetBeans-12.0-bin-windows-x64.exe ============================================== To send a running process in background in terminal Ctrl+z bg Now to bring back that process in forground fg To start a command directly in background Type command & e.g 7z a Apache-NetBeans-12.0-bin-windows-x64.exe.7z Apache-NetBeans-12.0-bin-windows-x64.exe & To view processes running in background jobs

How to do settings for Mobile Device Compatibility in Blogger / Fix Blogger Issue "Viewport not set to "device-width"

Steps: 1> Go to blogger.com (login to your account) 2> Select themes -> There in MyThemes, in click three dots 3> Click Mobile Device Settings 4> In < Do you want to show Desktop or Mobile theme on mobile devices?>,  choose Mobile Device 5> In configure Mobile View, select your appropriate Theme Category of your choice -> Then choose desired theme 6> Thats all, Your Blogger is now compatible in Mobile Devices and Your Shouldn't Get any Error Message from Google Search Console as below: Top Issues The following issues were found on your site: Viewport not set to "device-width" Text too small to read Clickable elements too close together

How to add your domain / url / blog to Google Search Engine or console

Hey, I would like to discuss how to add your domain / url / blog to Google Search Engine or console: 1> visit  https://search.google.com/ 2> verify your domain/url/blog that you are actual owner of it 3> in inpect your url box in the top centre of page, add your url, and press enter 4> then you can press <Test Live Url> button to check if URL is accessable in internet 5> you can then press <Request Indexing> link to get your URL indexed in google search engine 6> upon submittion of submitting request, your URL will be verified to exist, and queued in Google Search Engine indexing task (i.e crawl queue) which may take from sometime to somedays. 7> After your URL is indexed in Google Search Engine, more your site gets visited, more the chance that it will appare in Google Search. 8> For enhanced search you can also try paid service of Google Search

Series: My Database Concepts - JDBC vs JPA / Hibernate

Lot of times questions arise in mind that what to use pure JDBC or JPA/Hibernate. Well, if performance is compared JDBC is much faster and uses less memory than Hibernate. But if you plan to work safely, in a less error prone manner while writing Database code, you will need to you Hibernate. So, finally in my opinion, if you are confidence enough that if you can write JDBC codes properly, have good knowledge of JDBC, you should use JDBC. Also, if you think you will be able to learn SQL / JDBC properly if you don't know yet, and want to create some JAVA Database project, in this case also you can use JDBC. But if you don't want to waste too much of time in learning JDBC and writing proper codes and spend time upon testing those codes, use JPA/ Hibernate. But in this case you will need few byes of memory extra, and also performance will be downgraded by a bit in comparison with JDBC. Note: when these points are considered, following points are important to note: 1> In JDBC yo...

Draft of Java code to save NSE Historical Data in file System instead of Database, Just For TRY! Not yet tested at all

package entitity; import java.io.EOFException; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.nio.file.Files; import java.nio.file.Paths; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.HashSet; import java.util.stream.Stream; public class HD implements Serializable { public static void main(String args[]) { String csvFilePath = "D:\\nseEquityHistoricalDataCsv\\20200116\\" + "Quote-Equity-INFRATEL-EQ-14-03-2020-to-14-06-2020.csv"; String dbPath = "D:\\javaWebServers\\ApacheTomEE\\nseeq\\"; String hdTablePath = dbPath + "hd.tb", hdLogPath = dbPath + "hd.lg"; try (Stream<String> stream1 = Files.lines(Paths.get(csvFilePath)); Stream...

How to Add Free SSL Certificate from LetsEncrypt via Certbot in your Java Tomcat / Tomee website?

Assumptions: 1. You are using Linux / Debian Server 2. You are using Compute Engine 3. You are using Google Domains 4. Set $JAVA_HOME=<path to your java base directory> 5. Set $CATALINA_BASE=<path to your Tomcat / Tomee base directory> ------------------------------------------------------------------------------------- Procedure: 1. Visit site  https://certbot.eff.org/ 2. In selection option,      a) My website running on <none of the above>     b) Operating system using <as per your operating system>, <Debian 10 in my case> 3. Type command  sudo apt-get install certbot 4. Type command sudo certbot certonly --standalone 5. Your certificate will be downloaded and installed in /etc/letsencrypt folder 6. Your certificate files are as follows: /etc/letsencrypt/live/<your domain name>/cert.pem /etc/letsencrypt/live/<your domain name>/chain.pem /etc/letsencrypt/live/<your domain name>/fullchain.pem /etc/letsen...

How to Add Free SSL Certificate from ZeroSSL int your Java Tomcat / Tomee website?

Assumptions: 1. You are using Linux / Debian Server 2. You are using Compute Engine 3. You are using Google Domains ---------------------------------------------------------------------- Procedure: 1. Set $JAVA_HOME=<path to your java base directory> 2. Set $CATALINA_BASE=<path to your Tomcat / Tomee base directory> 3. Type command: $JAVA_HOME/bin/keytool -genkey -alias <server> -keyalg RSA -keysize <2048> -keystore <path to your keystore file.jks>  Note: When asked for your first and last name, give your website domain name like www.mohitkrgupta.dev 4. Type command: $JAVA_HOME/bin/keytool -certreq -alias <server> -file <csr.txt> -keystore <path to your keystore file.jks> This will generate csr.txt key file to be submitted to Certifying Authority (ZeroSSL in this case) 5. Visit ZeroSSL site and copy-pase content of csr.txt and follow processes as mentioned in website to get your SSL keys 6. Your SSL key document will be available from...

How to Add Self-Signed SSL Certificate in Java Apache Tomee / Tomcat Server and then launch your site in Compute Engine?

Assumptions: You already have Linux / Debian Compute Engine installed in your Google Cloud Plateform (GCP) with Java installed in the system. You have Downloaded and Installed your required version of Tomee / Tomcat Server and installed this in your Compute Engine You have an active external IP Address for your Compute Engine Prodecure: 1. Set $JAVA_HOME path as your java home directory. 2. Set $CATALINA_BASE path as your Tomee / Tomcat server base directory 3. Type Command in terminal:  $JAVA_HOME/bin/keytool -genkey -alias <tomcat> -keyalg RSA Enter details as asked for like password, your details, etc 4. Type Command:  sudo nano $CATALINA_BASE/conf/server.xml Add following line in your server <!-- Define an SSL Coyote HTTP/1.1 Connector on port 8443 --> <Connector            protocol="org.apache.coyote.http11.Http11NioProtocol"            port="8443" maxThreads="200"         ...