• Breaking News

    Sunday, July 19, 2020

    If you've ever programmed a deliberately toxic feature into a popular program (minor or major) how did it feel? Did you care? Ask Programming

    If you've ever programmed a deliberately toxic feature into a popular program (minor or major) how did it feel? Did you care? Ask Programming


    If you've ever programmed a deliberately toxic feature into a popular program (minor or major) how did it feel? Did you care?

    Posted: 19 Jul 2020 06:05 PM PDT

    Gross features like:

    Spotify, and plenty of other apps automatically running on start-up, whether you asked for it or not.

    Chrome, Twitch, or Bittorrent simply minimising by default when you click the big red fucking close button.

    Windows repeatedly installing Candy Crush and other games without asking, or trying its absolute damn best to upload and sell/use your data.

    Plus any number of awful features in smaller programs that need money/reach even more, like the classic "install extras" that would change your home page and search provider in the middle of an install wizard that you might not be paying too much attention to, especially if you're inexperienced online.

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

    What do you use to draw/write charts/tables/numbers/code when coming up with an algorithm?

    Posted: 19 Jul 2020 09:33 AM PDT

    I use MS Paint and I do stuff like this in there https://imgur.com/a/45xQzEc , and I think its really not the best idea, that there's a better solution, but I don't know about any

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

    Python for loop code issue.

    Posted: 19 Jul 2020 06:20 PM PDT

    I have a piece of code that I'm trying to understand why It prints out what it does.

    Here is the original code:

    ``` greeting = 'Hello!' for letter in greeting: count += 1 if count % 2 == 0: print(letter) print(letter) print('done') ``` 

    When I run the code I get : H e e l l l o ! ! done

    What I don't understand is why when I remove the second print statement outside the if statement.I get: e l ! done

    From what I understand it prints outs ( e l ! ) because these elements indexes when divided by 2 meets the condition that the remainder must be 0. But how the modulus operation alters the output of Hello! if its not referencing the iterator ( letter ) I have no clue.

    Finally, Wouldn't it make sense for the full output to be: e l ! H e l l o ! since the if statement is executed first?

    Edit: Forgot to add a variable

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

    Logic needed for a deserialiser's array tokens parser

    Posted: 19 Jul 2020 05:40 PM PDT

    Hi all. This is a continuation from this post. TLDR, I'm making a (de)serialiser using/for the Sprak programming language by u/e_svedang. I'm very close to finishing as I've already made the serialiser, the tokeniser for the deserialiser, and parsers for bool, string and number type tokens. However, I'm stuck on how to parse array types. Specifically, I'm not sure how to handle initialising the array(s) and also scopes (for nested arrays). I'd really appreciate any advice on how I should continue. Here's my progress on it so far.

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

    How do you just "know" when to use a stack?

    Posted: 19 Jul 2020 05:36 PM PDT

    I've been working on this common leetcode problem here: https://leetcode.com/problems/valid-parentheses/solution/. The solution explains why counting/iterating doesn't work, but then immediately jumps to a stack being the solution without explaining how you inherently know a stack IS the solution.

    So for me, I tried a few different algorithms before giving up and going with the stack. There was always a niche case that didn't evaluate correctly or would have taken an entirely extra side evaluation to fix it. Anyways, the problem is that I didn't really learn anything. I never learned why a stack worked so well.

    Can anyone help me understand why the stack (or FILO) "just worked" instead of why other options didn't work? My instincts are telling me a stack can inherently prevent multiple evaluations when trying to solve some type of common problem.

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

    How are bot crawlers made?

    Posted: 19 Jul 2020 01:07 PM PDT

    For example, if I want to create a bot that will make multiple google searches every single minute and will take some info from there.

    How to create it in a way that it won't get banned or something like that please?

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

    How would you program this?

    Posted: 19 Jul 2020 07:24 PM PDT

    Greetings!

    New to programming. I started learning Python at the beginning of the lock-in and now I have a decently scoped, self-prescribed project, but am not totally sure about the most efficient way to store and pull the information and could use a nudge in the right direction. I'm looking to build a website for a small bicycle store that would allow a small group of its management team to change inventory that had multiple characteristics that all need to be able to be tracked, changed, and visually graphed.

    For example: Bicycle store wants to keep track of:

    • Total number of bicycles in inventory
    • How many bicycles of each of the 12 brands the store carries
    • How many bicycles of each of the 10 colors the store offers
    • Where in the inventory each bicycle is (named of numbered sections)
    • Which staff member constructed and placed the bicycle in inventory
    • The date in which the bicycle was first constructed.
    • Searchable comments or company quotes about the bicycle; "refurbished", "small dent", etc.

    This bicycle store also wants to be able to change any aspect of this inventory whether it be the color, location, brand, or date related to each bicycle. The manager, for example, would be able to log into the website, see a graphed inventory of how many bicycles they had in stock, click into a particular section of inventory, and change a listed green Company A branded bicycle to a blue Company B branded bicycle as well as the date constructed. Or they'd be able to easily see a list of all of the purple bicycles, or a list of all of the bicycles in the west storage bay.

    One very important aspect of this project is that after a big sale, the manager would need to be able to go into a section of the store's inventory, delete or clear all of the inventory numbers, and begin ordering more bicycles to fill their demands. But each part of the store can only have a certain number of bicycles of each brand and each color in every section of their inventory, so when a section is cleared out after sale they need to be want to be able to repurchase bicycles of each color and brand and to fill the inventory slots in the same way they previously were. They also want to be able to change these inventory parameters with the sale seasons to have more bikes in one section, and the next season to have fewer in the same section and have it within the parameters.

    To my newbie mind this is not an overwhelming difficult structure, but I'm not sure exactly which path to start down to achieve this. I'd like to stick with Python if possible given the object-oriented nature of this project - plus its the only language I have any familiarity with.

    Can anyone out there help me? I'd greatly appreciate it and will gladly pay it forward when the time comes. And thank you for reading all of that. Cookie for you.

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

    <li> not lining up under <p>

    Posted: 19 Jul 2020 06:17 PM PDT

    Hi guys,

    Fairly new to this, just been practising projects on FCC and stuff and I'm a little stuck.

    I have centred my <main> in the middle of the page. :

    main{border: solid 2px black;width: 40%;margin: 0 auto;

    And also centered my div class <forms>:

    .forms{width: 40%;margin: 0 auto;}

    Which is all perfect, but the issue I'm having is that the input list within this are also centred and not aligned with the paragraph above it.

    Eg:

    What would you prefer to eat?

    -kebab

    -pizza

    -noodles

    I'm trying to get the list to line up with the "What" in the question.

    How do I go about doing this?

    --edit--

    Reddit formatted my post and put the list under the "What". Which is what I'm trying to do, whereas the list is centred to the paragraph and sitting in the middle of it.

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

    looking for nonogram solver algorithm / pseudocode

    Posted: 19 Jul 2020 01:21 PM PDT

    i want to build solver to practice programming, but all i find is ready codes or long pdfs without the actual algorithm. anyone has good source for it?

    looks like the wrong sub lol please redirect me if possible

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

    Trying to make the biggest dictionary

    Posted: 19 Jul 2020 04:13 PM PDT

    Hi, I'm trying to make the biggest library. I'm trying to get every word possible from A-Z with a max word size of 6 for now. Even words such as A, AA, AAA, AAAA, etc need to be in the file. This is what I came up with:

    MAXLETTERS = 6

    fil = open(r"c:\Users\A#h$2s\Documents\woorden.txt","w")

    def makewords(LETTERS):

    woord = []

    for i in range(LETTERS):

    woord.append('a')

    READY = False

    while(not READY):

    fil.write("".join(woord)+'\n')

    #print "".join(woord)

    #sys.stdout.flush()

    woord[LETTERS-1] = chr(ord(woord[LETTERS-1])+1)

    for i in range(len(woord)-1):

    if woord[LETTERS-i-1] > 'z':

    woord[LETTERS-i-1] = 'a'

    woord[LETTERS-i-2] = chr(ord(woord[LETTERS-i-2])+ 1)

    if woord[0] > 'z':

    READY = True

    for i in range(MAXLETTERS):

    print("Letters:"+str(i+1))

    makewords(i+1)

    fil.close()

    But I still want some other things to happen and I don't know how to do it...
    1. I want it to show the loading time or calculate the appreciate time it would take to load everything.
    2. I want it to go into a word file and not a txt file.
    3. I believe it's running on a single core right now and want to let it run on all my cores of my PC (6 in total)

    I don't know if anyone wants/knows how to help me out with these things but if you can, thank you very much.

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

    coding help with IF and ELSE

    Posted: 19 Jul 2020 08:40 AM PDT

    i'm trying to figure out a else command and can't seem to get my code to run with it. trying to have it display a error message if a number isn't input into the prompt. here's my code i have so far:

    #include <stdio.h>
    int main () {
    /* variable definition: */
    int count;
    double total,vacations, amount, sum;
    // Loop through to input values
    printf("Enter the number of vacation taken this year: ");
    scanf("%lf", &vacations);
    while (count < vacations) {
    printf("Enter total amount spent on hotels for this vacation: ");
    // use %lf for double
    scanf("%lf", &amount);
    if (amount >= 0) {
    sum = sum + amount;
    count = count + 1;
    else
    printf("Not a valid input");
    }}
    // Calculate total
    total = sum;
    printf("Total amount spent on hotels this year is: $%.2lf\n " , total );
    return 0;
    } // end main

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

    Cast to ObjectId failed error (javascript)

    Posted: 19 Jul 2020 03:59 PM PDT

    I'm working on a route (javascript). I've been trying to debug it for a while now and I do not understand what is causing this error. Below is the function that I am working on. If anyone sees the error or has an idea that might be causing it please let me know. Any help is appreciated. Thank you!

    // @route Post api/chats/chat // @desc Post to join chat // Private router.post('/chat', auth, async (req, res) => { const { code, title } = req.body; try { const chat = await Chat.findOne({ title: req.body.title }); if (!chat) { return res.status(400).json({ msg: 'Invalid Credentials' }); } const isMatch = await bcrypt.compare(code, chat.code); if (!isMatch) { return res.status(400).json({ errors: [{ msg: 'Invalid Credentials' }] }); } const profileFields = {}; profileFields.users = chat.users.push(req.user.id); console.log(chat.users); chat = await Chat.findOneAndUpdate( { title: title }, { $set: profileFields }, { new: true } ); console.log('after'); const payload = { chat: { id: chat.id } }; jwt.sign( payload, config.get('jwtSecret'), { expiresIn: 360000 }, (err, token) => { if (err) throw err; res.json({ token }); }); } catch (err) { console.error(err.message); res.status(500).send('Server Error'); } }); 
    submitted by /u/dwight12345
    [link] [comments]

    C++ Help

    Posted: 19 Jul 2020 03:50 PM PDT

    If anyone has code that asks a question and if the answer is yes it says you can continue and if the answer is anything else the computer shuts down because i can't seem to get it right.

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

    How to fix bugs on an already existing code base in an industrial environment?

    Posted: 19 Jul 2020 09:45 AM PDT

    I started working on a new project at work and I have only a few months of work experience with a different project.

    I was most experienced with C# previously but I'm a Java dev now. Surprisingly, in most cases it's rather my lack of knowledge about the project and the IDE (Eclipse) that cause the biggest problem and not my lack of knowledge about Java and JavaFX.

    What are some good tips to get more familiar with the project and what should I learn to become better at fixing bugs when I'm not yet familiar with the project that much?

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

    "Smooth" random walks from one coordinate to another?

    Posted: 19 Jul 2020 03:26 PM PDT

    I learned about random walks recently when researching a problem I'm trying to solve.

    Curious what ideas you guys get for the problem at hand.

    I have a working random walk model. I am using my computer mouse and MS Paint to visualize my path from point A to point B.

    I am first "recording" my mouse movement where I draw a line in MS Paint, then I set a tolerance of randomness in pixels and randomize my set of inputs.

    The outcome is indeed random, but the issue is the "caffeine-like" path my mouse takes once randomized, zig-zagging dramatically only being pushed along by the 20px tolerance I've set.

    Is there any further reading on smoothing out a "random" path? Ideally I'd like to see my mouse start and end on the same point, but take a different, albeit logical, new path to get there every time.

    Would love to hear some thoughts

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

    Array Filtering in Javascript

    Posted: 19 Jul 2020 03:25 PM PDT

    I'm filtering an array based on a value as such

    const search = keyword => this.all_data.find(({ skillsModel }) => skillsModel.some(({ title }) => title == keyword));

    const result = search("SomeString");console.log(result);

    And this returns the correct object, but only one object. How call I get all the objects that match?

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

    Thin Backend (Node js) and Cpu Bound (ASP.net) application servers help

    Posted: 19 Jul 2020 03:10 PM PDT

    Alright, strange question, but I need a little help with the setup of a web app that has an isomorphic function because frankly there is just not enough resources are any that has helped me at all with this so hello people of the internet. My predicament is that I want to create a web app that both hosts node.js/express for simple stuff such as "/login" and "/" just that general area, and as well host asp.net in order to handle just overall larger functions specifically "/token" , "/api/user", using Asp.net JWT identity and web api, but I have NO IDEA how to set this up at all, what I have gathered through many resources is that is this is a separate by separate project, with one entire project devoted to asp.net and another project completely devoted to front-end using nodejs/express and React js, I am using visual studio, any help would be appreciated as well as I am a lil new to asp.net and only worked with node/express but I need asp.net in order to work with jwt much more efficiently. Thanks.

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

    Should I accept the job offer?

    Posted: 19 Jul 2020 07:19 AM PDT

    I am a junior developer and have my first outstanding job offer. The payment is quite good, the tasks are interesting. What makes me insecure is the fact that i would be the only developer in the company for a while (young company). Since I am still young, I can theoretically take some risks, but I don't know if it would be better to start in a team. If the company does well, my position would grow with it.

    Thanks for your help!

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

    Help with c#

    Posted: 19 Jul 2020 02:15 PM PDT

    I'm trying to create an if statement so that if the age inputted is smaller than 4 years you will be told you can't play

    here's my code"

    using System;

    namespace ConsoleApp2

    {

    class Menu

    {

    static void Main(string[] args)

    {

    Console.WriteLine("Enter username");

    string userName = Console.ReadLine();

    Console.WriteLine("Username is: " + userName);

    Console.WriteLine("Enter age");

    string age = Console.ReadLine();

    Console.WriteLine("Age is;" + age);

    { if (age < 4) ; }

    Console.WriteLine("You must be at least 5 years old to play!");

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

    What are some good books on prototyping?

    Posted: 19 Jul 2020 01:48 PM PDT

    I want to get good at prototyping and rapid application development so I can quickly can cheaply push out functional software so I can sell the promise of improvements on it to secure crowd funding cite them as completed projects to pad my resume.

    I am fine with starting with a heavy free and open source framework or even modding existing software.

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

    How to Scrape Reddit comments from all threads in a subreddit within a limited time frame?

    Posted: 19 Jul 2020 12:16 PM PDT

    So I am working on a project where I need to scrape comments from all/multiple threads in a subreddit.

    I am doing it like this...

    submission = reddit.submission(url="https://www.reddit.com/r/_______/")
    submission = reddit.submission(id="___")

    for top_level_comment in submission.comments:
    print(top_level_comment.body)

    but I do not want to manually do this for every threads/link.

    is there any alternative to this?

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

    [Showoff] Hello everyone. I made console game Snake.

    Posted: 19 Jul 2020 09:15 AM PDT

    Please comment on my code / mistakes. Thanks a lot.

    Here's the github link. I mentioned this in this post as well.

    submitted by /u/-DivineGod-
    [link] [comments]

    Thoughts?

    Posted: 19 Jul 2020 09:02 AM PDT

    Hi. Fisrt off - if this is the most common question here, which I suspect it might be, my apologise in advance, especially given the last few months (covid).

    I'm currently on furlough from my work, I know for sure I'm not going back until Nov and so i want to investigate programming. I dont expect I'm a typical candidate, from the little knowledge I have I know its a growing and diverse field.

    My have a few questions

    -Does anyone have any advise on how they found the right kind to of programming language or application which suited them best. How they whittled down the options? I would not consider myself to be particularly neurotypical - I'm the opposite and rather neurodivergant. Tending to do things slightly differently. I like looking for workarounds, efficiencies. Using tools for unintended purposes. This information is probably irrelevant.

    -I learn best by doing, and copying to some degree. I'm not someone who is particularly successful at reading a book > understanding >applying skill irl. And so if there was anyone who had advice on some sort of practical learning that might suit someone who could tinker as they went then that would be good. I'm thinking of things in got good at such as cooking, gardening, music they all

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

    In-memory database and programming language memory management / garbage collection

    Posted: 19 Jul 2020 04:59 AM PDT

    I've been reading about in-memory databases and how they use RAM instead of disk-storage.

    I'm trying to understand the pros and cons of building an in-memory database with different programming languages, particularly Java and Python. What would each implementation offer in terms of speed, efficiency, memory management and garbage collection?

    I think I could write a program in Python faster, but I'm not sure what additional benefits it would generate.

    I would imagine the language with a faster or more efficient memory management / garbage collection algorithm would be a better system to use because that would free up resources for my in-memory database. From my basic understanding I think Java's algorithm might be more efficient that Python's at freeing up memory. Would this be a correct assumption?

    Cheers

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

    Accumulator, signed bit and overflow?

    Posted: 19 Jul 2020 08:04 AM PDT

    Say we have an accumulator AC.

    And that accumulator has a sum stored in it.

    Then, how do we decide, in which case is overflow?

    eg-:

    a) is it overflow when signed bit=1? if yes, why?

    b ) is it overflow, when signed bit=0? if yes, why?

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

    No comments:

    Post a Comment