/r/AskProgramming

Photograph via snooOG

Ask questions about programming.

AskProgramming

All questions related to programming welcome. Wonder how things work? Have a bug you can't figure out? Just read about something on the news and need more insights? We got you covered! (probably)

Do

  1. Ask questions and start discussions
  2. Keep things civil and support each other
  3. Give your threads descriptive titles
  4. Include relevant information when asking for help
  5. Stay on topic in your posts and replies

Don't

  1. Post off-topic material
  2. Troll or flamebait, insult others, or act in bad faith
  3. Self-promote
  4. Ask others to do your work for you
  5. Ask for help in illegal or unethical activities
  6. Repost the same question within 24 hours
  7. Post AI-generated answers

You can find out more about our (preliminary) rules in this wiki article. If you have any suggestions please feel free to contact the mod team.

Have a nice time, and remember to always be excellent to each other :)

/r/AskProgramming

127,669 Subscribers

1

I need some advice.

Hi everyone. I have the opportunity to start programming school after the summer and I'm having trouble deciding what path to choose.

The school offers a variety of courses and each one is two years long.

I don't have a lot of experience in programming but i really enjoy it.

I've been teaching myself with the help of youtube and some online courses like CS50 for about six months now.

I also had to take a programming course as a prerequisite to get in to the school im applying for. The course was entirely in python.

The school offers a variety of programs, or courses depending on what you want to call them. Everything from system engineering with C and C++ to web development. I am more interested in their fullstack programs and web development so that's what I'm going for.

The programs that I have applied for are:

Fullstack Open Source: Focuses on web development with PHP as backend and html, css and JS as fronten. Also covers a variety of frameworks like react and laravel.

According to their website and the email i received after asking them. This program gives you a broad understanding of web and fullstack development.

Fullstack .NET: A fullstack course that covers the .NET ecosystem. According to them it is more backend oriented but you still get to learn som JS . But like the name suggests it focuses on .NET technologies.

Fullstack JS: Specialises in JS. Node and express in the backend and JS frameworks in the front end. More frontend orriented of course.

All three programs cover the fundamentals of fullstack development but with a different emphasis on certain areas.

Should I go for Open Source and be a little more well rounded or should I specialise and focus on one area like .NET and JS.

Worth noting is that the last part of the course is a non guaranteed internship. It is non guaranteed because it depends on your own perfomance (grades and such) and the job market. This internship is a big part of the course since a lot of people get job offers from the company if they perform well.

I have spoken to few people and some have told me that it is good to specialise in one area in todays market and some have told me that general knowledge is good.

So what do I choose?

Thanks in advance.

0 Comments
2024/04/28
04:29 UTC

1

new to programming

hi I'm new to programming I have a raspberry pi I believe it's a 4? I'm wondering how to run things like Microsoft ui on this to use it more like a computer idek if it's possible but that's my goal

3 Comments
2024/04/28
03:58 UTC

5

Why do we use HTTP for communication in microservices

Hi, I'm a C++ dev and I've been developing only monolithic apps but I'd like to know more about microservices approach, so excuse me my ignorance and foolish question ;))

If I understand correctly, microservices approach utilizes many separate programs (microservices) working together where each one does only one thing. But I don't really understand, why do we use HTTP for communication. HTTP is protocol used in web communication and I can comprehend, that it could be useful if all services were on different servers. But what if all services are on the same physical machine? Is such a scenario even possible? It somehow just... I don't know, just doesn't look right to me :D

Thanks in advance!

10 Comments
2024/04/28
01:29 UTC

1

Need help with a bowling score program…

I’ve been assigned this program assignment in my c++ class, the goal is to create a bowling score keeper that takes input for the number of pins knocked over in each frame and updating the score after each frame, we are supposed to use arrays to hold the pins for each turn , and a separate array to hold the values off the updated score per frame. My issue is I am struggling a lot with finding a way to display each pins value for each throw in the output, here is my code I have so far, and what the desired output is supposed to look like is at the bottom. Any help appreciated👍

#include <iostream>

const int NUM_FRAMES = 10;

