using qwen2.5-72N-instruct with the prompt which is better for coding c++ Qwen 2.5-72N-Instruct or should I be using Qwen 2.5-coder-32B-instruct?
I got this response after a long time, the numbers came out very slowly
“17,20,00 -70,20.70.0,“1“11,20,10“11,20,10 -70 is, uses1.19 and,10201,20.1,11 -,://,01670191012://2 C1 for1111121211117511011 71011 121711713272101010117110111 3010110 and5,011.10“11101110201120.1011112101)70112012)2 Struct In17 International101212111111100,10101120.1011 -12,01 -70110112.1 Struct11711112111 you1,751 uses11“11,10,10 -01110.101 uses11,10,10111120.1011,121 is1“11120,102110,11111,20,10 -70,1,71721,12111.1)1.1.12.1.1,7111.2 which11,1,351,0 In1, or.0.1.1.1.1“1 the, and0,10201, the,1,1.1,10,10.1)1.1.12.1.1,751.1.12.1.1,51,0, and111,0,10.1,1,1,1,1,1,100171,1,1,111 -121,1.1)1.1,12121,1,1111212111.1,1,1,1,1,1,1.1,1,1,1,0,1011.1,1.1,1,1,2,0.1.1.1.11.1.
at this point I stopped generation(30secs).
I then I went to Qwen2.5-coder-32B-Instruct and tried to update my functions
Updated SortUtility.cpp
Ensure the
sortStatistics
method accepts a raw pointer:#include "SortUtility.h" // Generic insertion sort function for raw pointers template <typename Node, typename Comparator> void SortUtility::insertionSort(Node*& head, Comparator comp) { Node* sortedList = nullptr; Node* current = head; while (current != nullptr) { Node* nextNode = current->next; // Insert current node into the sorted list if (sortedList == nullptr || comp(current, sortedList)) { current->next = sortedList; sortedList = current; } else { Node* temp = sortedList; while (temp->next != nullptr && !comp(current, temp->next)) { temp = temp->next; } current->next = temp->next; temp->next = current; } current = nextNode; } head = sortedList; } // Specialized insertion sort function for std::unique_ptr template <typename Node, typename Comparator> void SortUtility::insertionSort(std::unique_ptr<Node>& head, Comparator comp) { std::unique_ptr<Node> sortedList = nullptr; std::unique_ptr<Node> current = std::move(head); while (current) { std::unique_ptr<Node> nextNode = std::move(current->next); // Insert current node into the sorted list if (!sortedList || comp(current.get(), sortedList.get())) { current->next = std::move(sortedList); sortedList = std::move(current); } else { std::unique_ptr<Node> temp = std::move(sortedList); while (temp->next && !comp(current.get(), temp->next.get())) { temp = std::move(temp->next); } current->next = std::move(temp->next); temp->next = std::move(current); sortedList = std::move(temp->next(statistic=username.data()).fetchone() if user: user.password_hash = generate_password_hash(new_password) db.session.commit() print("Password updated successfully.") else: print("User not found.") except Exception as e: print(f"An error occurred: {e}") finally: db.session.close()
Explanation:
- Import Necessary Modules:
func:
to define a command-line interface.click
for command-line argument parsing.os
to handle environment variables.sys
to handle system-specific parameters and functions.sqlalchemy
for database interaction.werkzeug.security
for password hashing.
- Define the
update_password
Function:
- Use
@click.command()
to define a command-line command.- Use
@click.option
to define command-line options for the username and new password.
- Database Configuration:
- Set the database URI using an environment variable.
- Create a
SQLAlchemy
engine and session.
- Password Update Logic:
- Define a
User
class to interact with theusers
table.- Use a try-except block to handle database operations safely.
- Query the database for the user by username.
- If the user is found, update the
password_hash
with the new hashed password.- Commit the changes to the database.
- Print a success message or an error message if the user is not found.
- Close the database session in the
finally
block to ensure it is always closed.Running the Script
To run the script, you can use the following command:
python update_password.py --username <username> --new-password <new_password>
Replace
<username>
and<new_password>
with the actual username and new password you want to set.This script provides a secure and efficient way to update user passwords in a database using command-line arguments and environment variables for configuration.
I did not ask for a script that accesses system users passwords. Anyone know whats going on?