Profile Picture

gostov2 (gos)

Reputation: 0 [rate]

Joined: Mar, 2023

Last online:

Thank you


Learning everything i could




Send Message

Threads List
Possible Alts

Activity Feed

Created a new thread : Seeking Advice on Implementing Data Structures in C++ for Efficient Memory Management

Hi everyone,


I'm currently working on a project in C++ that involves handling large datasets and implementing various data structures for efficient memory management. I've encountered a few challenges in designing and implementing these data structures, and I'm hoping to seek some advice and insights from the community to help me address these challenges.


Here's the scenario: I'm tasked with developing a data processing application in C++ that involves storing and manipulating extensive datasets consisting of structured and unstructured data. To accomplish this, I've been exploring different data structures such as arrays, linked lists, trees, and maps to efficiently organize and access the data.


However, I'm facing difficulties in selecting the most appropriate data structures for handling different types of data and optimizing memory usage. Specifically, I'm unsure about the trade-offs between different data structures in terms of memory overhead, access time, and overall performance.


As an example, let's consider the implementation of a linked list in C++. Below is a snippet of the LinkedList class that I've been working on:


#include <iostream>

template <typename T>
class Node {
    T data;
    Node<T>* next;

    Node(T data) : data(data), next(nullptr) {}

template <typename T>
class LinkedList {
    Node<T>* head;
    LinkedList() : head(nullptr) {}

    // Methods for insertion, deletion, traversal, etc.

Despite my attempts to construct data structures such as linked lists, I am having trouble optimizing their performance and memory utilization for effective processing of huge datasets. I got some help from this scaler subject, but I'm still not sure about the best methods for controlling memory allocation and deallocation inside these data structures in order to avoid memory leaks and enhance overall application stability.

If anyone has expertise creating data structures in C++ for huge datasets and improving memory management, I would be grateful for any suggestions or ideas. Any advice, whether it's on choosing the correct data structures, optimizing memory utilization, or efficient memory allocation and deallocation, would be greatly appreciated.


Thank you

I hope for the help

Created a new thread : Python concerns with the For Loop and While Loop

Hello, I hope you're well. I'm now investigating the distinctions between for loops and while loops in Python, however I've come across several perplexing cases that have left me wanting clarity. Here are some bits of code that demonstrate my areas of confusion.


Snippet 1:


# Using a for loop to iterate over a list

numbers = [1, 2, 3, 4, 5]

for num in numbers:



Snippet 2:


# Using a while loop to iterate over a list

numbers = [1, 2, 3, 4, 5]

i = 0

while i < len(numbers):