int main () {

int numThrows[21]; int frameScore[10] = { 0 }; int totalScore = 0;

for (int i = 0; i < NUM_FRAMES; i += 1) { int pins; int pins2; std::cout << "Turn Frame " << i + 1 << std::endl; std::cout << "1st Throw: "; std::cin >> pins;

  if (pins == 10)
	{						// Strikes
	  numThrows[i] = -1;
	  numThrows[i + 1] = 0;
	}
  else
	{
	  numThrows[i] = pins;
	  std::cout << "2nd Throw: ";
	  std::cin >> pins2;
	  if (pins + pins2 == 10)
		{					// Spares
		  numThrows[i + 1] = -2;
		}
	  else
		{
		  numThrows[i + 1] = pins2;
		}
	}

  std::cout << "Frame#:   ";
  for (int j = 0; j < NUM_FRAMES; ++j)
	{
	  std::cout << j + 1 << "     ";
	}
  std::cout << std::endl;

  std::cout << "Throws:  ";
  for (int k = 0; k <= NUM_FRAMES; k++)
	{
	  if (numThrows[k] == -1)
		{
		  std::cout << "X" << " ";
		  std::cout << "   ";
		  totalScore = totalScore + 10;
		  frameScore[k] = totalScore;
		}
	  else
		{
		  std::cout << numThrows[k] << " ";
		  if (numThrows[k + 1] == -2)
			{
			  std::cout << "/" << "   ";
			  totalScore = totalScore + 10;
			  frameScore[k] = totalScore;
			}
		  else
			{
			  std::cout << numThrows[k + 1] << "   ";
			  totalScore = numThrows[k] + numThrows[k + 1];
			  frameScore[k] = totalScore;
			}
		}
	  std::cout << std::endl;
	  std::cout << "Score:    " << frameScore[k] << "   " << std::endl;
	  std::cout << std::endl;
	  std::cout << totalScore;
	  std::cout << std::endl;
	  break;
	}
}
  return 0;

}

Turn Frame 4 1st Throw: 9 2nd Throw: 0 Frame#: 1 2 3 4 5 6 7 8 9 10 Throws: 5 4 3 1 8 1 9 0 Scores: 9 13 22 31

0 Comments
2024/04/28
01:16 UTC

5

Do "unsigned" floating point numbers exist? It is possible to use them?

In most programming languages the floating point numbers are "signed" meaning that they can be either positive or negative. But what about "unsigned" ones? It is possible to create an unsigned floating point number?

4 Comments
2024/04/28
00:05 UTC

1

How would I write this? Could someone point me toward the right direction?

I am trying to learn a new language(Russian) and the most effective way I came across was getting prompted to translate phrases.

There is no way in Duolingo to do this on demand as there doesn't seem to be a stand alone option and I am not aware of other tools or online platforms who offer this type or service.

I imagine there should be a database of phrases with a database of corresponding translations and an engine to interact with a GUI and I am struggling to figure out an approach.

I could use Yandex or Google translate's API and throw random phrases at them to which I get prompted to translate, for instance.

I am not asking you to spoonfeed but it has been a looooooong time since I've fired up Macromedia Dreamweaver.

I have done some programming years ago and I figure something like this shouldn't be hard to pull off, even in javascript.

How should I proceed?

https://i.ibb.co/pPDRCxh/Screenshot-20240427-131214-Video-Player.jpg

https://i.ibb.co/k6mv63m/Screenshot-20240427-131045-Video-Player.jpg

2 Comments
2024/04/27
22:58 UTC

1

help solving a really specific bug in a regex to non deterministic automata parser?

Specifically, it's a problem with parenthesis and "OR" parsing. I have a test case and can tell you exactly where the problem is, I just can't think of a solution to this problem that wouldn't involve completely restructuring what I have built so far =/

Here is the source code. I made a branch specifically for sharing here on reddit. The relevant file is the src/regex/regex_parser.py and I also got a test file with this use case

