• Breaking News

    Friday, November 26, 2021

    Is it possible to measure spaghettiness of code? Ask Programming

    Is it possible to measure spaghettiness of code? Ask Programming


    Is it possible to measure spaghettiness of code?

    Posted: 25 Nov 2021 10:38 AM PST

    Is it possible to measure spaghettiness of code?

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

    ADHD and Programming / How can I get started?

    Posted: 25 Nov 2021 05:51 PM PST

    Hi, I've actually been "programming" for the better part of the last 4 to 5 years, but almost all of my projects have been in the form of visual scripted things. I found Construct 2 a while back, and after a year of doing almost nothing with it, something clicked, and I somehow discovered what it took to figure things out on my own with it. That's all well and good, but I don't want to make glorified flash games for the rest of my life.

    I had the hope for years that I would launch Unity up one day, and I would have the same eureka moment I did with Construct 2/3, but it's been years, and my ability to code using c# has actually degraded. I remember making a super simple text adventure game in C# with Visual studio back around 2017, and that was the furthest I got with a traditional programming language. I've tried using UE4's blueprint system, Godot's GD script, and even some JavaScript, but nothing has clicked for me. It doesn't help that old Unity tutorials no longer work because of the many changes to the engine in the last few years, and all of this has just left me worried that I will never be able to learn to program anything of quality.

    My hope with this post is that there are folks out there with ADHD who have been where I'm at, and know what made things click for them. If it's a challenge that got things to click, a video, a course, or even tutoring; whatever it is, I want to know. All I've wanted to do with my life for the last 6+ years is make video games, it's my longest lasting hobby / passion, and I don't want to lose it because I was too 'proud' to ask for help.

    Thank you for any suggestions.

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

    Any of you use a projector instead of a monitor to reduce eye strain?

    Posted: 26 Nov 2021 12:43 AM PST

    I wonder how comfortable that is for long periods of programming.

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

    How Operating Systems are Programmed? [Question]

    Posted: 26 Nov 2021 12:40 AM PST

    How Operating Systems are programmed? For example, If I want to build an OS like Linux or Windows, what is an approach to build? How to start basically. For eg., Linus Torvalds had the idea of Linux, how he would have started.

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

    What happens when we do y=2 then x=y in python?

    Posted: 25 Nov 2021 03:11 AM PST

    I was discussing about this in another forum and really got confused. He says this is what happens-: https://i.stack.imgur.com/2elLe.png

    I wrote code to test it.

    y=2 x=y print(id(x)) print(id(y)) 

    Both gives output same(be it whatever).

    So does that mean both are pointing to same object in memory? (At least that is what I learnt from others.)

    The forum guy shows as if they are pointing to different memory location, that got me really confused tbh.

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

    How to get informative data about the smart contract with using API in R Studio

    Posted: 25 Nov 2021 08:19 PM PST

    I want to get informative data about the smart contract with using API.

    I found hash address with using Etherscan. I copied the contract to the R. But I don't know how to get informative data (such as balance, token info etc.)

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

    A new way of distributing software

    Posted: 25 Nov 2021 08:05 PM PST

    I love writing code that compiles down to machine code. I at heart am a systems programmer, and thats what I like doing, but I recognize that having to have separate binaries for each type of system is a drawback. We already have separate binaries for windows linux and mac os, but now we are adding on different architectures to complicate the situation. An obvious solution for me as a programmer is to distribute source code and allow people to compile for the system they are on, but this has problems such as long compile times, but most challenging to me is that non free/opensource code has no chance to be distributed this way.

    This brings me to a shower thought I have had. What if we came up with a new file format that contains an architecture independent intermediate representation. On the first run of the program that code could be compiled and stored for further use.

    With this idea I have some negative sides, I believe install times would definitely be longer, since it would have to compile, but it would run once, and I would hope that the intermediate representation could be designed in such a way to cut down compile times. Also the design I thought of would use more disk space since it would store a ir and the binary, but I think it is essential to maintain the ir so that the code can be handed off to other people to use, but maybe I am wrong. I also think that different versions may still need to exist for different os's, but maybe there are ways around this.

    There are some obvious pros to me. Suddenly we would not need to worry near as much if a program was compiled for arm, x86, risc-v, or even some new exotic isa that we have not thought of yet. I think optimizations could still be handled in a preprocessor type fashion plus I believe that we could have the code compile for the specific machine it is on instead of it needing to be more generalized. This would make things like SIMD optimizations able to be used in all programs (although I do think Gentoo has shown this to not be a huge advantage). I even think that it would make it easier for chip manufacturers to implement exotic instructions since they would need compiler support and not necessarily developer support. This design would also make introducing new exotic isa's alot more realistic because they would not need specific support. Finally I really like this design since it could be language independent as long as it can compile to an ir, so any LLVM language!

    All this is just shower thoughts that I wanted to get off my mind into writing, and see if something like this already exists, or if anyone has further thoughts about it.

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

    Detecting Characters in an Input

    Posted: 25 Nov 2021 07:18 PM PST

    I want to make if conditions that executes a function after detecting what the input's first letter is and another for the last letter.

    How do I do it?

    What if I wanted to detect the second letter? How about the penultimate letter?

    I've never studied JavaScript academically, only self-study.

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

    Python basics help

    Posted: 25 Nov 2021 06:51 PM PST

    Hello, I have a Python subject and I missed a lesson, I learn fast it's just I missed a lesson

    anyone can help me with these?

    Any help would do as I would just run the code myself

    https://imgur.com/a/0oAlMW1

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

    Express validator validate array of objects

    Posted: 25 Nov 2021 01:26 PM PST

    I'm currently trying to make a Quiz. Each question has a certain required answers.

    https://stackoverflow.com/questions/70063405/express-validator-validate-array-of-objects

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

    Programming in English

    Posted: 25 Nov 2021 12:57 PM PST

    How important is English for learning to program? I'm asking about variable names and making the code readable, not keywords and obligatory English usage

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

    Flutter vs React Native for a java programmer

    Posted: 25 Nov 2021 03:17 PM PST

    I am trying to create an app, and I have taken a few years of CS in my high school in which I have only learned Java. I was wondering which between Flutter and React Native would be the easiest for me to transition to. Pros and cons would be helpful too. TIA!

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

    Seeking job advise as an 18 year old soon-to-be high school grad

    Posted: 25 Nov 2021 02:27 PM PST

    Hello r/AskProgramming. I am an entirely self-taught 18 year old programmer who is just nearing the end of high school. I'm extremely passionate about programming with about 5 years experience truly programming, and have over a decades experience with computers and servers in general. I would say that I specialize in React/JS, HTML, and CSS. I've built a commercially used eCommerce site in it from scratch that has run with no issues, as well as several side projects. Secondary to my frontend experience, I am proficient in Go and Rust, and have built REST APIs as well as desktop applications with them before. I am always willing to learn new technologies. I can link my GitHub if you are interested or it will help you better answer my question.

    Now onto the question: where should I be looking and what should I be doing to get employed? I want to jump right into this industry after high school. Do my aforementioned skills seem like enough to at least pique the interest of any potential employers? My two biggest problems, I believe, are my lack of any professional experience that involves working in teams, as well as my lack of any formal education for development. I'm seeking advise for things that I could add to my resume, as well as places I should be sending my resume. Should I be looking for a company that could essentially "take me under their wing" and train me to work in a professional setting? An internship? A junior development position?

    Sorry for how this post is formatted, it's just a jumble of my thoughts on this issue. Thank you so much if you took the time to read this, and even more so if you took the time to answer it.

    -Laz

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

    How to make a script to close and reopen a program after I hit a certain amount of function keys.

    Posted: 25 Nov 2021 12:11 PM PST

    Hello! I recently have been using a program to play funny sounds in discord calls with friends. but it only lets you play them a certain amount of times before restarting. I was wondering if It was possible to have a script that closes and reopens it after I hit my specific hotkeys 10 times. Thanks in advanced for any help/comments!

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

    How do you gauge, whether "build-up" to open source contributions is too much vs building your own?

    Posted: 25 Nov 2021 11:24 AM PST

    How do you gauge, whether "build-up" to open source contributions is too much vs building your own?

    build-up: the amount of time and effort that's required to learn up to the level of being actually able to implement what one needs.

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

    Should I use c++ instead of java for time complexity analysis?

    Posted: 25 Nov 2021 10:55 AM PST

    Hey, so I have to submit my project for my algorithm class by the end of the month. So, I chose to analyse the time complexities of different sorting algorithms when given a huge array. For instance, comparing quick sort,heap sort and binary tree inorder traversal execution time. Yes they all have the same big-o complexity but I've read that the constant look up times are different for various algorithms. So my idea is to feed in huge arrays of variable sizes and record their execution time and compare them via graphs.

    So my question is, Is it okay if do this in java ? I'm most comfortable with java but since c++ is much faster I wonder if the time taken to execute will be different. Also like I don't have much experience with c++. What do you guys think ? Will language matter ?

    Also like since I don't have any good projects to show in my cv, will this be a good one to add?

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

    while True(): TypeError: 'bool' object is not callable

    Posted: 25 Nov 2021 10:21 AM PST

    I was trying to follow along to a ping pong python tutorial (on version 3.7.4) using its built in software: Turtle but when ive followed along to a certain step, the code starts to bug out? The highlighted in bold part is where it started to give me errors, here is the code:

    import turtle

    wn = turtle.Screen()

    wn.title("PythonPingPong")

    wn.bgcolor("white")

    wn.setup(width=800, height=600)

    wn.bgcolor("black")

    #Paddle 1

    Paddle = turtle.Turtle()

    Paddle.speed(0)

    Paddle.shape("square")

    Paddle.color("white")

    Paddle.shapesize(stretch_wid=5, stretch_len=1)

    Paddle.penup()

    Paddle.goto(-350, 0)

    #Paddle 2

    Paddle1 = turtle.Turtle()

    Paddle1.speed(0)

    Paddle1.shape("square")

    Paddle1.color("white")

    Paddle1.shapesize(stretch_wid=5, stretch_len=1)

    Paddle1.penup()

    Paddle1.goto(350, 0)

    #Ball

    Ball = turtle.Turtle()

    Ball.speed(0)

    Ball.shape("circle")

    Ball.color("white")

    Ball.shapesize(stretch_wid=1, stretch_len=1)

    Ball.penup()

    Ball.goto(0, 0)

    Ball.dx = 2

    Ball.dy = 2

    #functions

    def Paddle__up():

    y = Paddle.ycor()

    y += 20

    Paddle.sety(y)

    def Paddle__down():

    y = Paddle.ycor()

    y -= 20

    Paddle.sety(y)

    #functions B

    def Paddle1__up():

    y = Paddle1.ycor()

    y += 20

    Paddle1.sety(y)

    def Paddle1__down():

    y = Paddle1.ycor()

    y -= 20

    Paddle1.sety(y)

    #Keyboard Binding / keybinds

    wn.listen()

    wn.onkeypress(Paddle__up, "w")

    wn.listen()

    wn.onkeypress(Paddle__down, "s")

    #Keyboard Binding / keybinds B

    wn.listen()

    wn.onkeypress(Paddle1__up, "Up")

    wn.listen()

    wn.onkeypress(Paddle1__down, "Down")

    #Main game loop

    while True():

    wn.update()

    #move ball uwu

    Ball.setx(Ball.xcor() + Ball.dx)

    Ball.sety(Ball.ycor() + Ball.dy)

    When using the code it gives me the error:

    line 78, in <module>

    while True():

    TypeError: 'bool' object is not callable

    Anyhelp with this and maybe a updated piece of code for it to work would be greatly appreciated and much help! Thanks.

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

    Tips for reversing this statement

    Posted: 25 Nov 2021 04:12 AM PST

    I have the following statement which calculates each value of an unsigned int array of 4 elements, given a 19 character string

    const unsigned int constants[] = { 0x5F5, 0x4E8, 0x185C, 0x1CAD }; 

    char *userKey = "AAAAAAAAAAAAAAAAAA";

    for (int idx = 0; idx < 0x13; ++idx) { calc_array[idx % 4] += ((idx ^ (constants[idx % 4] / 4) ^ (userKey[idx] * userKey[idx])) + 0xFFFFFFF) % 0x3E8; }: 

    gives the following result calc_array[0] = 0xFF, calc_array[1] =0x134D, calc_array[2] =0x48F, calc_array[3] =0x7F8 . My question is can I reverse this statement so that given, say 0xFF I can revert back to the letter 'A'?

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

    Duplicate attribute error in XML file?

    Posted: 25 Nov 2021 07:44 AM PST

    I'm currently working on my camera application on Android studio (in Kotlin) and upon running my code, I get one error that prevents it from launching. my build output prints this; AAPT: error: duplicate attribute. In fact, the problem is rooted in my activity_main.xml file. Here is the code for that file, where I'll point out the error.

    <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <RelativeLayout android:id="@+id/parentLayout" android:layout_height="match_parent" android:layout_width="match_parent"> <androidx.camera.view.PreviewView android:id="@+id/PreviewView" android:layout_height="match_parent" android:layout_width="match_parent"/> </RelativeLayout> </layout> 

    Any further information needed to supplement this question will be provided upon request.

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

    No comments:

    Post a Comment