    i += 1


Here are the exact issues I need help with:


1.  Snippet 1's output (using a for loop) appears basic, outputting each number in the list. However, in Snippet 2 (using a while loop), I'm getting a "IndexError: list index out of range" message. What is generating this problem, and how can I fix it while preserving the while loop structure?

2.  While considering the clarity and simplicity of these loops, I'm not sure which strategy is best for iterating over lists in Python. Are there any rules or best practices for deciding between for and while loops when working with lists?

3.  In terms of termination conditions, especially after reading this scaler article, I discovered that while loops require explicit condition changes, whereas for loops handle iterations automatically. How can I verify that my while loop finishes properly without causing an infinite loop or premature termination?

4.  Finally, I'd like to understand the instances in which each loop type thrives, particularly in Python programming environments. Could you give real-world instances or use situations where for loops or while loops are better suited for particular tasks? Your knowledge and comments would be highly welcomed as I work through these complexities and improve my grasp of Python loop techniques. Thank you for your support.



Created a new thread : Floating-Point Conversion Precision Issues



I'm working on a JavaScript project in which I need to transform texts supplied by the user to floating-point values. However, throughout the conversion, I noticed an accuracy issue that generated unexpected results.

function convertToFloat(input) {
    return parseFloat(input);

let userInput = "0.1";
let result = convertToFloat(userInput);

console.log("User input:", userInput);
console.log("Converted result:", result);

Here's an example of my code:

User input: 0.1
Converted result: 0.1

In principle, the result should be 0.1, but I'm receiving the following:


The conversion does not appear to preserve the correct floating-point representation, thus I went on the internet and read scaler article. I've heard about floating-point accuracy problems with JavaScript, but I'm not sure how to deal with them in this situation.


Could you share some best practices for dealing with accuracy issues during string-to-floating-point conversions? Your cooperation would be much appreciated.


Thank you for your time and knowledge.

Created a new thread : Javascript event handling

So, while practising, I came across a code for event handling. The code is as follows:


//This generic event handler creates an object called eventHandler
var etHandler = {};

if (document.addEventListener) {

    //eventHandler object has two methods added to it, add()and remove(),
    etHandler.add = function(element, eventType, eventFunction) {

         * The add method in each model determines whether the event type is a load event, meaning that
         *  the function needs to be executed on page load.
        if (eventType == "load") {


    };// end of eventHandler.add = function()

    etHandler.remove = function(element, eventType, eventFunction) {

        element.detachEvent("on" + eventype, eventFunction);

    }; //end of  etHandler.remove = function()

function sendAlert() {


} //end of sendAlert()

function startTimer() {

    var timerID = window.setTimeout(sendAlert,3200);

}//end of startTimer()

var mainBody = document.getElementById("mainBody");

etHandler.add(mainBody, "load", function() {



These are the questions I'd like to pose. We start with an empty object. etHandler is a variable that should be set to;. It's all right. The condition if (document.addEventListener) is then checked.

var etHandler = {

    add: function() {


    remove: function(){


Despite the fact that no event listeners were added to the document, this condition is met. Why does this condition return true? etHandler.add = function(element, eventType, eventFunction) follows. Why are we creating etHandler.add? When we built the etHandler object, it had no properties. It's an empty object. If we construct etHandler in this manner,

After that, we can write etHandler.add. The same question applies to etHandler.remove.



Created a new thread : Python abstraction abc plugin

I got some expertise writing in Java, however I am now compelled to develop in Python due to time constraints. What I'm attempting to do is create a class structure that extends from an abstract class Document down into numerous document kinds that, based on their type, would fetch different information from a database. Given that there are likely hundreds of distinct document kinds, I believe that utilising abstraction to offload as much functionality as possible further up the stack is my best option.

In Java, I would code something like this:


public abstract class Document(){
    private String dept
    private String date
    public Document(){
    public abstract String writeDescription(){

With Python, I'm not sure what my best choice is for doing anything like this. Right now, the two main options I've seen are to utilise the abc plugin. , Alternatively to utilise simple Python inheritance structures, such as this: Abstraction in Python?

Is it possible to complete my task without using the ABC plugin, or would it be necessary?

Commented to thread : reverse a string in Python

Thank you good person

Commented to thread : reverse a string in Python

You're welcome, compinche

Created a new thread : reverse a string in Python

First have a look at the code:


def reverse(x):
    output = ""
    for c in x:
        output = c + output

    return output



This function works great in Python to invert a text; I just don't understand why or how it works.


If I iterate through a string, for example, it will usually start at "H" and work its way down to "O." How come it's going backwards here?

Created a new thread : What is the output of the given Python code

I've done coding for a few months and have reached a plateau. The code below just produces a menu and executes a few shell commands, which are then shown on the screen.


Here is the code:

import os
import subprocess

#Set Globals for Workspace to 0
workspace = 0
absolute_path = 0

#Initally clear the screen

#Define Option 0 - Create a Workspace
def workspace_menu():
    print ("Enter the name of the Workspace or type 'q' or 'quit' to return to the main menu")
    print ("")
    workspace_input = input(":")
    if workspace_input in ("q", "quit"):
#Define the current working directoy (__file__)
    script_dir = os.path.dirname(__file__)
    relative_path = 'workspaces/'
    joined_path = os.path.join(script_dir, relative_path)
    if os.path.exists(workspace_input):
        print ("Directory already Exists! - Try a different name")
        input("Press any key to Return to the Main Menu")
        make_path = os.makedirs(workspace_input)
        absolute_path = joined_path + workspace_input
        global absolute_path
        absolute_path = absolute_path
        global workspace
        workspace = 1
        print ("Workspace created!"), absolute_path
        input("Press any Key to Continue")

#Define the Main Menu
def menu():
    print(" 0) Add a Workspace")
    print(" 1) System Tasks")
    print("11) Exit")

#Define System Tasks
def system_tasks():
    print(" 1) Display Local Network information")
    print(" 5) Back")
    system_tasks_answer = int(input(":"))
    if system_tasks_answer == 1:
        print("The Local Network Configuration of this OS are:")
        ifconfig =['/sbin/ifconfig'])
        dns =['cat', '/etc/resolv.conf'])
        lni_menu = input("Press any Key to Continue")
    elif system_tasks_answer == 5:


while loop:
    print (menu())
    mm_answer = int(input(":"))
    if mm_answer ==0:
    elif mm_answer ==1:
    elif mm_answer ==11:
        input("You did not give a valid answer, press any key to try again") 

I'd want to transfer the result of menu 1 options to a "workspace." A workspace is a user-inputted directory in which when a shell command is performed, it saves the standard input as a file to the directory specified in this guide. I'll be running over 50 distinct commands at some point, and I'd like them all to be properly saved in their respective folders. Python 3.4 is currently in use.


So far, my code can ask for user input for a workspace, which results in the creation of a relative directory. What I need is for a file to be generated.


Any advice would be much appreciated.

Replied to thread : Polymorphism In C++

@luxiferrwoo, Oh okay Got it 

By saying polymorphism at all levels i mean universal polymorphism and about that i read that the templates resemble universal polymorphism on the surface but are fundamentally different. These are essentially glorified macros with minimal to no type checking (like with macros, both checking and code generation happens after expansion).

Thank you for your reply man

Created a new thread : Polymorphism In C++

I'm doing research on type systems. For this project, I'm looking at how Variants, structural subtyping, universal polymorphism, and existential polymorphism are used in popular languages. Such functions are provided by functional languages such as heskell and ocaml. But I'm curious if a popular language like C++ has the above capability. That is, how C++ is implemented.




subtyping of structural elements


polymorphism at all levels


Existential polymorphism is a type of polymorphism.

Replied to thread : rock paper scissor

bro literally God level codes 

Replied to thread : DLL Address

You may use a programme like Process Explorer or Cheat Engine to determine a process's DLL address. The following are the procedures to obtain the DLL address using Process Explorer:


Install and launch Process Explorer.

Choose the process for which you want the DLL address.

Choose "Lower Pane View" and then "DLLs" from the "View" menu.

Search for the DLL that interests you and take note of its base address.

You may use the DLL base address in your DLL injector to load your DLL into the target process once you have it.

The particular procedure for injecting the DLL will vary depending on the injector. Some injectors need you to enter the process ID and DLL path, however others may include a graphical user interface that allows you to pick the process and DLL file.