Here is the deal: I am parsing a regex string that contemplates the following symbols:

  • [a-z] for lower case characters
  • [A-Z] for upper case characters
  • [A-z] for both lower and upper
  • [0-9] for numeric digits
  • normal letters (a, b, c...)
  • I support 3 postfix operators: * for zero or more, + for one or more and ? for zero or one
  • I have a | symbol representing the OR operation
  • I have parenthesis, to group expressions

The basic parsing logic is:

  • I start the parsing with an empty "main automata"
  • while I detect a "content symbol" (like letters or numbers), I create an automata that recognizes this symbol, concatenate my main automata with the one that accepts this symbol and advance the cursor
  • if I detect an open parenthesis, I advance the cursor, recursively parse the content and return when I find a close parenthesis. with the returned automata I concatenate what I had before entering the recursion
  • if I find an OR operator, I advance the cursor and parse the "right side" recursively, then I do a "union" of the right result with the previous automata (line 55 of the src/regex/regex_parser.py file)

and that's where the problem is: say I'm parsing the string "(a|b|c)*". Then here is how it goes:

I'll enter a paren recursion (1), parse "a", enter another one because of the OR (2), parse "b", enter another one because of the second OR (3), parse c, leave one level of recursion because of the right paren (2) and then apply a star operation in the current automata, which is only the "b|c" one, while it should actually be the "a|b|c". This is happening because although I'm matching each recursion entry by left paren with an exit with right paren, the same is not true for the "ORs".

Do you guys have any idea how to fix this? I'm pulling my hair out here =/

0 Comments
2024/04/27
22:51 UTC

0

Could partial prerendering in NextJS revolutionize web speeds?

Partial Prerendering Delivers Blazing Speeds and Dynamic Dreams

Feeling the pain of slow-loading web apps with dynamic content? There's a new hero in town: Partial Prerendering (PPR). This cutting-edge approach from` Next.js 14 lets you combine the lightning-fast delivery of static sites with the flexibility of dynamic apps.
Here's the magic, PPR prerenders a static shell of your page, then streams in dynamic bits like shopping carts or personalized content on the fly. This means users see content instantly, while the app fetches data in the background.

Actionable Insights:

Dive into the Experiment: Install Next.js 14 Canary on Vercel and enable PPR in your next.config.js file. Explore how PPR integrates with your projects and identify potential use cases.
Embrace Framework Flexibility: PPR isn't limited to Next.js! Investigate integrating PPR with other front-end frameworks through Vercel's Build Output API. This opens doors for broader adoption.
Power Up with ISR: Combine PPR with Incremental Static Regeneration (ISR) to keep your static content fresh while enjoying dynamic updates for specific elements. This provides the best of both worlds.

Key Takeaways:

PPR Unites Strengths: Partial Prerendering merges the reliability of static content delivery with the flexibility of dynamic rendering, leading to a powerful new approach.
Faster User Interactions: PPR reduces reliance on server-side processes, shifting the workload to the client side. This translates to faster user interactions and smoother experiences.

This is literally an amazing NextJS update if you want such actionable tech insights subscribe to my newsletter (check comments). The above writeup from my last newsletter edition has been extrapolated here as well for convenience.

3 Comments
2024/04/27
20:22 UTC

1

Question: what software do you use for blogging about programming?

I want to write up a few articles about coding, and them put them on my site. I'd want to be able to embed code fragments within styled text. What are some helpful tools for this?

3 Comments
2024/04/27
19:31 UTC

34

Google laysoff entire Python team

Google just laid off the entire Python mainteners team, I'm wondering the popularity of the lang is at stake and is steadily declining.

Respectively python jobs as well, what are your thoughts?

24 Comments
2024/04/27
18:59 UTC

0

What to do if feeling under-performing even though I have been programming for many years?

Hello, I have been programming for 5-ish years, and looking at other peoples progression, I saw that they we're building some very impressive projects, something which I probably couldn't make.

I am in Middle School and I am always worrying about my projects, because my GitHub is filled with some beginner projects, it feels like I'm stuck in tutorial hell, even though I can retain newly obtained information pretty well. I can't seem to stick to ONE thing, almost every week I switch from Web Dev, App Dev, GUI Dev, Game dev and so on and so on. The most impressive thing in my GitHub is probably a custom 3D Renderer I built following a tutorial, but without it it's probably my portfolio, or a pomodoro timer. I feel like I've just started coding, and it makes me feel very sad. Alot of other people say that I am gifted, and very talented, but I don't see it.

