• Breaking News

    Tuesday, October 5, 2021

    I've had .net explained to me several times over the years. I still don't fully understand what it is. Ask Programming

    I've had .net explained to me several times over the years. I still don't fully understand what it is. Ask Programming


    I've had .net explained to me several times over the years. I still don't fully understand what it is.

    Posted: 05 Oct 2021 08:56 AM PDT

    I'm a rookie programmer (just landed my first post-graduation job 3 months ago).

    I understand languages, operating systems. I've coded in c++, java, currently I'm doing python. I've worked in linux, windows.

    I also understand frameworks (sort of, i've still not found a satisfactory description of the difference between a framework and a library). I've used springboot, flask etc.

    But... its not just like c# is just a language and that's it. Everybody I know who uses it doesn't describe themselves as a "C# developer". They always say ".net developer".

    I understand what google will tell you if you ask what .net is. I've also seen power point slides throughout university saying what it is.

    How all of microsoft software development has shared resources, blah blah blah, .net is a framework, blah blah blah, extensible, mobile, scalable, and the rest of the buzzwords. I just don't really get "what" it is. Its neither software you use? Nor is it a language.

    Is it a backend thing you'll rarely touch? Like a runtime environment?

    Maybe if you compared it to something from another language. What would be its c++ or python equivalent.

    submitted by /u/Dotaproffessional
    [link] [comments]

    How hard is it to make 500$ a month freelancing as a web developer?

    Posted: 05 Oct 2021 03:40 PM PDT

    I thought about investing my free time in learning a skill online and make some profit from it.
    I already understand the basics of programming as I did a lot of hobby projects making games and pretty much anything that did interest me before. Anyway, I started learning web development on freecodecamp.org . I had already, before I start, some experience and a fair understanding of color theory, typography and stuff like that. I just finished HTML + CSS path and almost JavaScript. Here is a page I made using only html and plain css. I'm planning to start building an actual portfolio and start freelancing. I have never worked online before. Am I asking at the right place/subreddit?

    My question is:

    1) How do I start? Where?

    2) How much can I make as a beginner?

    3) Any tips?

    submitted by /u/Hamdy34
    [link] [comments]

    Trying to understand basic machine learning.

    Posted: 05 Oct 2021 08:53 PM PDT

    Note: Long post with a lot of code without comments (so very sorry), so no pressure to try to help with this one.

    Hello y'all! For a personal project I started learning about machine learning. I was able to create a 1 layer linear system that works very well (as long as the answer/pattern is simple/linear). But I started looking into more complicated things, and don't understand most of it.

    For the 1 layer linear system my understanding of the logic went as follows:

    1. Get test data
    2. Create random weights, 1 per input
    3. To train
      1. Sum = weight * input value for each input
      2. Adjust each weight by sum - targetValue (times a very small learning rate)
      3. Repeat alot
    4. To predict
      1. Round sum (Sum = weight * input value for each input like in learning)

    It worked great for this very basic data set.

    Here is my code for the 1 layer linear system (very very sorry for the no comments): I wrote this before looking up a guide, so the code/ideas are probably not the best (would also love feedback on this)

    import random import math class Data(): def __init__(self, info): self.info = info def readInInfo(self, fname): print("not done yet") def getInfo(self): return self.info def getRows(self): # total # how many tall return len(self.info) def getColumns(self): # rows # how many on wide return len(self.info[0]) def getValueAt(self, rowNum, colNum): return self.info[rowNum][colNum] def getResultForRow(self, rowNum): return self.info[rowNum][len(self.info[rowNum]) - 1] class AI(): def __init__(self): self.learningRate = 0.05 self.data = [] self.weights = [] def learn(self, numberOfTests): weights = self.weights print("") for cycle in range(numberOfTests): print("\n\nCycle: %i" % cycle) for colNum in range(self.data.getColumns() - 1): print(" %f" % weights[colNum]) for rowNum in range(self.data.getRows()): sum = 0.0 for colNum in range(self.data.getColumns() - 1): sum = sum + weights[colNum] * self.data.getValueAt(rowNum, colNum) try: sum = math.sqrt(sum) except: sum = -(math.sqrt(-sum)) dif = sum - self.data.getResultForRow(rowNum) for colNum in range(self.data.getColumns() - 1): weights[colNum] = weights[colNum] - self.learningRate * (dif * self.data.getValueAt(rowNum, colNum)) self.weights = weights print("\n\n\nLearning Finished!") def predictRow(self, row): sum = 0 for colNum in range(self.data.getColumns() - 1): sum = sum + self.weights[colNum] * row[colNum] value = round(sum) print("Sum: %f" % sum) print("Value: %i" % value) return value def printWeights(self): print("Weights:") for colNum in range(self.data.getColumns() - 1): print("%f" % self.weights[colNum]) def setData(self, data): self.data = data for colNum in range(self.data.getColumns() - 1): weight = random.random() self.weights.append(weight) def getData(self): return self.data def main(): ai = AI() info = [ [1, 0, 1, 1, 1], [1, 0, 0, 1, 1], [0, 1, 1, 0, 0], [1, 1, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 1, 0] ] data = Data(info) ai.setData(data) ai.printWeights() temp = input("Press [enter] to start learning: ") ai.learn(999) ai.printWeights() row = [1, 0, 1, 0] print("\n\nTrying to predict the result if this was the data: ") print(row) print("\nPrediction: ") ai.predictRow(row) main() 

    However, I did not understand the adding more layers and how they all connected/got updated. My original understanding was that each layer reduced the amount of 'nodes' until there was 1 node, the output. I tried doing a bit of research, but I got quickly confused.

    My understanding:

    1. Get test data
    2. Create random weights
      1. 1 per input
      2. Then 1 less, then 1 less, etc (4 weights, connect to 3 points -> 3 weights connect to 2 points, etc) (Picture of what I mean: https://imgur.com/a/DM6hHet)
    3. To train
      1. Sum for each point, then use that sum as the next 'inputs'
      2. Adjust each weight by sum - targetValue (times a very small learning rate)
      3. Something with an activation function?
      4. Repeat alot

    My code is as follows (sorry again for no comments):

    import random import math class Data(): def __init__(self, info): self.info = info def readInInfo(self, fname): print("not done yet") def getInfo(self): return self.info def getRows(self): # total # how many tall return len(self.info) def getColumns(self): # rows # how many on wide return len(self.info[0]) def getValueAt(self, rowNum, colNum): return self.info[rowNum][colNum] def getResultForRow(self, rowNum): return self.info[rowNum][len(self.info[rowNum]) - 1] def swish(x): return x * ((1 + math.exp(-1)) ** -1) class AI(): def __init__(self): self.learningRate = 0.05 self.data = [] self.listOfWeights = [] def learn(self, numberOfTests): for cycle in range(numberOfTests): print("\nCycle: %i" % cycle) for rowNum in range(self.data.getRows()): sum = 0.0 inputs = [] for colNum in range(self.data.getColumns() - 1): inputs.append(self.data.getValueAt(rowNum, colNum)) for layer in range(len(self.listOfWeights)): # 3 sums = [0] * len(self.listOfWeights[layer]) # 3 for point in range(len(self.listOfWeights[layer])): for weight in range(len(self.listOfWeights[layer][point])): sums[point] = sums[point] + self.listOfWeights[layer][point][weight] * inputs[weight] inputs = sums for idx in range(len(inputs)): inputs[idx] = swish(inputs[idx]) # UPDATE WEIGHTS sum = sums[0] dif = sum - self.data.getResultForRow(rowNum) print("Dif: %4f : %4f" % (dif, dif * self.learningRate)) for layer in range(len(self.listOfWeights)): for point in range(len(self.listOfWeights[layer])): for weight in range(len(self.listOfWeights[layer][point])): self.listOfWeights[layer][point][weight] = self.listOfWeights[layer][point][weight] - self.learningRate * dif self.printWeights() def predictRow(self, row): sum = 0.0 inputs = [] for colNum in range(self.data.getColumns() - 1): inputs.append(row[colNum]) for layer in range(len(self.listOfWeights)): # 3 sums = [0] * len(self.listOfWeights[layer]) # 3 for point in range(len(self.listOfWeights[layer])): for weight in range(len(self.listOfWeights[layer][point])): sums[point] = sums[point] + self.listOfWeights[layer][point][weight] * inputs[weight] # print(sums) inputs = sums sum = sums[0] value = round(sum) print("Sum: %f" % sum) print("Value: %i" % value) return value def printWeights(self): for layer in range(len(self.listOfWeights)): print("layer%i:" % layer) for point in range(len(self.listOfWeights[layer])): for weight in range(len(self.listOfWeights[layer][point])): print("%.3f " % self.listOfWeights[layer][point][weight], end="") print("") print("\n") def setData(self, data): self.data = data self.listOfWeights = [] count = self.data.getColumns() - 1 while count > 1: layer = [] for i in range(count - 1): temp = [] for j in range(count): temp.append(random.random()) layer.append(temp) self.listOfWeights.append(layer) count = count - 1 def getData(self): return self.data def main(): ai = AI() info = [ [1, 0, 1, 1, 1], [1, 0, 0, 1, 1], [0, 1, 1, 0, 0], [1, 1, 0, 0, 1], [0, 1, 0, 1, 0], [0, 0, 1, 1, 0] # [1, 0, 1, 0, 0] ] data = Data(info) ai.setData(data) ai.printWeights() temp = input("Press [enter] to start learning: ") ai.learn(999) print("\n\nFinal Weights") ai.printWeights() row = [1, 0, 1, 0] # should be 1 print("\n\nTrying to predict the result if this was the data: ") print(row) print("\nPrediction: ") ai.predictRow(row) main() 

    But, it is unable to guess the correct number all the times. Sometimes it gets close, but the current issue is the updating doesn't work because the average difference over all the data gets to 0, and the weights always end up the same after every 'cycle'.

    Also, after more proper research I found a lot of diagrams with something like:

    • 4 inputs
    • hidden layer with 5 'nodes'
    • hidden layer with 7 'nodes'
    • hidden layer with 3 'nodes'
    • output 'node' (1)

    But I don't understand how the total number of nodes increases or how it helps. (Or how to update the weights). I also did not really understand the activation function. I tried using 'swish' activation, but I kind of randomly threw it in, without having much affect on the accuracy.

    Thanks in advance, sorry if the ideas/questions of this post where not articulated well (also very sorry for no comments).

    submitted by /u/LelsersLasers
    [link] [comments]

    What is DevOps roles in a serverless environment?

    Posted: 05 Oct 2021 08:10 PM PDT

    Is it really required? What are the skills and expertise needed for it?

    And also, does reducing costs are still under DevOps responsibilities or should it be on the dev team?

    Many thanks!

    submitted by /u/eplaut_
    [link] [comments]

    How do I set autofocus to an input that's inside a select dropdown?

    Posted: 05 Oct 2021 08:01 PM PDT

    I have an input field inside a select dropdown. I need to focus on that input box as soon as the dropdown is shown when the user clicks on it. I tried using refs, but that doesn't seem to work. I'm using antd 3.26.14 and React 16.8.6. Here is the code:

    <Select labelInValue open={isOpenSelectCategory} onDropdownVisibleChange={onDropdownVisibleChange} placeholder="Select Category" onChange={() => { searchDropdownOptions('formCategories', ''); setCategoryInputValue(''); }} notFoundContent={null} dropdownRender={menu => ( <> <div onMouseDown={lockSelectCategoryClose} onMouseUp={lockSelectCategoryClose} style={{ marginBottom: '10px' }} > <Input value={categoryInputValue} ref={inputRef} onChange={event => { searchDropdownOptions( 'formCategories', event.target.value, ); setCategoryInputValue(event.target.value); }} placeholder="Search category or create new one" /> 

    ... and it goes on

    The useEffect for the Input ref:

    useEffect(() => { if (inputRef.current) inputRef.current.focus(); }, [inputRef]); 

    I've tried variations of the above useEffect, where instead of listening to changes on inputRef, I've listened to the change when the dropdown gets loaded. Neither of them worked though.

    Any help here will be much appreciated...

    submitted by /u/kipboye
    [link] [comments]

    Is there a way for Java to “read” a screen?

    Posted: 05 Oct 2021 07:50 PM PDT

    I'm trying to get a Java robot to automatically solve sudoku puzzles from randomly generated boards, but I don't know a way for it to find the numbers already filled in. I tried using robot.getPixelColor, but the board is too big to write an individual pixel call for each.

    submitted by /u/ArenSic
    [link] [comments]

    How to convert .java to .class in Textpad 8?

    Posted: 05 Oct 2021 06:12 PM PDT

    Hi!

    I have been using Textpad for my into to java course at school. However, I have fallen a bit behind and need to work at home. However, the keyboard shortcuts we used at school (ctrl 1 and 2) to convert and run java files do not work on my version.

    Does anyone know what the correct way to do this is? I have tired checking their forums, but the search is dreadful.

    submitted by /u/No1ofIntrst
    [link] [comments]

    A few questions to developers who work with low-level languages like C++

    Posted: 05 Oct 2021 06:11 PM PDT

    I've worked with Java and React doing some fullstack dev. I've been more and more curious by low-level programming but I have not gotten into it yet.

    • For those that work with C++ or any other low-level language like Rust or Go, what exactly do you do?
    • Do you use any frameworks to help you?
    • If you work in a professional environment, do you use an object-oriented approach or do you start to branch out from that?
    • Most importantly: what advice do you have for those who are looking to transition to low-level development after being a full-stack web dev?
    submitted by /u/imstillmb
    [link] [comments]

    Windows Architecture: Can program windows know when they have focus?

    Posted: 05 Oct 2021 01:34 PM PDT

    Hi, I'm just doing some brain storming. Would anyone mind giving me feedback about what I might or might not understand correctly?

    A long time ago, I think I heard that programs in windows can not tell that they are the "active/in focus" window. Is there any truth to that? I think this factoid came up in a discussion about why a certain behavior couldn't change.

    I was thinking that, for windows, this is what makes "sleeping tabs" (kind of new feature) in browsers special. Because tabs are contained in the browser's framework, the browser is able to intelligently know when a tab is not being used. Also, I read that Windows 11 has an ability to detect an app that is active, and throttle apps that are not (I'm paraphrasing.)

    However, it occurred to me that an app *does* know when it is trying to be shut down, so information between the OS and a program isn't entirely one-way. Edit: I know I'm going down a long road here, but if the things I've said are correct, are there other signals like this that programs can get from the OS?

    That's all, I just wanted to understand how things work a bit more. Thank you!

    submitted by /u/OldNeb
    [link] [comments]

    Live video streaming tech stack

    Posted: 05 Oct 2021 05:05 PM PDT

    How many people can 1 ec2 micro stream incoming video to? I am wondering how expensive is it to build a live streaming platform like twitch? How did they pay for it in the beginning?

    submitted by /u/Party-Suggestion4558
    [link] [comments]

    I'm debating if I want to use fs.writeFile or fs.writeFileSync

    Posted: 05 Oct 2021 10:49 AM PDT

    Do I use fs.writeFile or fs.writeFileSync for big json files I noticed that people use fs.writeFileSync because it saves faster, what are the differences? and which one should I use?

    submitted by /u/ilikeprogamming92
    [link] [comments]

    Amateur here. What language or system would you use to program an app to use on a tablet? The user would be prompted to store answers to questions then store it somewhere.

    Posted: 05 Oct 2021 04:44 PM PDT

    Hi.

    Sorry it's a bit vague so far. Imagine you have to go to a person and examine some part of their life, for a scored result. The app would prompt for questions, allow the user to record answers, refer to an ideal response and score them. Then the results would need to be passed to another database for long term storage. There would need to be a simple to use system to design the questions and scores too. What type of store would you use?

    Web based. Easy to be kept updated in one place, direct link to the database. Dependant on a good connection though.

    App based. As long as you have battery you'll have and be able to use the app. No guarantee that it's the latest version. Have to plug in somewhere to download the data.

    What systems should I consider learning to do something like this? There will be a lot more to it obviously, but in principle? I guess there is already something similar to purchase, there's nothing new anymore, but I'd like to try.

    Thanks.

    submitted by /u/Cheesysocks
    [link] [comments]

    Programming keyboards

    Posted: 05 Oct 2021 07:39 AM PDT

    I'm a full time software engineer, somewhere in the middle of my career (I hope).

    Until now, I've always used whatever keyboard my employer gave me or came with my laptop (or, currently, the keyboard my last-but-two employer gave me, but hey ho).

    I think the time has come for a more serious keyboard. Part of the motivation here is that I've started working in Immersed with an Occulus Quest 2. My touch typing is good, but I'm discovering that locating the home keys on a worn out old Dell keyboard is not as natural as you might hope. The time has come to actually buy a keyboard, and while I'm at it, I might as well get something good.

    So what's good? Are split/sculpted keyboards going to change my life? Are mechanical keyboards all they're cracked up to be? What about the wackier layouts? Are vertical keyboards really that great? Should I forget everything I know and learn to type DVORAK?

    If you could have one keyboard, what would it be and why?

    My basic requirements are that it be easy to type accurately on for long periods and easy to find the home keys by touch. But you might have other requirements I haven't even thought of.

    submitted by /u/Conscious-Ball8373
    [link] [comments]

    Ending Java program with a newline

    Posted: 05 Oct 2021 12:30 PM PDT

    [Edit: solved]

    Hello,

    I'm working on an intro to Java assignment. It's a trajectory modeling program, where the user inputs the speed, and then the distance travelled at various angles is printed. Everything in my code works correctly, up until the end, where I can't seem to figure out how to use %n in order to end the program with a new line. Here's what I have:

    import java.util.Scanner; public class TrajectoryModelingIntro { public static void main(String[] args) { double speed, distance, angle, time; final double START_ANGLE = 25, END_ANGLE = 90, STEP_ANGLE = 5; final double g = 9.8; Scanner scan = new Scanner(System.in); System.out.print("Enter an initial speed: "); speed = scan.nextDouble(); for(angle = START_ANGLE; angle < END_ANGLE; angle = angle + STEP_ANGLE) { time = (2*speed*Math.sin(Math.toRadians(angle)))/g; distance = speed*time*Math.cos(Math.toRadians(angle)); System.out.format("%nAt angle %.2f projectile travels %.2f meters",angle, distance); } scan.close(); } } 

    The issue I'm having is ending the program on a newline. Even though my code does what it needs to do, the automatic grader is still looking for a return at the very end. In the assignment, I'm required to do this by using %n, but I'm struggling with how exactly to do that. When I put %n at the end of my string, it prints a new line in between every printed line, rather than just at the end of the program.

    Thanks so much for any help!

    submitted by /u/Niigo2
    [link] [comments]

    Would a recursive loop generated within a Finite State Machine eventually overflow the stack?

    Posted: 05 Oct 2021 10:09 AM PDT

    To demonstrate this scenario, I wrote a very simplified script that's potentially problematic. Images aren't allowed in the post, but I'll post the links to my mock-script and a little visual to go with it.

    Script: https://imgur.com/a/gz7biRH

    Visual: https://imgur.com/a/aOq9w64

    Basically, I'm building a Finite State Machine, where each state will be populated with relatively large variables (in comparison to the available memory on my device - Arduino Due: 512 KB). My concern is that after a sequence of function calls where I jump from one state to another, I will eventually overflow the stack (Hey that's that website name), since instances of calling functions remain open while called functions are being executed. Additionally, since these variables are stored on stack rather than heap, I can't just free up their occupied space via pointers.

    Is overflowing the stack like this possible? If so, how can I improve my code so that a called function would replace the calling function's position on the stack?

    submitted by /u/fleebjuice69420
    [link] [comments]

    Best metrics (or least bad ones) to gauge programmer productivity?

    Posted: 05 Oct 2021 10:53 AM PDT

    I'm trying to get permission to allow my team to work four-day work weeks (4-8, not 4-10). This would be a huge win! The only way the CEO will let me do this, though, is if I can prove (eye roll) that productivity will stay the same or increase. That means I need to do the thing I hate and apply metrics to my developers' productivity. That's where I'd like your feedback.

    Companies have tried to measure programmer productivity with a thousand different metrics and all of the ones I've seen are complete bullshit. Programming is a creative process and trying to measure the productivity with LOCS or points completed or PRs merged is folly and commonly work against developer morale.

    So in your experience what do you think are the best metrics, or maybe the least bad (or most easily gamed) ones, for measuring productivity?

    submitted by /u/Indy_Pendant
    [link] [comments]

    How to run a js function from a python file?

    Posted: 05 Oct 2021 02:03 PM PDT

    Let's say I have a python file with function A,B,C & a javascript file with function D,E,F I want to set it up when function B runs I want to call function F from js file. How can I do it?

    submitted by /u/GameTime_Game0
    [link] [comments]

    I want to code a character building app for a LARP I am a part of, how hard would this be to do?

    Posted: 05 Oct 2021 07:14 AM PDT

    Hi Everyone!

    I mainly work in the IT/Security part of Computer Science, however I have picked up some programming skills here and there. I am familiar with the basics and have done some Python, Java, and C++ for classes. I am part of a LARP (Live Action Roleplay) game, and thought of an idea for a program I would like to make. To describe my thoughts I would like to lay out how the rulebook works for this game.

    There are not exactly "classes" but there are "titles" which give you access to higher level skill lists. Everyone starts with access to all novice skills, once you acquire the apprentice warrior title you get the apprentice skills, etc etc. The requirements for each title varies, but usually comes down to requiring certain skills and having spent enough exp in certain categories. There are also racial skills that you gain as you level up, which is important to mention because some of those skills give you stats like strength, which can sometimes become a prereq for a title.

    How hard would it be to program a simple character builder? I assume I should use Java for this, but I am not sure what the best approach would be. I would love to talk more about this if anyone has some pointers. I am a bit of a beginner at Java, but I can teach myself some more complex topics if need be.

    submitted by /u/cenzord
    [link] [comments]

    Has anyone in this sub tried turing.com ? If so what are the interviews like ?

    Posted: 04 Oct 2021 10:46 PM PDT

    Looking to apply for node js developer role but i don't know to how to prepare for the interview ? Do they ask questions related to data structures and stuff like that or questions related to web development . Also , is having personal projects on resume a plus point since i'm a fresher .

    submitted by /u/grave_96
    [link] [comments]

    How to read assembly output?

    Posted: 05 Oct 2021 12:24 PM PDT

    Hi,
    our professor gave us a voluntary task in which we should interpret a picture. It has to be said that most of the students have never programmed. I've already programmed, but mainly did Java. In my opinion, this image is the assembly output of an actual program, but I don't know how to interpret it, because I think I know that its heavily dependent on the processor architecture and iirc also the OS.
    Heres the picture for reference
    cmp in the first line compares two values, but %ol is never anywhere definied, does this code even work? If so, how can I determine the information needed to properly understand it?

    submitted by /u/actopozipc
    [link] [comments]

    Do you do your best programming in the wee hours of the morning?

    Posted: 04 Oct 2021 11:49 PM PDT

    I've been coding professionally for decades, and noticed I am many times more productive after midnight.

    It's easy to blame a lack of distractions, but I work from home and there's not that much of a difference. I think it has something to do with being physically exhausted making my mind work better. Who knows though.

    I'm wondering if that's just me or if it's common.

    submitted by /u/13_0_0_0_0
    [link] [comments]

    30-year-old CE student who wants to drop out of college and be self-taught

    Posted: 05 Oct 2021 10:10 AM PDT

    Hi! I'm 30 years old and in my second year of Computer Engineering but I'm currently in a problem.

    For economic reasons this year I am using it to learn web programming in a self-taught way.

    I really like programming and am thinking of dropping out of my (free) university to pursue programming and do personal projects.

    I am interested in learning MERN stack, then Rust and WebAssembly.

    I know that if I continue with my degree I have a chance to get into more complex (and better paying) jobs than self-taught.

    I also think about suspending the university to create an income of passive income (300 USD per month) via web projects to be able to continue studying.

    Will it be worth dropping out of Computer Engineering if I want to go into programming?

    Why do you think I should continue with the degree?

    submitted by /u/BitdiddleBadonkadonk
    [link] [comments]

    Any Game Developper willing to answer some questions for an interview ?

    Posted: 05 Oct 2021 09:40 AM PDT

    I am a student in computer science and I need to do an interview about game developpers in order to eventually be one.

    So here they are :

    • What studies have you done ?
    • How many hours do you work ?
    • What are the cons/pros ?
    • What is your salary ?
    • What has changed about your perspective about this domain since you worked as a GameDev ?
    • How would you rank the difficulty of your work ?
    • How much time do you spend actually playing your game ?
    • Do you work with a small group or a big enterprise ?
    • Do some of your work has been recognized around the world ?

    Thank you for your time and dedication,

    Sincerly,

    A computer science student.

    submitted by /u/Limp-Adagio4274
    [link] [comments]

    No comments:

    Post a Comment