• Breaking News

    Thursday, September 24, 2020

    What's your favorite 64 bit magic number? Ask Programming

    What's your favorite 64 bit magic number? Ask Programming


    What's your favorite 64 bit magic number?

    Posted: 24 Sep 2020 12:46 PM PDT

    I'm looking for a 64- bit steam delimiter and was thinking 0xFEEDBABEDEADBEEF, but was curious what your favorites are, especially if there's a reason or story behind it.

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

    Which os for progrmming?

    Posted: 24 Sep 2020 08:39 PM PDT

    Can anyone tell me which os is best for programming especially Python stuff?

    I use ubuntu 20.04 LTS right now but I'm getting bored from the desktop environment of ubuntu and it's heavy.

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

    How has there been no malicious mods for games like Cities: Skylines?

    Posted: 24 Sep 2020 04:57 PM PDT

    I'm currently working on a modding system for a game in C#, which allows the user to load their own C# mod assemblies into the game (akin to how Rimworld and Cities: Skylines does it). My biggest concern is the fact that unsafe code can obviously be executed in this manner, and after doing some research I realised that Rimworld and Cities: Skylines don't really prevent malicious code from being executed as far as I can tell.

    Is there a way to prevent unsafe code from being loaded? How has Rimworld and Cities: Skyline gone for years without a single malicious mod? Because I don't exactly trust the good will of the internet

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

    Conway's game of life initial state

    Posted: 24 Sep 2020 07:55 PM PDT

    As a little project, I want to implement the game of life in c++ using sdl. How should I use an int (seed) to populate my initial grid? Like, how should I generate the first cells on the windows using a random integer (I don't have a problem generating a random number, I just need to know how to use it to generate positions for the initial living cells )

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

    How good will I be in 3 years if I practice programming 2 hours a day every single day?

    Posted: 24 Sep 2020 07:29 PM PDT

    Im a beginner in programming and I would like to learn AI, ML, DL, web, security, mobile app and game development and I have all my life to do so. Im just wondering where I can be in 3 years from now. Im also learning unity for game development 2 hours a week.

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

    What's the best resource out there for learning modular Javascript?

    Posted: 24 Sep 2020 06:53 PM PDT

    I've recently come across a "web developer roadmap" that recommends learning modular javascript, and I've watched a few YouTube videos and a course on how it works, but I can't wrap my head around this or how I could use it in my own code.

    Most of the tutorials give information that's totally different from the previous tutorial. For instance, the module formats used in each tutorial differ, and the implementation of the modules in each differ as well. I'm getting confused on exactly what the right approach is for building and implementing modules in my code.

    Is there a resource that encapsulates how you'd use modules in a modern Javascript application (I.e. how modules would be used in a legitimate job)?

    It would be amazing if there's a course/video series out there that walks you through step-by-step building out an application (even if it's small) showing you the best way (or rather, the most common way) of building and using modules, how to think about structuring your code in a modular format, etc.

    Any help here is extremely appreciated. Thanks!

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

    Any good source of data to practice KNN?

    Posted: 24 Sep 2020 06:46 PM PDT

    I want to practice classification with kNN but I need ideas on what kind of data might help me practice.

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

    Very beginner question on for loops/accumulator

    Posted: 24 Sep 2020 06:44 PM PDT

    My teacher wrote code to square a number using a for loop and accumulator and did not explain it so im coming to reddit for help.

    Here is the code:

    def square(x):

    runningtotal = 0

    for result in range(x):

    runningtotal = runningtotal + x

    return runningtotal

    I tested this and it works, but i don't get how. Say i were to square 3, since it is range(3) wouldn't it be first be runningtotal = runningtotal + 0, then runningtotal = 0 + 1, then runningtotal = 1 + 2. This equals 3, which is obviously wrong. Where is my misunderstanding, thanks.

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

    An alarm clock with specific functions for a student with an IEP?

    Posted: 24 Sep 2020 12:37 PM PDT

    Hi all!

    I've asked for stuff in the past here and you've been super helpful. I don't know if this is the right place to ask this, so I apologize in advance if it is.

    I am a fourth grade teacher dealing with the realities of distance learning. It's NUTS. I have a student who has an IEP (a special ed student). Her disability makes reading comprehension and language very difficult.

    She doesn't have parents at home during the day that can help her and so she's really struggling to keep all of our zoom calls straight. She frequently misses them. Time management is hard for all fourth graders, but for her it's exponentially more challenging.

    I am wondering if there's some sort of alarm clock or alert system that can be scheduled to go off at certain times of the day depending on the day, that can be scheduled in advance. She doesn't have an iphone, and even an iphone needs to be set daily. I am looking for something that could have a "weekly schedule" where the alarms would go off at different times on different days. This weekly schedule will be the same over time, so it's something that could be scheduled and then left alone.

    Here are some things to keep in mind:

    She is using a chromebook

    She doesn't have a google calendar, and even if she did I think that would be too complicated.

    Whatever this is would need to be SUPER simple. Something her mom can set up for her once and then not have to deal with later. I think having it be an app or something that she opens daily is about as complicated as it can get or else it won't work. If you haven't spent much time around kids, imagine someone who is able to do VERY little independently, and so any potential tech issue that can get confusing will get confusing.

    The reason I use the term alarm clock is because ideally it's something that makes a sound and doesn't stop making a sound until it gets turned off. I think if it's just a text alert that pops up and goes away that may not be sufficient.

    Does this make sense? Is there anything you know of? Thank you so much!

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

    When do you make a new branch?

    Posted: 24 Sep 2020 05:42 PM PDT

    So I have just "published/deployed" my first project that will be used by the public. It is a webapp so changes are immediately visible. There are a bunch of small changes that I would like to continue working on but it is in a state that was usable so out it went. Now I am not sure how often to create new branches or just commit to the master. For instance there are a few changes that will only take an hour or two. Is it even worth it if the whole thing will be completed in one commit? If I was planning something of a larger update that spans a few day is it worth it then? Even if I am only programing on a single computer then pushing to Github once the changes are done and tested locally? How does everyone else handle branches for gits with a single developer?

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

    Which programming related competitions are coming up for teenagers?

    Posted: 24 Sep 2020 08:22 AM PDT

    I mean competitions only for people below the age of 18.

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

    C# programming

    Posted: 24 Sep 2020 09:26 AM PDT

    Hi guys, I am fairly new to c# and I am trying to write a code for a certain task but I am stuck in one place and can not figure out how to fix it. Help would be appreciated

    Here is the problem: I am not sure how to use my returned value max in another method. I know that it is possible to do everything in one method but I need to seperate ones.

     public double Max (List<Hero> hero) { double max = 0.0; foreach (Hero h in hero) { if (h.health > max) max = h.health; } return max; } public static List<Hero> MostHp(List<Hero> list) { List<Hero> MostHp = new List<Hero>(); Hero most = list[0]; // Finds hero with highest health for (int i = 1; i < list.Count; i++) { if (list[i].health == ) { MostHp.Add(list[i]); } } return MostHp; } 
    submitted by /u/Petka7
    [link] [comments]

    Pretty sure I'm making a very dumb mistake with cv2 and contours

    Posted: 24 Sep 2020 01:38 PM PDT

    import cv2
    import numpy as np

    Source = cv2.imread('WorkSpace/Source.png')
    SourceGray = cv2.cvtColor(Source,cv2.COLOR_BGR2GRAY)

    def getContours():
    contours,hierarchy = cv2.findContours(SourceGray,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)
    for cnt in contours:
    cv2.drawContours(SourceGray, cnt, -1,(255,0,0),3)

    getContours()
    cv2.imshow("contours",SourceGray)
    cv2.waitKey(0)

    despite this, the contours arent being drawn on the image. I swear I've tried everything, so whats up?

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

    Can someone please explain how the hell to use gridpane?

    Posted: 24 Sep 2020 01:08 PM PDT

    https://www.youtube.com/watch?v=B18NkOdulHM

    i got the coordinates from this, but it never lines up like that.

     g1.setConstraints(email, 5, 0); g1.setConstraints(emailText, 5, 1); g1.setConstraints(password, 5, 3); g1.setConstraints(passwordText, 5, 4); 

    and it just looks like this

    https://imgur.com/a/rFI4CgU

    i dont fucking understand whats going on

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

    I cant import a background in pygame

    Posted: 24 Sep 2020 01:00 PM PDT

    Hello i am following a pygame kids can code tutorial and i can not import background if you could please tell me how to do this that would be great, this is the code:

    import pygame

    import random

    from os import path

    img_dir = path.join(path.dirname(__file__), "img")

    width = 480

    height = 600

    FPS = 60

    #define colors

    white = (255, 255, 255)

    black = (0, 0, 0)

    red = (255, 0, 0)

    green = (0, 255, 0)

    blue = (0, 0, 255)

    yellow = (255, 255, 0)

    # initialize pygame and create window

    pygame.init()

    pygame.mixer.init()

    screen = pygame.display.set_mode((width, height))

    pygame.display.set_caption("shmup")

    clock = pygame.time.Clock()

    class player(pygame.sprite.Sprite):

    def __init__(self):

    pygame.sprite.Sprite.__init__(self)

    self.image = pygame.Surface((50, 40))

    self.image.fill(green)

    self.rect = self.image.get_rect()

    self.rect.centerx = width/2

    self.rect.bottom = height - 10

    self.speedx = 0

    def update(self):

    self.speedx = 0

    keystate = pygame.key.get_pressed()

    if keystate[pygame.K_LEFT]:

    self.speedx = -5

    if keystate[pygame.K_RIGHT]:

    self.speedx = 5

    self.rect.x += self.speedx

    if self.rect.right > width:

    self.rect.right = width

    if self.rect.left < 0:

    self.rect.left = 0

    def shoot(self):

    bullet = Bullet(self.rect.centerx, self.rect.top)

    all_sprites.add(bullet)

    bullets.add(bullet)

    class Mob(pygame.sprite.Sprite):

    def __init__(self):

    pygame.sprite.Sprite.__init__(self)

    self.image = pygame.Surface((30, 40))

    self.image.fill(red)

    self.rect = self.image.get_rect()

    self.rect.x = random.randrange(width - self.rect.width)

    self.rect.y = random.randrange(-100, -40)

    self.speedy = random.randrange(1, 8)

    self.speedx = random.randrange(-3, 3)

    def update(self):

    self.rect.x += self.speedx

    self.rect.y += self.speedy

    if self.rect.top > height + 10 or self.rect.left < -25 or self.rect.right > width + 20:

    self.rect.x = random.randrange(width - self.rect.width)

    self.rect.y = random.randrange(-100, -40)

    self.speedy = random.randrange(1, 8)

    class Bullet(pygame.sprite.Sprite):

    def __init__(self, x, y):

    pygame.sprite.Sprite.__init__(self)

    self.image = pygame.Surface((10, 20))

    self.image.fill(yellow)

    self.rect = self.image.get_rect()

    self.rect.bottom = y

    self.rect.centerx = x

    self.speedy = -10

    def update(self):

    self.rect.y += self.speedy

    # kill if it moves off the top of the screen

    if self.rect.bottom < 0:

    self.kill()

    #load all game graphics

    background = pygame.image.load(path.join(img_dir, "starfield.png")).convrert()

    background_rect = background.get_rect

    all_sprites = pygame.sprite.Group()

    mobs = pygame.sprite.Group()

    bullets = pygame.sprite.Group()

    player = player()

    all_sprites.add(player)

    for i in range(8):

    m = Mob()

    all_sprites.add(m)

    mobs.add(m)

    #game loop

    running = True

    while running:

    #kepp loop running at the right speed

    clock.tick(FPS)

    #process input(events)

    for event in pygame.event.get():

    #check for closing window

    if event.type == pygame.QUIT:

    running = False

    elif event.type == pygame.KEYDOWN:

    if event.key == pygame.K_SPACE:

    player.shoot()

    #update

    all_sprites.update()

    # check if a bullet hit a mob

    hits = pygame.sprite.groupcollide(mobs, bullets, True, True)

    for hit in hits:

    m = Mob()

    all_sprites.add(m)

    mobs.add(m)

    # check to see if a mob hit the player

    hits = pygame.sprite.spritecollide(player, mobs, False)

    if hits:

    running = False

    #draw / render

    screen.fill(black)

    screen.blit(background, background_rect)

    all_sprites.draw(screen)

    #afrer drawing everything, flip the display

    pygame.display.flip()

    pygame.quit()

    and this is the error message:

    Traceback (most recent call last):

    File "C:\pygame shmup\game.py", line 97, in <module>

    background = pygame.image.load(path.join(img_dir, "starfield.png")).convrert()

    pygame.error: Couldn't open C:\pygame shmup\img\starfield.png

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

    Windows Database Application

    Posted: 24 Sep 2020 07:46 AM PDT

    Hey everyone!

    I am looking to build a desktop application to help me track worship information for my church (hymns used, sermon topics, Scripture passages used, etc.) that I can then pull reports on (I am the pastor). I used to work in IT and did some programming in Visual Basic 6.0 and web development with ASP, PHP/MySQL. I know I am a little out of practice with the newest programming languages and I do not have a ton of time to learn something like C++. This program will just be for my own use. I am trying to figure out what might be the easiest way to get started.

    Once upon a time, I played around with RealBasic and LiveCode, but I am not sure either exists anymore. I appreciate any advice or ideas. And if it helps, the main reason I am looking at making this a desktop app instead of a web app is I do not want to have to deal with the security needs for a web app. Not that any of the information is sensitive, but having worked in web development I know that once something goes live online it is not long before someone is trying to hack into it, and I just don't want to spend time dealing with that.

    Oh, and I am running Windows 10, so I would obviously want something that works on Windows or is cross-platform compatible. Thanks so much!!

    RevM

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

    Can you tell what program something is written in by looking at the site?

    Posted: 24 Sep 2020 07:18 AM PDT

    https://www.eatthismuch.com/

    Looking at building a project app similar to this with option. Thinking about building it in java for the GUI.

    My question is, can you tell what language this is written in? I guess you could do similar in python or some sort of JavaScript but it takes sometimes 2-3 minutes to create so I'm confused on why the lag and how would you avoid that? Or is that more because of the communication on a server. This is not for any business usage just for learning. Thanks!

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

    What are some other good examples of dogfooding products?

    Posted: 24 Sep 2020 07:08 AM PDT

    Really interested in this niche field but cannot think of any more other than the following:

    • Basecamp using basecamp to make basecamp
    • Using Sublime Text to develop Sublime Text
    • The team at Elementary OS using Elementary to develop it

    I'd love to know more examples of this phenomenon especially in smaller tech businesses as opposed to MS, Apple etc..... Thanks!

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

    Veteran programmers of this sub, what's something a newbie programmer who's straight out of college thought you?

    Posted: 24 Sep 2020 06:06 AM PDT

    Need help simplifying code.

    Posted: 24 Sep 2020 09:32 AM PDT

    I was here not too long ago with this same chunk of code. I am new to coding in general, and I am working on this chunk of code for a course that I am currently taking, the code seems to work fine in the condition it is currently, although I can tell that there is most definitely some ways I could have simplified the code even further. I would appreciate it if some people with experience could pick through this code and tell me methods that they might use to make the code a bit less complex.

    https://paste.ofcode.org/7bbY9xup2d75imW9Vv95Gv

    Edit 1: Before my brain-fart gets pointed out, I already changed the totaling method to use the constants I declared.

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

    Self Learning viable option?

    Posted: 24 Sep 2020 08:30 AM PDT

    Hello, so I want to transition to web development from a not related career(I know one of many). Anyway, I was thinking of taking on a coding bootcamp but decided to star learning by myself. So I was wondering what is a good curriculum to go by. I was thinking on starting with CS50 Introduction to computer science course(including algorithms and structures) on Edx. After that start with the basics like HTML,CSS and JavaScript and so on. Is that a good idea? Also I'm going to use Freecodecamp and the odin project but is that enough to get started? After i get more knowledge i want to start practicing with code wars, Project Euler, etc and start building my portfolio. Anyway, is that a good curriculum to follow or should I do the coding bootcamp? Is learning by myself a good path to web development? Thanks!

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

    Is InspiroBot using a neural network ?

    Posted: 24 Sep 2020 02:20 AM PDT

    Its description says that it's artificial intelligence. Can it be a neural network ? https://inspirobot.me

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

    Trouble understanding why I'm getting an endless loop.

    Posted: 24 Sep 2020 08:12 AM PDT

    working on this LC problem https://leetcode.com/problems/longest-substring-without-repeating-characters/

    If you want to copy and paste my attempted solution into the ide you'll see my error, I believe it's an endless loop. Anyone see the issue with my algorithm, I tried tracing the stack but it seems correct.

    class Solution: def lengthOfLongestSubstring(self, s: str) -> int: if s == "": return 0; if len(s)==1: return 1; uniqueCharacters={} listOfSSL=[]; i=0; while(i<len(s)): if s[i] in uniqueCharacters: listOfSSL.append(len(uniqueCharacters)); i=uniqueCharacters[s[i]]+1; uniqueCharacters.clear; else: uniqueCharacters[s[i]]=i; i+=1; return max(listOfSSL); 
    submitted by /u/cudibert
    [link] [comments]

    Booleans or Bools?

    Posted: 24 Sep 2020 04:07 AM PDT

    We call string literals as "strings" for short.

    We call number literals (I'm not a native speaker; probably it should be "numeric literals") as "numbers" for short.

    What is the short form to call Boolean literals? Booleans or Bools? For some reason, Chrome underlines "Booleans" as wrong.

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

    No comments:

    Post a Comment