How do I fix it? I am always also switching languages I use. My favourite are C++ and C#, due to their respective syntaxes, but I'm not even into advanced stuff. The farthest is in C# where I know OOP.

6 Comments
2024/04/27
18:39 UTC

0

Need help finding x86/64 assembly mass move instruction

At some point I was wondering why the _si and _di registers were referred to as "source" and "destination" and I found that there is a special move command which moves a big chunk of data from the location pointed to by _si to the one pointed to by _di. Now, though, I cannot seem to find any whispers of such an instruction on the internet, so I ask here, does anyone know what it is or if it even exists?

2 Comments
2024/04/27
17:09 UTC

1

Time complexity of an algorithm that splits the input size by sqrt(n) after every iteration

I don't know any algorithm that does this but I was thinking about it and I wanted to figure out a generalised approach to find the time complexity for any algorithm like this that divides the size by a certain operation.

Kind of like binary search, my approach was to form an equation in x. Binary search divides the array size in 2 after every iteration so the equation would be n/(2^x)=1. This gives us x=log n.

Doing the same for sqrt(n) gives us the equation n^(1/(2^k))=1. I wasn't able to solve this equation without log1 messing things up.

Maybe I'm going about it wrong or something's wrong with my math. I'd appreciate any help.

Edit: I realised the rhs of the equation cannot be one. How do we find the base case then?

2 Comments
2024/04/27
16:11 UTC

0

Getting suggestions when I press dot (".") in MC visual studio

Vs doesn't give me suggestions when I press Ctrl+space either. I've got all the related settings enabled (the ones others have suggested for that issue) and nothing works.

1 Comment
2024/04/27
14:17 UTC

0

Someone explain what "initializing an object" means in programming and what "instance" means

im quite new to programming and im currently learning java rn, and i keep seeing the word "instance" and "initializing" and im hella confused T-T pls explain it to me like im 5, use analogies, im sorry im dumb lol

20 Comments
2024/04/27
13:15 UTC

1

Video profile database/listing

Video Profile Database

Are there any software solutions or templates available to create a database for storing video profiles? Essentially, I'm looking for a platform that allows you to create a listing or catalog, where each entry contains:

A text description field

The ability to upload and display an image

The ability to embed or link to a video that can be played

Any ideas what would be the easiest solution?

Thanks,

SJE

0 Comments
2024/04/27
12:53 UTC

1

I wanna know why it doesn't work on mobile scroll up and down

I'm not good at English.

could you help me? it doesn't work socroll up and down on mobile.

I just followed JS code for making slider for studying

slider is works but if I scroll up and down it only works slider not scroll up and down.

I wanna know about the reason why it doesn't work

I have a problem with the Slider that I programmed when I checked the Mobile interface of my website.

The slider works when you drag it from left and right and right to left. But basically, what's happening is that when i touch the slider section of the website, the page freezes and I'm not able to scroll up and down anymore.

I want to know the reason why this is happening. (Btw I'm not good at English, if you could explain it in a simpler manner it would be great!)

<div class="wrapper">
    <i id="left" class="fa-solid fa-angle-left"></i>
    <div class="carousel">

      <div class="card card-content">
        <p id="content-s-heading">title</p>
        <h1 id="content-b-heading">content</h1>
        <p id="slide_content">sentence<br> sentence/p>
        <button><a href="#">see more</p></a></button>
      </div>
      <div class="card card_prd">
        <a href="#">
          <img src="slider_prd_combo_1.jpg" alt="img" draggable="false">
          <h1 id="slider_prd_title">combo title</h1>
          <p id="slider_prd_price">price 5%</p>
        </a>
      </div>
      <div class="card card_prd">
        <a href="#">
          <img src="선물세트1.jpg" alt="img" draggable="false">
          <h1 id="slider_prd_title">combo title</h1>
          <p id="slider_prd_price">price 5%</p



        </a>
      </div>
      <div class="card card_prd">
        <a href="#">
          <img src="선물세트2.jpg" alt="img" draggable="false">
          <h1 id="slider_prd_title">combo title</h1>
          <p id="slider_prd_price">price 5%</p>
        </a>
      </div>
        
        
        
    </div>
    <i id="right" class="fa-solid fa-angle-right"></i>
  </div>

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  margin: 0 auto;
}

