/r/programminghelp
This is a place where you can get help with programming related issues, without judgement.
Ask your embarrassing/noobish programming questions here, and don't get insulted for it.
Violating any will result in punishment so you should probably go check them out.
/r/programminghelp
website: http://muddum.cz/
It is blacklisted by Avast and shows up as malicious in linkchecker
I would like to know what exactly it contains that is malicious, as I went on it on an older different computer without a security app running.
Thank you.
Hi everyone,
We're hosting a Beerpong Tournament and I need some help creating a program to manage the group stage. Here's how it should work:
- Participants: 37 players.
- Rounds: 3 rounds with 6 games each.
- Team Formation: Players are randomised into teams of 3 every round, with one team of 4 to account for the odd number.
- Gameplay: Teams face off against another random team. The first team to hit 10 cups wins the game.
- Rules:
- Every player must participate in exactly one game per round.
- Players on the winning team receive 3 points, Losing teams get 0 points.
- Rankings are sorted by total points. In case of a tie in the table, the tiebreaker is the difference between cups hit and cups hit against.
I’d really appreciate any tips or advice on how to approach building this program. If you have experience with similar setups or know of tools/libraries that could help, please share!
Thanks in advance for your help!
So, I have spent the whole pass two days trying to figure out why my output is not matching some of the expected output. It is suppose to use command line arguments to preform a transformation from CSV file to TXT(Tabular) file. It is printing some of the commas and tabs but it is still iffy. Is anyone able to run it in a linux system? Thanks
format_converter.c
# Compiler and Flags
CC = gcc
CFLAGS = -Wall -Wextra -I. -std=c99
# Target
TARGET = format_converter
# Source and Object Files
SRCS = format_converter.c
OBJS = $(SRCS:.c=.o)
# Build Target
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(CFLAGS)
# Rule to build object files
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
# Clean up
clean:
rm -f $(OBJS) $(TARGET)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define MAX_ROWS 100
#define MAX_COLS 100
#define MAX_CELL_LEN 100
typedef enum { CSV, TXT } Format;
void parse_arguments(int argc, char *argv[], Format *input_format, Format *output_format,
int *scientific_flag, int *hex_flag, int *truncate_flag, int *trim_flag) {
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-i") == 0) {
if (strcmp(argv[++i], "csv") == 0) {
*input_format = CSV;
} else if (strcmp(argv[i], "txt") == 0) {
*input_format = TXT;
}
} else if (strcmp(argv[i], "-o") == 0) {
if (strcmp(argv[++i], "csv") == 0) {
*output_format = CSV;
} else if (strcmp(argv[i], "txt") == 0) {
*output_format = TXT;
}
} else if (strcmp(argv[i], "-e") == 0) {
*scientific_flag = 1;
} else if (strcmp(argv[i], "-x") == 0) {
*hex_flag = 1;
} else if (strcmp(argv[i], "-s") == 0) {
*truncate_flag = 1;
} else if (strcmp(argv[i], "-c") == 0) {
*trim_flag = 1;
}
}
}
void read_input(Format input_format, char data[MAX_ROWS][MAX_COLS][MAX_CELL_LEN], int *num_rows, int *num_cols) {
char line[MAX_CELL_LEN];
*num_rows = 0;
*num_cols = 0;
while (fgets(line, sizeof(line), stdin)) {
char *token = strtok(line, (input_format == CSV) ? ",\n" : "\t\n");
int cols = 0;
while (token != NULL) {
printf("token: %s\n", token);
strncpy(data[*num_rows][cols], token, MAX_CELL_LEN);
printf("data[%d][%d]: %s\n", *num_rows,cols, data[*num_rows][cols]);
(cols)++;
token = strtok(NULL, (input_format == CSV) ? ",\n" : "\t\n");
}
if(cols > *num_cols)
{
*num_cols = cols;
}
(*num_rows)++;
}
}
void apply_transformations(char data[MAX_ROWS][MAX_COLS][MAX_CELL_LEN], int num_rows, int num_cols,
int scientific_flag, int hex_flag, int truncate_flag, int trim_flag) {
for (int i = 0; i < num_rows; i++) {
for (int j = 0; j < num_cols; j++) {
char *cell = data[i][j];
// Trim leading and trailing spaces
if (trim_flag) {
char *start = cell;
while (isspace((unsigned char)*start)) start++;
char *end = cell + strlen(cell) - 1;
while (end > start && isspace((unsigned char)*end)) end--;
*(end + 1) = '\0';
memmove(cell, start, strlen(start) + 1);
}
// Apply scientific notation for numeric cells
if (scientific_flag) {
char *endptr;
double num = strtod(cell, &endptr);
if (cell != endptr) { // Valid number
snprintf(cell, MAX_CELL_LEN, "%.3e", num);
}
}
// Apply hexadecimal conversion for integers
if (hex_flag) {
char *endptr;
long num = strtol(cell, &endptr, 10);
if (cell != endptr) { // Valid integer
snprintf(cell, MAX_CELL_LEN, "%lx", num);
}
}
// Apply truncation to 5 characters for non-numeric strings
if (truncate_flag) {
char *endptr;
strtod(cell, &endptr);
if (*endptr != '\0') { // Not a number
cell[5] = '\0';
}
}
}
}
}
void print_output(Format output_format, char data[MAX_ROWS][MAX_COLS][MAX_CELL_LEN], int num_rows, int num_cols) {
for (int i = 0; i < num_rows; i++) {
for (int j = 0; j < num_cols; j++) {
if (j > 0) {
printf("%s", (output_format == CSV) ? "," : "\t");
}
printf("%s", data[i][j]);
}
printf("\n");
}
}
int main(int argc, char *argv[]) {
Format input_format = TXT;
Format output_format = CSV;
int scientific_flag = 0, hex_flag = 0, truncate_flag = 0, trim_flag = 0;
char data[MAX_ROWS][MAX_COLS][MAX_CELL_LEN];
int num_rows = 0, num_cols = 0;
// Parse command-line arguments
parse_arguments(argc, argv, &input_format, &output_format, &scientific_flag, &hex_flag, &truncate_flag, &trim_flag);
// Read input data
read_input(input_format, data, &num_rows, &num_cols);
// Apply transformations based on flags
apply_transformations(data, num_rows, num_cols, scientific_flag, hex_flag, truncate_flag, trim_flag);
// Print output in the specified format
print_output(output_format, data, num_rows, num_cols);
return 0;
}
Makefile
# Compiler and Flags
CC = gcc
CFLAGS = -Wall -Wextra -I. -std=c99
# Target
TARGET = format_converter
# Source and Object Files
SRCS = format_converter.c
OBJS = $(SRCS:.c=.o)
# Build Target
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(CFLAGS)
# Rule to build object files
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
# Clean up
clean:
rm -f $(OBJS) $(TARGET)
in.txt
12 -12.3 Hello World!
Sentence
23. -23
The payment gateway provider has a wordpress plugin but it does not have all the gateway functions built in and also they have a seperate portal made available to merchants to get following data;
Merchant ID : API Key : Merchant Secret Key : Confirmation Endpoint Endpoint
Private key
Download Server Public key
Download Public key
Download
Their most uptodate plugin can be downloaded here; https://www.npmjs.com/package/directpay-ipg-js
IPG User Wise Card Management API Documentation and
IPG Integration Payment Link V1.0.1 Integration document
see both files here https://gofile.io/d/AGc8Gn
I need support to help setup all this on wordpress explain steps need to setup as If I know nothing about JS, HTML, CSS or APIs
Installed plugin provided by them and researched all options inside their merchant portal but those functions provided by sdk seem to have no GUI to be easily accessed and edited
I'm not sure where to post this so posting this here, I am writing a dissertation on procedural generation but can't seem to find any source that says how efficient the square diamond algorithm is. Any help is greatly appreciated even if its just directing me to another sub.
I’m in the process of creating my first Java project for my portfolio, which I plan to use during job interviews. However, I’m feeling a bit lost. Since Java is primarily a backend language, I’m concerned about how to showcase my project in a way that’s attractive and engaging for interviewers.
If I create a purely backend project, there’s no direct interaction or visual component, so I’m wondering how interviewers would assess my work. Should I include a frontend as well to make it easier for them to see my skills in action? Or is it enough to focus solely on the backend and explain the functionality during the interview?
I’d really appreciate any advice on how to approach this and what would be considered best practice for a portfolio project.
I have a set of LEDs that I'm trying to iterate to create a fade-in effect. The colors values that they go through are stored in an array. The issue is that the formula to pick the correct color is not working. This is the code I got:
for led in range(self.end[strip] - self.start[strip]):
self.leds[self.led_strip[strip]][self.start[strip] + led] = intermediate_colors[int(len(intermediate_colors) / (self.end[strip] - self.start[strip]) * (abs(led - position) % int((self.end[strip] - self.start[strip]) / 2) + 1) - 1)]
position = (position + 1) % (self.end[strip] - self.start[strip])
So I've written a code for a program that analizes your screen and singlas you if you receive a predatory message and now I don't know how to publish it since it doesn't work under . exe
import * as SQLite from 'expo-sqlite';
const db = SQLite.openDatabase('accounts.db');
export const createTable = () => {
db.transaction(tx => {
tx.executeSql(
'CREATE TABLE IF NOT EXISTS accounts (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, type TEXT, address TEXT, status TEXT, meter_no TEXT, area_id TEXT, meter_size TEXT);'
);
});
};
export const insertAccount = (account) => {
db.transaction(tx => {
tx.executeSql(
'INSERT INTO accounts (name, type, address, status, meter_no, area_id, meter_size) VALUES (?, ?, ?, ?, ?, ?, ?);',
[account.name, account.type, account.address, account.status, account.meter_no, account.area_id, account.meter_size]
);
});
};
export const fetchAccounts = (callback) => {
db.transaction(tx => {
tx.executeSql(
'SELECT * FROM accounts;',
[],
(_, { rows: { _array } }) => {
callback(_array);
}
);
});
};
I could use some guidance....I want to be able to pull information from websites....for example: I want a list, with prices, of every product my local Kroger sells, preferably with real-time updates such as current sales prices...
would I use an API for that? if so, is that the easiest/only way?
I'm attempting to create a simple node canvas system using ImGUI.NET loosely based on https://github.com/thedmd/imgui-node-editor/blob/master/imgui_canvas.cpp.
This works by grabbing all of the commands and vertices added by ImGUI in between calls to Canvas.Begin()
and Canvas.End()
and transforming them from the local space of the canvas into screen space. This essentially means that within the block between Canvas.Begin()
and Canvas.End()
, all screen positions are effectively positions within the canvas.
The issue is that for some reason, if I set the elements to render at (0, 0), they refuse to render unless the parent window's y coordinate is negative, and there's also some strange masking behaviour going on as well.
I'm demonstrating it in this video: https://files.catbox.moe/uxex96.mp4
Please find my code below:
private Vector2 _widgetPos;
private Vector2 _widgetSize;
private ImDrawListPtr _drawList;
private Vector2 _offset;
private float _scale = 1f;
private int _vtxBufferStart;
private int _cmdBufferStart;
private const float GridStep = 64f;
public void Begin()
{
_widgetPos = ImGui.GetCursorScreenPos();
_widgetSize = ImGui.GetContentRegionAvail();
_drawList = ImGui.GetWindowDrawList();
// Draw Grid (Grid jumps a bit when scaling - TODO: fix this)
var localMin = WidgetToLocal(Vector2.Zero);
var localMax = WidgetToLocal(_widgetSize);
var gridColour = ImGui.ColorConvertFloat4ToU32(new Vector4(220, 220, 220, 50) / 255);
for (float x = localMin.X % GridStep; x < localMax.X - localMin.X; x += GridStep)
_drawList.AddLine(LocalToScreen(new Vector2(localMax.X - x, localMin.Y)),
LocalToScreen(new Vector2(localMax.X - x, localMax.Y)), gridColour);
for (float y = localMin.Y % GridStep; y < localMax.Y - localMin.Y; y += GridStep)
_drawList.AddLine(LocalToScreen(new Vector2(localMin.X, localMax.Y - y)),
LocalToScreen(new Vector2(localMax.X, localMax.Y - y)), gridColour);
// Clip to control
_drawList.PushClipRect(ScreenToLocal(_widgetPos), ScreenToLocal(_widgetPos + _widgetSize), false);
// Any UI drawn past this point will be in canvas space
_vtxBufferStart = _drawList.VtxBuffer.Size;
_cmdBufferStart = _drawList.CmdBuffer.Size;
// Start Drawing from (0, 0) in the canvas
ImGui.SetCursorScreenPos(Vector2.Zero);
}
public Vector2 ScreenToLocal(Vector2 screen) => WidgetToLocal(screen - _widgetPos);
public Vector2 LocalToScreen(Vector2 local) => LocalToWidget(local) + _widgetPos;
public Vector2 LocalToWidget(Vector2 local) => (local + _offset) * _scale;
public Vector2 WidgetToLocal(Vector2 widget) => widget / _scale - _offset;
public void End()
{
// Any UI drawn past this point is in screen space
var vtxBufferEnd = _drawList.VtxBuffer.Size;
var cmdBufferEnd = _drawList.CmdBuffer.Size;
for (int idx = _vtxBufferStart; idx < vtxBufferEnd; idx++) // Update vertices
{
var vtx = _drawList.VtxBuffer[idx];
vtx.pos = LocalToScreen(vtx.pos);
}
for (int idx = _cmdBufferStart; idx < cmdBufferEnd; idx++) // Update clipping
{
var cmd = _drawList.CmdBuffer[idx];
var (min, max) = Util.SplitVector4(cmd.ClipRect);
cmd.ClipRect = Util.MergeVector2s(LocalToScreen(min), LocalToScreen(max));
}
_drawList.PopClipRect(); // We are done with clipping now
// Zooming
var io = ImGui.GetIO();
_scale += io.MouseWheel * _scale * 0.1f;
// Draw Invisible Button to capture click and focus events
ImGui.SetCursorScreenPos(_widgetPos);
ImGui.InvisibleButton("Canvas", _widgetSize);
bool isHovered = ImGui.IsItemHovered();
bool isClicked = ImGui.IsItemActive();
if (isClicked)
{
_offset += WidgetToLocal(io.MousePos) - WidgetToLocal(io.MousePosPrev);
}
}
The canvas is then used as follows:
ImGui.Begin("StoryGraph", ref _open);
_canvas.Begin();
ImGui.Button("Example Button!");
_canvas.End();
ImGui.End();
I'm fairly sure the issue isn't with my clipping rect's bounds. I've tried the following to diagnose that and none of them have worked:
Remove all clipping code
Make clipping mask the size of the entire screen
Make clipping mask from (-9999, -9999) to (9999, 9999)
Keep clipping mask in screen space coordinates at all times
None of them have made a difference to the main issue of elements just disappearing. Drawing the button in the position it would ordinarily appear (ImGui.SetCursorScreenPos(_widgetPos) instead of ImGui.SetCursorScreenPos(Vector2.Zero)) makes the button appear, but then the positioning is incorrect, as the canvas transformation is then applied on top of the already screen-space position.
I would also be happy to take an alternative solution for a canvas in ImGUI, provided I can zoom and pan around an infinite canvas that I can draw normal ImGUI elements on to (with capability for mouse events).
Hi everyone, im currently working on a school project but i ran into a problem. Right now in class im learning about pillow and images, so this is very new to me. Basically my prof has a picture and im supposed to take that picture and work on it. But when i saved it down onto my mac and trying to display the image it kept saying “ PIL.Image has no attribute open” I really don’t know what this means even though i have correctly installed pillow so please help!
Thank you!
I'm teaching myself how to code by building a fun little "time tracker" project for tracking the time I spend with the girl I'm dating (just simp things, I know).
Currently, I'm using localStorage which has been fine for when I want to look at this program and see our little date time entries. But if/when I send it to my girl, she won't see the entries since it's only being stored on my own browser/IP.
https://github.com/nicolegallo/tori-time-tracker
https://nicolegallo.github.io/tori-time-tracker/
I'm assuming I'll need to look into some sort of database storage or "log" system? Any guidance or help or feedback would be appreciated!
I thought of an interesting project. It is simply a webpage that prompts the user for a title (which is made into the title of the webpage), the URL of an icon (which is made into the icon of the webpage), and the URL of an external website which is loaded into my webpage. This might get confusing, so for now on, "my webpage" is the page I plan on coding, and "the external website" is the external website which is loaded into my webpage.
Here's what I want it to do:
But why? To access sites that have been blocked by an employer's network (or any similar situation). Since your computer isn't loading anything from any blocked websites (my web server is), there would hopefully be no problems. Of course, they could just block my website too, but I will figure that out later.
My first idea was to just use an iframe, but then of course I ran into CSP and CORS protection issues, and the external web servers refused to connect. I probably wouldn't have been able to get the JS, CSS, and whatnot of the external webpage with an iframe anyway, but I am not sure.
However this is made, it is probably going to be complicated and take a long time. I haven't started making this with PHP yet, and I don't know how I will get the external website to request any files it needs from its own web server before everything gets passed to my webpage.
Any ideas or help?
Hello, I am working on a program where we use recursion in C++ to make Turtle art that stems from rectangles specifically. I have the basic algorithm down, but it keeps drawing the rectangles in a specific direction. I want to customize the program(since it's supposed to be a creative assignment), and I know I can use getRandom to do so. However, I am struggling with the syntax of where to add getRandom. Here is my code and what I've tried so far:
#include "CTurtle.hpp" //This brings in the CTurtle library for use
#include <iostream> //for input & output
#include <random> //needed for Getrandom
#include <chrono> //needed for Getrandom's seed
namespace ct = cturtle; //This makes it possible to use the CTurtle commands using ct::
using namespace std;
class Getrandom {
/\*\* Uses <random> and <chrono> from C++11 to return a random integer in range \[1..size\] \*/
public:
Getrandom(int size) {
auto seed = chrono::system\_clock::now().time\_since\_epoch().count(); //gets a new seed for the randomness
default\_random\_engine generator(seed); //seeds our randomness
uniform\_int\_distribution<int> intdist(1, size); //a distibution to make each in-range integer equally likely
self\_rand\_int\_ = intdist(generator); //generates the randme number
}
int roll() {
return self\_rand\_int\_;
}
private:
int self\_rand\_int\_;
};
//void draw_triangle(ct::Point a, ct::Point b, ct::Point c, ct::Color color, ct::Turtle& myTurtle){
// myTurtle.fillcolor(color);
// myTurtle.penup();
// myTurtle.goTo(a.x, a.y);
// myTurtle.pendown();
// myTurtle.begin_fill();
// myTurtle.goTo(c.x, c.y);
// myTurtle.goTo(b.x, b.y);
// myTurtle.goTo(a.x, a.y);
// myTurtle.end_fill();
//}
void draw_rectangle(ct::Point a, ct::Point b, ct::Point c, ct::Point d, ct::Color color, ct::Turtle& myTurtle) {
myTurtle.fillcolor(color);
myTurtle.penup();
myTurtle.goTo(a.x, a.y);
myTurtle.pendown();
myTurtle.begin_fill();
myTurtle.goTo(b.x, b.y);
myTurtle.goTo(c.x, c.y);
myTurtle.goTo(d.x, d.y);
myTurtle.goTo(a.x, a.y);
myTurtle.end_fill();
}
//getMid already defined as "middle" function in C-Turtle namespace :)
void sierpinski(ct::Point a, ct::Point b, ct::Point c, ct::Point d, int degree, ct::Turtle& myTurtle) {
const std::string colormap[] = { "light blue", "purple", "light green", "white", "yellow", "violet", "orange" };
draw_rectangle(a, b, c, d, colormap[degree], myTurtle);
// Calculate the midpoints
ct::Point ab_mid = ct::middle(a, b);
ct::Point bc_mid = ct::middle(b, c);
ct::Point cd_mid = ct::middle(c, d);
ct::Point da_mid = ct::middle(d, a);
ct::Point center = ct::middle(ab_mid, cd_mid);
// Recursively draw smaller rectangles
sierpinski(a, ab_mid, center, da_mid, degree - 1, myTurtle); // top-left
sierpinski(ab_mid, b, bc_mid, center, degree - 1, myTurtle); // top-right
sierpinski(center, bc_mid, c, cd_mid, degree - 1, myTurtle); // bottom-right
sierpinski(da_mid, center, cd_mid, d, degree - 1, myTurtle); // bottom-left
sierpinski(getRandom, degree - 1, my Turtle); // draws next rectangle from random points
}
int main() {
ct::TurtleScreen scr; //makes screen
ct::Turtle rt(scr); //makes Turtle
ct::Turtle myTurtle(scr); //makes second Turtle
int hwidth = 750; // actual screen width is 800
int vheight = 550; // actual screen height is 600
myTurtle.penup();
myTurtle.goTo(-1*hwidth/2, vheight/2); // upper left
myTurtle.pendown();
for (int i = 0; i < 2; i++) {
myTurtle.forward(hwidth);
myTurtle.right(90);
myTurtle.forward(vheight);
myTurtle.right(90);
}
myTurtle.hideturtle();
Getrandom newrandom(5);
//graphing commands go below here
ct::Point myPoints[] = { {-300, -200}, {-300, 100}, {300, 100}, {300,-200 }, {-200,-100} };
sierpinski(myPoints[0], myPoints[1], myPoints[2], myPoints[3], newrandom.roll(), rt);
scr.exitonclick(); //exists graphics screen
return 0;
}
I've created a site for a agency I also created but I can't publish it since I don't know how. I have a 0€ budget and no fiscal servers so how do I do it?
This might be a stupid question but I just want to make sure. I have a main.php file and a functions.php file that it uses (include). When creating a cron job to execute my php scripts hourly, do I also need to include the functions it uses?
how would the binary search tree look like if the values are entered in this order, “pink lime, white, black brown magenta, red, green blue, yellow orange, purple, indigo”? also what would the output look like if I print them using in order pre-order and post order?
HI, I would like to ask for your ideas/suggestions in creating a Java Console Program which purpose aligns with the Sustainable Development Goal (SDG). Thanks!
First of all, I'm mexican so yeah, it's harder to help me because of the language barrier, so if any of you know a better place where I could ask for assistance it would help me a lot. Secondly, if you know how to use Karel please help me, i thought there would be a sub Reddit for it but it doesn't exist soo yeah. And third of all, the problem is: basically, I want Karel to stop at a group of 3 beepers, but I don't know how he could keep track of which group of beepers contains which cantity. How could he know, I thought using pickbeeper and putbeeper but the problem is worse when it's a group of beepers lower than 3. I also searched for a solution and nothing. I even wanted to use succ and pred and iszero but nothing. Please help me (by the way I put java because it's the language I use in Karel, not Pascal). If you want to see my horrible code until now you can send me a message (please?).
I'm experiencing issues with pushing/publishing my new branch to a GitHub repository using Git.
Edit: I'm discovering that I'm getting this issue with all of my branches in this repo. I've also tested other repositories and they are pushing changes as they should.
Despite increasing the http.postBuffer value to 1 GB, I'm still getting the following error message:
PS C:\path\ git push --set-upstream origin working_branch_app --verbose
Pushing to https://github.com/Skymero/WoundSize.git
Enumerating objects: 44290, done.
Counting objects: 100% (44290/44290), done.
Delta compression using up to 16 threads
Compressing objects: 100% (35065/35065), done.
Writing objects: 100% (44276/44276), 701.84 MiB | 124.79 MiB/s, done.
Total 44276 (delta 9221), reused 38538 (delta 7978), pack-reused 0 (from 0)
POST git-receive-pack (735935268 bytes)
error: RPC failed; curl 55 Send failure: Connection was reset
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date
I've tried troubleshooting the issue by checking the GitHub status page, my network connection, and using a different internet service provider, but the issue persists. I've attempted the following commands based on a few other posts regarding this issue and other.
2 git push --set-upstream origin working_branch_app
3 git push origin main^8:main
4 git config --global core.compression 0
5 git push --set-upstream origin working_branch_app
6 git config --global http.postBuffer 157286400
7 git push --set-upstream origin working_branch_app
8 git config http.postBuffer 524288000
9 git push --set-upstream origin working_branch_app -f
10 git remote add origin git@github.com:Skymero/WoundSize.git
11 git remote add origin https://github.com/Skymero/WoundSize.git
12 git remote -v
13 git fetch
14 git push
15 git push --set-upstream origin working_branch_app
16 git remote remove origin
17 git remote add origin https://github.com/Skymero/WoundSize.git
18 git push --set-upstream origin main
19 git push --set-upstream origin working_branch_app
20 git init
21 git push --set-upstream origin working_branch_app
22 git config http.postBuffer 2147483648
23 git push --set-upstream origin working_branch_app
24 git add --all
25 git commit -m "temp commit"
26 git push
27 git help config
28 Get-History
29 git --version
30 git config --global --reset
31 git config --global --unset-all
32 git config --global --unset
33 git config --global -l
34 git config --global --unset http.postBuffer
35 git push --set-upstream origin working_branch_app
36 git ls-remote origin
37 git fetch
38 git fetch origin
39 git log origin/working_branch_app
40 git push --set-upstream origin working_branch_app --verbose
41 git config --global http.postBuffer 1048576000
42 git push --set-upstream origin working_branch_app --verbose
I'm using Git version 2.34.1 on Windows 11 and Python version 3.10.11.
I've also tried pushing the changes using the --verbose flag, but it doesn't provide any additional information that would help diagnose the issue.
Stackoverflow posts that seemed the most useful for this issue:
What I thought was my solution:
Adjusted Git's Pack and Buffer settings:
git config --global pack.windowMemory "100m"
git config --global pack.packSizeLimit "100m"
git config --global pack.threads "1"
git config --global http.postBuffer 209715200 # 200 MB
Then realized there was no SSH key setup for some reason and generated a new one.
Test-Path ~/.ssh/id_rsa.pub
ssh-keygen -t rsa -b 4096 -C "my.email@gmail.com"
Ensured that the ssh agent was running and then added the private ssh key to the agent:
Start-Service ssh-agent
ssh-add ~/.ssh/id_rsa
tested connection:
ssh -T git@github.com
Finally I tried another push attempt but I get the following error:
PS C:\Users\USER\WoundSize\WoundSize> git push origin main --force
Enumerating objects: 46274, done.
Counting objects: 100% (46274/46274), done.
Compressing objects: 100% (37861/37861), done.
Writing objects: 100% (46274/46274), 871.98 MiB | 9.33 MiB/s, done.
Total 46274 (delta 10659), reused 38766 (delta 7161), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (10659/10659), done.
remote: warning: File .venv/Lib/site-packages/cv2/cv2.pyd is 71.00 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File efficientnetb3_deepskin_semantic.zip is 73.94 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File checkpoints/efficientnetb3_deepskin_semantic.h5 is 80.71 MB; this is larger than GitHub's recommended maximum file size of 50.00 M
remote: warning: File .venv/Lib/site-packages/clang/native/libclang.dll is 80.10 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: Trace: b881d3427e8c252783de34646ff6dc1637854a7dc76f497bebbb38bb8e2bebc3
remote: error: See https://gh.io/lfs for more information.
remote: error: File .venv/Lib/site-packages/tensorflow/python/_pywrap_tensorflow_internal.pyd is 943.41 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To github.com:Skymero/WoundSize.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'github.com:Skymero/WoundSize.git'
Ended up solving this error only to find another. For this error, I tried way too many things with no results. In the end I ended up deleting everything from my PC and cloning the repo again since I didn't have any major changes to add.
Unfortunately this just using a new clone did not really solve the issue (surprise surprise -_-).
After fixing the issue, I generated a new venv and installed some packages I needed, but then I get the following error which is weird to me considering that I've installed these packages before and I've never had these issues. It's obvious that it's talking about not letting it go through due to large files, but again, I've installed these same packages in other projects without issues, and I double checked by testing those other projects and everything worked fine. At this point I'm stuck. I added the files it complains about to my .gitignore file but they are not being gitignored.
(.myenv) PS C:\Users\USER\WoundSize> git push
Enumerating objects: 13253, done.
Counting objects: 100% (13253/13253), done.
Compressing objects: 100% (9613/9613), done.
Writing objects: 100% (13251/13251), 1.22 GiB | 8.44 MiB/s, done.
Total 13251 (delta 3231), reused 12484 (delta 2639), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (3231/3231), completed with 1 local object.
remote: warning: File .myenv/Lib/site-packages/clang/native/libclang.dll is 80.10 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: Trace: cbf74495c52182f70af15700a2dbd684700dbe102111ea690952805ba3263cd9
remote: error: See https://gh.io/lfs for more information.
remote: error: File .myenv/Lib/site-packages/tensorflow/python/_pywrap_tensorflow_internal.pyd is 868.21 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To github.com:Skymero/WoundSize.git
! [remote rejected] globalmed_branch -> globalmed_branch (pre-receive hook declined)
error: failed to push some refs to 'github.com:Skymero/WoundSize.git'
Here is a list of all of the packages I'm trying to install:
absl-py==2.1.0
alabaster==0.7.16
asttokens==2.4.1
astunparse==1.6.3
attrs==24.2.0
babel==2.16.0
beautifulsoup4==4.12.3
bleach==6.1.0
certifi==2024.8.30
charset-normalizer==3.3.2
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cycler==0.12.1
debugpy==1.8.6
decorator==5.1.1
defusedxml==0.7.1
docutils==0.20.1
exceptiongroup==1.2.2
executing==2.1.0
fastjsonschema==2.20.0
filelock==3.16.1
flatbuffers==24.3.25
fonttools==4.54.1
gast==0.6.0
gdown==5.2.0
google-pasta==0.2.0
grpcio==1.66.1
h5py==3.12.1
idna==3.10
imagesize==1.4.1
ipykernel==6.29.5
ipython==8.27.0
jedi==0.19.1
Jinja2==3.1.4
joblib==1.4.2
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyterlab_pygments==0.3.0
keras==2.8.0
kiwisolver==1.4.7
libclang==18.1.1
mahotas==1.4.18
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.9.2
matplotlib-inline==0.1.7
mdurl==0.1.2
mistune==3.0.2
ml-dtypes==0.4.1
namex==0.0.8
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
nbsphinx==0.8.7
nest-asyncio==1.6.0
numpy==1.26.4
opencv-python==4.10.0.84
opt_einsum==3.4.0
optree==0.12.1
packaging==24.1
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pillow==10.4.0
platformdirs==4.3.6
pockets==0.9.1
prompt_toolkit==3.0.48
protobuf==4.25.5
psutil==6.0.0
pure_eval==0.2.3
Pygments==2.18.0
pyparsing==3.1.4
PySocks==1.7.1
python-dateutil==2.9.0.post0
pytz==2024.2
pywin32==306
pyzmq==26.2.0
referencing==0.35.1
requests==2.32.3
rich==13.8.1
rpds-py==0.20.0
scikit-learn==1.5.2
scipy==1.14.1
six==1.16.0
snowballstemmer==2.2.0
soupsieve==2.6
Sphinx==7.4.7
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-napoleon==0.7
sphinxcontrib-programoutput==0.17
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
tensorboard==2.17.1
tensorboard-data-server==0.7.2
tensorflow==2.8.0
tensorflow-intel==2.8.0
tensorflow-io-gcs-filesystem==0.31.0
termcolor==2.4.0
threadpoolctl==3.5.0
tinycss2==1.3.0
tomli==2.0.1
tornado==6.4.1
tqdm==4.66.5
traitlets==5.14.3
typing_extensions==4.12.2
tzdata==2024.2
urllib3==2.2.3
wcwidth==0.2.13
webencodings==0.5.1
Werkzeug==3.0.4
wrapt==1.16.0
Please help, it's been preventing me from doing finishing any of my work.
Hello,
I need some help with my project for enterprise software engineering. I’m making a document management system and I’m given my professors API where I will be calling his endpoints to create a session, query and request files to store in my database and collect data. I am collecting pdf files for Loans and I’m supposed to check if they’re complete or not. So far, I keep getting an error that my database keeps getting null values yet I can see the json decoded array and they’re all there. They’re just not being stored in my database. Please help lol.
Hello I am a student and was given a .h file with the appropriate structure and function proprototypes and left to implement them. I was also provided a test driver. I pass all the tests but the last one which I believe involved queuing and dequeueing values at the limit of the queue. GPT hasn't been any help and alot of what I find online are implementations where there seems to be a check for if the queue is full and will not add amd just inform on the status.
This implementation needs to "wrap around" and replace vues at the tail once it becomes full.
I would appreciate any insight or guidance becuase it seems like the solution should be simple but I have been stuck on this embarrassingly long.
Code:
#include "circular.h"
void CircularInitialize(CircularQueue *q) // Sets up initial values for the circular queue
{
q->count = 0;
q->head = 0;
q->tail = 0;
}
void CircularEnqueue(CircularQueue *q, int value)
{
if (q->count < QUEUE_SIZE) { // Queue is not full
q->data[q->head] = value;
q->head = (q->head + 1) % QUEUE_SIZE;
q->count++;
} else { // Queue is full (wraps around)
q->tail = (q->tail + 1) % QUEUE_SIZE;
q->data[q->head] = value;
q->head = (q->head + 1) % QUEUE_SIZE;
}
}
int CircularDequeue(CircularQueue *q, int *pValue)
{
if (q->count > 0) { // Queue is not empty (can dequeue from tail)
*pValue = q->data[q->tail];
q->tail = (q->tail + 1) % QUEUE_SIZE;
q->count--;
return 0; // Success
}
return 1; // Queue is empty, cannot dequeue
}
Hi I'm trying to set up network where H1 connects to S1 on port 1 on both, S1 connects to S2 on port 2 for both and S2 connects to H2 on port 1 for both.
I have to use Mininet and RYU to make this network.
I have a ryu script with all the correct imports (given by my lecture) but I need H1 to be able to ping H2 but when I try pingall I just get Xs
When I run it I get no errors but it doesn't work.
H1 is also not allow to ping H3,4,5 and techinally it's doing that but I don't understand why it's not ping H2.
Can someone please explain where I'm going wrong? Thanks
Here is the code
def setup_icmp(self, dp, port, nw_src, nw_dst):
ofp = dp.ofproto
ofp_parser = dp.ofproto_parser
# Allow ICMP (ping) traffic from h1 (10.1.1.1) to h2 (10.1.1.2)
if nw_src == '10.1.1.1' and nw_dst == '10.1.1.2':
match = ofp_parser.OFPMatch(
dl_type=0x800,
nw_src='10.1.1.1',
nw_dst='10.1.1.2',
nw_proto=1 # ICMP protocol
)
actions = [ofp_parser.OFPActionOutput(port)]
mod_msg = ofp_parser.OFPFlowMod(
datapath=dp,
match=match,
command=ofp.OFPFC_ADD,
actions=actions
)
dp.send_msg(mod_msg)
# Drop ICMP (ping) traffic from h1 (10.1.1.1) to h3, h4, or h5
elif nw_src == '10.1.1.1' and nw_dst in ['10.1.1.3', '10.1.1.4', '10.1.1.5']:
match = ofp_parser.OFPMatch(
dl_type=0x800,
nw_src='10.1.1.1',
nw_dst=nw_dst,
nw_proto=1 # ICMP protocol
)
# No actions specified, meaning the packet will be dropped
mod_msg = ofp_parser.OFPFlowMod(
datapath=dp,
match=match,
command=ofp.OFPFC_ADD,
priority=10, # Higher priority to enforce the drop rule
instructions=[]
)
dp.send_msg(mod_msg)
I need to send a post request from js over to python, but no matter what I do I always get the same error.
Script:
from fastapi import FastAPI, HTTPException, Request
import base64
import io
import os
from spleeter.separator import Separator
from pydub import AudioSegment
import traceback
app = FastAPI()
separator = Separator('spleeter:2stems')
u/app
Script:
from fastapi import FastAPI, HTTPException, Request
import base64
import io
import os
from spleeter.separator import Separator
from pydub import AudioSegment
import traceback
app = FastAPI()
separator = Separator('spleeter:2stems')
@app.post('/separate')
async def separate_vocals(request: Request):
try:
# Parse incoming JSON request manually
body = await request.body()
data = body.decode("utf-8")
# Manually load JSON in case it's not being parsed automatically
import json
parsed_data = json.loads(data)
if "audio" not in parsed_data:
raise HTTPException(status_code=400, detail="Invalid request: 'audio' field missing")
input_base64 = parsed_data['audio']
# Decode the base64 audio data
audio_data = base64.b64decode(input_base64)
audio_file = io.BytesIO(audio_data)
# Load audio into AudioSegment
audio = AudioSegment.from_file(audio_file, format="wav")
audio.export("input.wav", format="wav")
# Separate vocals using Spleeter
separator.separate_to_file("input.wav", "output")
# Load separated vocals
vocals = AudioSegment.from_wav("output/input/vocals.wav")
# Convert vocals to base64
vocals_io = io.BytesIO()
vocals.export(vocals_io, format="wav")
# Ensure data exists to encode
vocals_base64 = base64.b64encode(vocals_io.getvalue()).decode('utf-8')
# Clean up temporary files
os.remove("input.wav")
os.remove("output/input/vocals.wav")
os.rmdir("output/input")
os.rmdir("output")
return {"vocals_base64": vocals_base64}
except Exception as e:
error_detail = f"Error: {str(e)}\nTraceback: {traceback.format_exc()}"
print(error_detail)
raise HTTPException(status_code=500, detail=error_detail)
# Run with: uvicorn script_name:app --host 0.0.0.0 --port 3020
from fastapi import FastAPI, HTTPException, Request
import base64
import io
import os
from spleeter.separator import Separator
from pydub import AudioSegment
import traceback
app = FastAPI()
separator = Separator('spleeter:2stems')
@app.post('/separate')
async def separate_vocals(request: Request):
try:
# Parse incoming JSON request manually
body = await request.body()
data = body.decode("utf-8")
# Manually load JSON in case it's not being parsed automatically
import json
parsed_data = json.loads(data)
if "audio" not in parsed_data:
raise HTTPException(status_code=400, detail="Invalid request: 'audio' field missing")
input_base64 = parsed_data['audio']
# Decode the base64 audio data
audio_data = base64.b64decode(input_base64)
audio_file = io.BytesIO(audio_data)
# Load audio into AudioSegment
audio = AudioSegment.from_file(audio_file, format="wav")
audio.export("input.wav", format="wav")
# Separate vocals using Spleeter
separator.separate_to_file("input.wav", "output")
# Load separated vocals
vocals = AudioSegment.from_wav("output/input/vocals.wav")
# Convert vocals to base64
vocals_io = io.BytesIO()
vocals.export(vocals_io, format="wav")
# Ensure data exists to encode
vocals_base64 = base64.b64encode(vocals_io.getvalue()).decode('utf-8')
# Clean up temporary files
os.remove("input.wav")
os.remove("output/input/vocals.wav")
os.rmdir("output/input")
os.rmdir("output")
return {"vocals_base64": vocals_base64}
except Exception as e:
error_detail = f"Error: {str(e)}\nTraceback: {traceback.format_exc()}"
print(error_detail)
raise HTTPException(status_code=500, detail=error_detail)
# Run with: uvicorn script_name:app --host 0.0.0.0 --port 3020
Post request:
curl -X POST http://127.0.0.1:3020/separate
\-H "Content-Type: application/json" \-d "{\"audio\":
\"SUQzBAAAAAABOVRYWFgAAAASAAADbWFqb3JfYnJhbmQAZGFzaABUWFhYAAAAEQAAA21pbm9yX3ZlcnNpb24AMABUWFhYAAAAHAAAA2NvbXBhdGlibGVfYnJhbmRzAGlzbzZtcDQxAFRJVDIAAAAvAAADTWluZWNyYWZ0IE1lbnUgQnV0dG9uIFNvdW5kIEVmZmVjdCB8IFNvdW5mZmV4AFRTU0UAAAAPAAADTGF2ZjU3LjgzLjEwMAAAAAAAAAAAAAAA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VVVVVVVVVVVVVVVVVV//uSZECP8AAAaQAAAAgAAA0gAAABAAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7kmRAj/AAAGkAAAAIAAANIA\"}"
Output:
{"error":"'bytes' object has no attribute 'get'"}
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Malformed input to a URL function
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Malformed input to a URL function
.post('/separate')
async def separate_vocals(request: Request):
try:
# Parse incoming JSON request manually
body = await request.body()
data = body.decode("utf-8")
# Manually load JSON in case it's not being parsed automatically
import json
parsed_data = json.loads(data)
if "audio" not in parsed_data:
raise HTTPException(status_code=400, detail="Invalid request: 'audio' field missing")
input_base64 = parsed_data['audio']
# Decode the base64 audio data
audio_data = base64.b64decode(input_base64)
audio_file = io.BytesIO(audio_data)
# Load audio into AudioSegment
audio = AudioSegment.from_file(audio_file, format="wav")
audio.export("input.wav", format="wav")
# Separate vocals using Spleeter
separator.separate_to_file("input.wav", "output")
# Load separated vocals
vocals = AudioSegment.from_wav("output/input/vocals.wav")
# Convert vocals to base64
vocals_io = io.BytesIO()
vocals.export(vocals_io, format="wav")
# Ensure data exists to encode
vocals_base64 = base64.b64encode(vocals_io.getvalue()).decode('utf-8')
# Clean up temporary files
os.remove("input.wav")
os.remove("output/input/vocals.wav")
os.rmdir("output/input")
os.rmdir("output")
return {"vocals_base64": vocals_base64}
except Exception as e:
error_detail = f"Error: {str(e)}\nTraceback: {traceback.format_exc()}"
print(error_detail)
raise HTTPException(status_code=500, detail=error_detail)
# Run with: uvicorn script_name:app --host 0.0.0.0 --port 3020
from fastapi import FastAPI, HTTPException, Request
import base64
import io
import os
from spleeter.separator import Separator
from pydub import AudioSegment
import traceback
app = FastAPI()
separator = Separator('spleeter:2stems')
@app.post('/separate')
async def separate_vocals(request: Request):
try:
# Parse incoming JSON request manually
body = await request.body()
data = body.decode("utf-8")
# Manually load JSON in case it's not being parsed automatically
import json
parsed_data = json.loads(data)
if "audio" not in parsed_data:
raise HTTPException(status_code=400, detail="Invalid request: 'audio' field missing")
input_base64 = parsed_data['audio']
# Decode the base64 audio data
audio_data = base64.b64decode(input_base64)
audio_file = io.BytesIO(audio_data)
# Load audio into AudioSegment
audio = AudioSegment.from_file(audio_file, format="wav")
audio.export("input.wav", format="wav")
# Separate vocals using Spleeter
separator.separate_to_file("input.wav", "output")
# Load separated vocals
vocals = AudioSegment.from_wav("output/input/vocals.wav")
# Convert vocals to base64
vocals_io = io.BytesIO()
vocals.export(vocals_io, format="wav")
# Ensure data exists to encode
vocals_base64 = base64.b64encode(vocals_io.getvalue()).decode('utf-8')
# Clean up temporary files
os.remove("input.wav")
os.remove("output/input/vocals.wav")
os.rmdir("output/input")
os.rmdir("output")
return {"vocals_base64": vocals_base64}
except Exception as e:
error_detail = f"Error: {str(e)}\nTraceback: {traceback.format_exc()}"
print(error_detail)
raise HTTPException(status_code=500, detail=error_detail)
# Run with: uvicorn script_name:app --host 0.0.0.0 --port 3020
Post request:
curl -X POST http://127.0.0.1:3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VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//uSZECP8AAAaQAAAAgAAA0gAAABAAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7kmRAj/AAAGkAAAAIAAANIA\"}"
Output:
{"error":"'bytes' object has no attribute 'get'"}
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Malformed input to a URL function
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Malformed input to a URL function
i'm using the flag "python" due to sub requirements but it also extends to rust and C.
i usually tend to name variables that aren't important, usually numeric and temporary, with very simple names
in a section of a python code where i was doing a riemann summation, i had the following:
# suppose f has been already set
t=start
y=0
L=[]
while t<end:
y+=dt*f(t)
L.append((t,y))
t+=dt
return L
my friend told me to change it but i realized i do this all the time
I've been programming for 8 months now and as I progress I'm starting to lose ideas on what to program. I did everything from Calculator to To Do app, Weather app etc... I want to start my own project but everytime I come up with something, there is already a better version of it. Are there any ideas that you guys have for me to program or collaborate on? I would really appreciate the advice.
I'm a backend developer with a solid background in Django, but I’ve recently started working on a project where Node.js and Express are the main tools. While I’m comfortable with Python and Django’s ORM, request handling, and all the Django goodies, I’m finding the transition to the JavaScript ecosystem a bit overwhelming.
Any tips and advice would be welcome and I am sure would go a long way
Me and my brother were recently consulting each other about how we might go writing some programming on a computer that could activate or recognize certain weather alerts.
The idea would be to have a code running background that would run a script. The script would check for certain terms or would detect alerts from a weather app or program.
If a weather alert came up for rain, it would run a script that would be tied to the programmable lights we have installed through his computer or phone, this would activate the app that the lighting is connected to and select a specific coloring (say green), and the lights would color and light on and be green.
If it were severe thunderstorms it would do the same and light up yellow. So on and so forth.
We're trying to figure out the best way to do this and if it's possible. I theorized that you could use python and have it be running in the background or have a script running in the background checking for text on the screen, and it would detect certain text (like rain, thunderstorm, tornado, flood, etc). The script would recognize when these words appear, activate Python or a secondary script, and this would activate the program controlling the lighting.
We are wondering if anybody might have any suggestions or if somebody might know the best kind of method to use for this? I know that you can use Python to open and close programs on computers and I know that you can use it to control settings and activate features. I also know you can use text scripts and have them run in the background to execute various functions. This is meant to be more of an open discussion as we're seeking advice or ideas. If anybody has anything they can contribute it would be helpful (The purpose of this is to create a programming script that can run passively, and activate the lighting based off of alerts from weather or news and change the lighting to signify severity; we both have hearing issues.)
<button class = "noteTools" id = "downloadNote1" onclick = "download()">
<i class="fa-solid fa-file-arrow-down"></i>
Download Note
</button>
<div id = "note1">
<textarea class = "notePad1" placeholder="Take down some notes..."
name = "NotePad1"></textarea>
</div>