.wrapper{
  display: flex;
  max-width: 1500px;
  position: relative;
  margin: 0 auto;
}
.wrapper i{
    top: 50%;
    width: 80px;
    height: 80px;
    cursor: pointer;
    position: absolute;
    font-size: 1.2rem;
    text-align: center;
    line-height: 80px;
    background: #000;
    color: #fff;
    transform: translateY(-50%);
    transition: 0.5s ease-in-out;
    
    opacity: 0;
}
.wrapper i:active{
  transform: translateY(-50%) scale(0.9);
}
.wrapper:hover i{
  opacity: 1;
}
.wrapper i:first-child{
  left: -80px; /* needs position: absolute */
  display: none; /* hide button */
}
.wrapper i:last-child{
  right: -80px; /* needs position: absolute */
}
.wrapper .carousel{
  font-size: 0px;
  cursor: pointer;
  white-space: nowrap;
  scroll-behavior: smooth;

  display: flex;
  overflow-x: auto;
  margin-bottom: 48px;
  padding: 0 0 48px;
}


.carousel::-webkit-scrollbar{
  height: 3px;
}
.carousel::-webkit-scrollbar-thumb{
  background: #000;
  border-radius: 10px;
}
.carousel::-webkit-scrollbar-track{
  background-color: rgba(0, 0, 0, .2);
}

.card-content {
  padding: 60px 185px 60px 0;
}
.card-content #content-s-heading {
  margin-bottom: 5px;
  font-size: 14px;
}
.card-content #content-b-heading {
  margin-bottom: 10px;
  font-size: 30px;
  font-weight: 400;
}
.card-content #slide_content {
  font-size: 14px;
  margin: 30px 0;
}
.card-content button{
  border: none;
  background-color: #fff;
}
.card-content button:hover a{
  text-decoration: underline;
}
.card-content button a{
  text-decoration-line: none;
  color: #000;
  font-size: 15px;
}



.card a{
  text-decoration: none;
  text-align: center;
  font-size: 0;
}
.card #slider_prd_title {
  font-size: 20px;
  color: #000;
  margin: 10px 0;
}
.card #slider_prd_price{
  font-size: 16px;
  color: #000;
}





.carousel.dragging{
  cursor: grab;
  scroll-behavior: auto;
}
.carousel.dragging img{
  pointer-events: none;
}
.carousel img{
  width: 484px;
  height: auto;
  object-fit: cover;
  user-select: none;
    
  display:block;
  margin-left:16px;
}




@media all and (max-width: 1023px){  
  .wrapper{
    max-width: 941px;
  }
  .card-content {
    padding: 60px 172px 60px 0;
  }
  .carousel img{
    width: 450px;
  }
  .carousel img:first-child{
    margin-left: 0;
  }    
}




@media all and (max-width: 428px){  
    .wrapper{
      max-width: 395px;
    }
    .wrapper .carousel{
      margin-bottom: 45px;
      padding: 0 0 8px;
    }
    .card-content {
      display:none;
    }
    .card_prd {
    margin-left: 0;
  }
    .carousel img{
      width: 395px;
    }    
    
    .wrapper i:first-child{
      left: 0px; /* needs position: absolute */
    }
    .wrapper i:last-child{
      right: 0px; /* needs position: absolute */
    }    
  
}

@media all and (max-width: 375px){ 
  .wrapper{
    max-width: 344px;
  }
  .carousel img{
    width: 344px;
  }    

}

const carousel = document.querySelector(".carousel"),
firstImg = carousel.querySelectorAll("img")[0],
arrowIcons = document.querySelectorAll(".wrapper i");

let isDragStart = false, isDragging = false, prevPageX, prevScrollLeft, positionDiff;

const showHideIcons = () => {
    // showing and hiding prev/next icon according to carousel scroll left value
    let scrollWidth = carousel.scrollWidth - carousel.clientWidth; // getting max scrollable width
    arrowIcons[0].style.display = carousel.scrollLeft == 16 ? "none" : "block";
    arrowIcons[1].style.display = carousel.scrollLeft == scrollWidth ? "none" : "block";
}

arrowIcons.forEach(icon => {
    icon.addEventListener("click", () => {
        let firstImgWidth = firstImg.clientWidth + 16; // getting first img width & adding 14 margin value
        // if clicked icon is left, reduce width value from the carousel scroll left else add to it
        carousel.scrollLeft += icon.id == "left" ? -firstImgWidth : firstImgWidth;
        setTimeout(() => showHideIcons(), 60); // calling showHideIcons after 60ms
    });
});

const autoSlide = () => {
    // if there is no image left to scroll then return from here
    if(carousel.scrollLeft - (carousel.scrollWidth - carousel.clientWidth) > -1 || carousel.scrollLeft <= 0) return;

    positionDiff = Math.abs(positionDiff); // making positionDiff value to positive
    let firstImgWidth = firstImg.clientWidth + 16;
    // getting difference value that needs to add or reduce from carousel left to take middle img center
    let valDifference = firstImgWidth - positionDiff;

    if(carousel.scrollLeft > prevScrollLeft) { // if user is scrolling to the right
        return carousel.scrollLeft += positionDiff > firstImgWidth / 3 ? valDifference : -positionDiff;
    }
    // if user is scrolling to the left
    carousel.scrollLeft -= positionDiff > firstImgWidth / 3 ? valDifference : -positionDiff;
}

const dragStart = (e) => {
    // updatating global variables value on mouse down event
    isDragStart = true;
    prevPageX = e.pageX || e.touches[0].pageX;
    prevScrollLeft = carousel.scrollLeft;
}

const dragging = (e) => {
    // scrolling images/carousel to left according to mouse pointer
    if(!isDragStart) return;
    e.preventDefault();
    isDragging = true;
    carousel.classList.add("dragging");
    positionDiff = (e.pageX || e.touches.pageX) - prevPageX;
    carousel.scrollLeft = prevScrollLeft - positionDiff;
    showHideIcons();
}

const dragStop = () => {
    isDragStart = false;
    carousel.classList.remove("dragging");

    if(!isDragging) return;
    isDragging = false;
    autoSlide();
}

carousel.addEventListener("mousedown", dragStart);
carousel.addEventListener("touchstart", dragStart);

document.addEventListener("mousemove", dragging);
carousel.addEventListener("touchmove", dragging);

document.addEventListener("mouseup", dragStop);
carousel.addEventListener("touchend", dragStop);
0 Comments
2024/04/27
12:40 UTC

1

Need help with live location tracking problem statement

The problem statement is this: Consider a threshold distance between 2 people t.

When these 2 people (having GPS on their phones) come close enough such that the distance between them is equal to t, we need to send an alert to their phones.

The constraint is that, we need to do server side processing, but we can't keep sending the user's location to the server each second because it might result in network congestion

At the same time, we need to find the exact second when this threshold is crossed, so if we send locations periodically, we might miss the exact time.

Any ideas on how to approach this?

2 Comments
2024/04/27
08:30 UTC

3

How do you motivate your self to finish a project to build your portfolio?

I am a self taught programmer. I did get my feet wet in many different technology stacks and I really enjoy programming and problem solving in general. I love to work on small and individual features but I can’t motivate my self to build and finish complete projects.

The only projects I have completed are:

  1. Food receipt desktop app in which you can store and organise food receipts made in C#
  2. A 3D model to sprite converter made in C++
  3. A Card game made in Lua
  4. A Game framework made in Lua
  5. A ToDo list made in Python

I did also made but never finished projects in React, SwiftUI, MAUI, Qt and tons of unfinished games but it is not something I can showcase.

For the past 12 months I’ve been trying to get a job as a junior software developer and game developer but it seems my above projects just don’t make the cut. I did not get a single interview.

So at this point what I really supposed to be doing is make something complete in React or Swift or MAUI that catch the attention of recruiters but I simply can not motivate my self because I do not find the projects interesting that I supposed to be doing only to catch attention.

I do find interesting certain aspects and features but not the entire project from design through coding to finishing. Just feel unmotivated to do the entire thing.

What could you recommend? How do you or did you motivate your self?

Are we really supposed to make complete projects from design to publishing only to get a job so we can work on individual features in a team?

Thanks.

2 Comments
2024/04/27
07:12 UTC

0

Cheater or genius

I knew this guy in first sem and he was completely new to programming(we had python in our first sem and he took up an online course to learn its basics that's how I know he is new). Cut to 6 monts later he got selected in one of the best technical clubs in my college (that too in the tech team) and he has a website where he tells he now knows c,CPP, python,js,css,html,flask and is a full stack developer.In his git he has projects like e-commerce platform using flask,Amazon price tracker,stock market tracker etc.How is it possible he learnt so much in so less time ? And it's not like it's the basics in everything he claims to have knowledge upto like a deeper level which is what's fascinating me

20 Comments
2024/04/27
06:38 UTC

0

Discord Server Available?

So basically I'm a fresh graduate and am working on some projects and I'm currently in an internship. With that being said, I'm looking for a discord server with fellow developers and people already in the work field to interact, network, ask for help/guidance, and make friends.

If you have anything of such sort please do not hesitate to tell me about it!

ENGLISH LANGUAGE IS A MUST! Arabic is also acceptable.

5 Comments
2024/04/27
05:05 UTC

0

Should I put my career on hold and learn react and solidity?

I have been in the Crypto scene for a while, I have met plenty of people and also involved myself in a couple projects where my friends did the development.

I was always disappointed about how much time my friends would invest compared to me and how we would never make enough progress. While I could put my whole life on hold and just focus on something until it is done.

Now I think I have established enough connections to create a project myself but all that is missing are the developers. So I was thinking of learning react and Solidity myself.

My plan is to build generic crypto applications such as Tokens with a staking webapp, web apps with AI models from github, basic ios apps, decentralized messenger apps with a wallet login, social media and marketplaces (web apps) with wallet connect login. All with over kill UIs and branding. The projects will have a lifespan of a week to few months max. and I will keep moving to the next project. I want to be able to pull things together over 2-3 nights.

If I start now, will I be able to build such things until October? I can already build a blank page with buttons and forms in react using the useState hook haha.

If I now completely slow down my current career and code like 3-5H a day. Will I be able to get a job if things don’t work out? If yes, will it be easy for me to so so?

Also assuming I learn react first, will it take me long to learn solidity?

0 Comments
2024/04/27
01:14 UTC

1

Require assistance in implementing a real-time voice conversation system using a voice chatbot API, which includes audio encoding and decoding

I’m developing an AI voice conversation application for the client side, utilizing the Play.ai WebSocket API. The documentation is available here.

I completed the initial setup following the instructions provided, and the WebSocket connection was established successfully.

The system transmits audio input in the form of base64Data,

Which I have successfully decoded, as evidenced by the playback of the initial welcome message.

However, when I attempt to send my audio, I encounter an issue. According to their specifications, the audio must be sent as a single-channel µ-law (mu-law) encoded at 16000Hz and converted into a base64 encoded string.

This is precisely what I am attempting to accomplish with the following code:

function startRecording() {
    navigator.mediaDevices.getUserMedia({ audio: true, video: false })
        .then(stream => {
            mediaRecorder = new MediaRecorder(stream, { mimeType: 'audio/webm;codecs=pcm' });
            mediaRecorder.ondataavailable = handleAudioData;
            mediaRecorder.start(1000); 
        })
        .catch(error => console.error('Error accessing microphone:', error));
}

function handleAudioData(event) {
    if (event.data.size > 0) {
        event.data.arrayBuffer().then(buffer => {
    
            const byteLength = buffer.byteLength - (buffer.byteLength % 2);
            const pcmDataBuffer = new ArrayBuffer(byteLength);
            const view = new Uint8Array(buffer);
            const pcmDataView = new Uint8Array(pcmDataBuffer);
            pcmDataView.set(view.subarray(0, byteLength));
            const pcmData = new Int16Array(pcmDataBuffer);
            
            const muLawData = encodeToMuLaw(pcmData);
            const base64Data = btoa(String.fromCharCode.apply(null, muLawData));
            socket.send(base64Data);
        });
    }
}
function encodeToMuLaw(pcmData) {
    const mu = 255;
    const muLawData = new Uint8Array(pcmData.length / 2);
    for (let i = 0; i < pcmData.length; i++) {
        const s = Math.min(Math.max(-32768, pcmData[i]), 32767);
        const sign = s < 0 ? 0x80 : 0x00;
        const abs = Math.abs(s);
        const exponent = Math.floor(Math.log(abs / 32635 + 1) / Math.log(1 + 1 / 255));
        const mantissa = (abs >> (exponent + 1)) & 0x0f;
        muLawData[i] = ~(sign | (exponent << 4) | mantissa);
    }
    return muLawData;
}

On the proxy side, I am forwarding the request to the API as specified in the documentation:

  function sendAudioData(base64Data) {
    const audioMessage = {
        type: 'audioIn',
        data: base64Data
    };
    playAiSocket.send(JSON.stringify(audioMessage));
    console.log('Sent audio data');
    
}
  ws.on('message', function incoming(message) {
    baseToString = message.toString('base64')
      sendAudioData(baseToString);
  });

The console logs appear to be correct although the chunks that I'm sending appear to be much larger than the chunks I'm reviewing in the welcome message, but I am not receiving any response from the API after the welcome message, not even an error message. The file seems to be transmitting endlessly. Could anyone please assist me in identifying the issue?

1 Comment
2024/04/26
20:20 UTC

0

I have been coming across different types of ai like an ai that takes notes for you when you click on record. How is this done? Do they get the API of a popular ai like chat gpt and modify the instructions?

Also is it possible to do as a solo developer?

7 Comments
2024/04/26
19:37 UTC

0

Need a programmer

I need help in my PHP project, I need someone understand PHP coding, I made the project but I am facing a lot of problems so it can be good if teach me how to do it right, just massage me

1 Comment
2024/04/26
19:21 UTC

22

Is there a way to develop apps for IOS without having a Mac or paying Apple?

I have an IPad and an iPhone that I want to develop apps for and to train on. However I have a windows computer and the yearly membership of Apple developers is “let’s say excessive “. Is there a way around the pay wall to learn and develop iOS apps?

35 Comments
2024/04/26
18:59 UTC

1

Code signing

My 3-year individual code signing certificate needs replacing and, of course, new standards came into place last year. It seems I can either (a) code sign online using a subscription, (b) code sign locally using a USB key they supply, or (c) code sign locally using a USB key that I supply. Are those basic options correct?

With option (a) it's quite expensive on a monthly basis for something I might sign only a handful of times a month. Option (b) the USB key is expensive ($120+) and shipping may take a while (US). Option (c) is one I like, but if I look on Amazon for FIPS Yubi L2 keys, I'm not convinced I'm buying the correct thing. Can you link me to specific products that meet the requirements please? Or should I just go for one of the other options?

4 Comments
2024/04/26
18:45 UTC

2

How payment to multiple different account works?

I am fascinated as to how banks and some businesses pay different people different amounts accurately

The reason for this question is one of my friends received a dividend and I was wondering how software handles giving different amounts to different people correctly

If someone wants to build a payment software, how can someone do it or is there a company or a team of programmers who could do that for someone

Thank you

12 Comments
2024/04/26
18:03 UTC

1

Python Databases

Hey guys , I’m a beginner in programming and I want to get practical experience doing some projects. So I will start by creating a database and create embeddings in this database. What are the best databases that I can use? Other than chromadb

1 Comment
2024/04/26
17:38 UTC

0

I am trying to gather some feedback and criticism for a flask project of mine and would really appreciate some responses to my short survey.

0 Comments
2024/04/26
17:14 UTC

Back To Top