• Breaking News

    Saturday, December 12, 2020

    [Meta] Well I'm a mod now Ask Programming

    [Meta] Well I'm a mod now Ask Programming


    [Meta] Well I'm a mod now

    Posted: 12 Dec 2020 01:09 AM PST

    Hi again!

    Yesterday I surprisingly got granted mod privileges (shout-out to /u/sciguymjm) and am currently working my way through the mod queue (first year done already ... yay -.-), banning spam users, all the good stuff.

    The reason I'm writing this post is twofold:

    First, I need a handful of other active mods, preferably from the US (mainly due to timezones, me being from Europe). Also ideally someone with mod-experience, as I'm quite new to this ;)

    Secondly, we need to get a proper set of rules defined and set up. Things we as a community already treat that way, but which were never codified. So far I got these:

    • Be excellent to each other. Don't instantly assume someone is trolling/dumb/whatever because their question is asked badly.
    • Must be a question ... obvious but never stated anywhere
    • Must be related to programming in a broader sense. I.e. "what's your favourite color" is not, "how does the end of Centos 8 impact you and your work" I'd treat as ok.
    • Should have a descriptive title (not "I have a question") ... I struggle to make this a hard rule, but would treat this only as strong recommendation. I know you can put some text in the submit form so I'd rather put a "how to ask a good question" guide there instead of hard-enforcing this rule.
    • No self promotion
    • No "academic dishonesty", as someone so nicely put it in the custom report messages (i.e. "can you do my homework for me? will pay $$$"). Asking for help ("I am stuck here and don't get why") is ok.
    • Top level comments should be related to the question asked. ("commenting so I come back later" is not in that category). Pinging remindmebot ... once the bot picks it up please clean up after yourself.

    The obvious other rules apply. I.e.

    • no trolling or derailing threads
    • no (major) insults that are not clearly in jest. If someone makes an obvious over the top funny "insult" it probably will stay for the entertainment value. Moderator discretion applies though.

    Ok I can't think of anything else right now. Comments (and mod applications) welcome :)

    Cheers

    PS: I've added TyrSniper and A_Philosophical_Cat as mods as well now, so I think that should be a good start for having an active mod team :)

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

    Rubber duck debugging?

    Posted: 12 Dec 2020 07:38 PM PST

    Stumbled upon an article that read when coders get stuck they tend to fall back on a rubber duck to debug. Is this actually true? How many people here actually practice this method?

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

    As an end user is there any difference to using FreeBSD and GNU/Linux?

    Posted: 12 Dec 2020 06:14 PM PST

    So I looked into this a lot and found out that FreeBSD basically has philosophy to create a whole system+extensions while Linux is basically a lot of software put together to create an OS.

    While it sounds like FreeBSD logically is more solid and stable, Linux is the more popular one and used more everywhere(AFAIK) which sounds confusing.

    As an end user, does it really matter what goes in the background? Is more like its a car be it running on gas, diesel, or electricity...does not matter to the driver?

    It makes me scratch my head why they put effort to keep both.

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

    If there’s a better way to find the mode(s) of an array?

    Posted: 12 Dec 2020 10:04 PM PST

    shorter code

    Array a is a sorted int array with 50 numbers whose values ranging from 0-100

     int countA[101]; for(i=0;i<101;i++){ countA[i]=0; } for(i=0;i<50;i++){ countA[a[i]]++; } int maxi=0; for(i=1;i<101;i++){ if(countA[i]>countA[maxi]){ maxi=i; } } for(i=0;i<101;i++){ if(countA[i]==countA[maxi]){ printf("%d ",i); } } 
    submitted by /u/JacksonSteel
    [link] [comments]

    [WinError 10061] I need help fixing this.

    Posted: 12 Dec 2020 04:34 PM PST

    I am writing a simple code just to test my chrome driver

    the code:

    import time

    from selenium import webdriver

    driver = webdriver.Chrome('C:/webdrivers/chromedriver.exe')

    driver.get('http://www.google.com/');

    the error:

    Traceback (most recent call last):

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 169, in _new_conn

    conn = connection.create_connection(

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\connection.py", line 96, in create_connection

    raise err

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\connection.py", line 86, in create_connection

    sock.connect(sa)

    ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen

    httplib_response = self._make_request(

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 394, in _make_request

    conn.request(method, url, **httplib_request_kw)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 234, in request

    super(HTTPConnection, self).request(method, url, body=body, headers=headers)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1240, in request

    self._send_request(method, url, body, headers, encode_chunked)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1286, in _send_request

    self.endheaders(body, encode_chunked=encode_chunked)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1235, in endheaders

    self._send_output(message_body, encode_chunked=encode_chunked)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 1006, in _send_output

    self.send(msg)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\http\client.py", line 946, in send

    self.connect()

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 200, in connect

    conn = self._new_conn()

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connection.py", line 181, in _new_conn

    raise NewConnectionError(

    urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000000E42F20E970>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):

    File "<pyshell#3>", line 1, in <module>

    driver.get('http://www.google.com/');

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get

    self.execute(Command.GET, {'url': url})

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 319, in execute

    response = self.command_executor.execute(driver_command, params)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 374, in execute

    return self._request(command_info[0], url, body=data)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 397, in _request

    resp = self._conn.request(method, url, body=body, headers=headers)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\request.py", line 78, in request

    return self.request_encode_body(

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\request.py", line 170, in request_encode_body

    return self.urlopen(method, url, **extra_kw)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\poolmanager.py", line 375, in urlopen

    response = conn.urlopen(method, u.request_uri, **kw)

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 783, in urlopen

    return self.urlopen(

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 783, in urlopen

    return self.urlopen(

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 783, in urlopen

    return self.urlopen(

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen

    retries = retries.increment(

    File "C:\Users\moothro\AppData\Local\Programs\Python\Python38\lib\site-packages\urllib3\util\retry.py", line 573, in increment

    raise MaxRetryError(_pool, url, error or ResponseError(cause))

    urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=63526): Max retries exceeded with url: /session/3248dc2ed158c0be4910fabb932bd13c/url (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000000E42F20E970>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

    submitted by /u/Entire-Ad-4954
    [link] [comments]

    Build a PC for programming

    Posted: 12 Dec 2020 04:23 PM PST

    Im trying to figure out what type of PC to build for programming. I know that you don't need much of a computer to program, but with my current Macbook Pro on 8GB of soldered RAM, I end up using up all of the RAM very quickly and slowing it down. This becomes very annoying when I need to switch tabs or jump to another window, or even VS code. Everything starts lag and slow down once I'm "in the zone" and doing work, which is quite annoying. I was thinking of dropping 800-1000$ on a basic computer with an i7-10700K CPU and 32GB of RAM. That definitely is over kill, but I feel like it'll future proof it. What do you think? I'm mainly a full stack developer doing some backend work and a lot of frontend work with React/Vue and other popular frameworks. I'm also a CS student but rarely run any CPU intensive tasks on my computer, mostly school servers.

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

    What are the possible issues involved in using the html script tag with the integrity attribute but not the src attribute, instead an inline script

    Posted: 12 Dec 2020 04:10 PM PST

    https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity

    <script src="https://example.com/example-framework.js" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="anonymous"> </script>

    But what if you wrote the script between the start script tag and end script tag, and still used integrity, and defined its id to equal its integrity value?

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

    List Maker

    Posted: 12 Dec 2020 03:46 PM PST

    How would I create a web application where you have a list with a unique url and key in which you can view later and others can join?

    edit: similar to listmoz

    submitted by /u/Effective-Economics1
    [link] [comments]

    Error in online textbook Big-O question?

    Posted: 12 Dec 2020 02:20 PM PST

    https://runestone.academy has an online textbook on data structures in C++. I thought I'd go from the beginning and review stuff, since it's been a while since I've done algorithmic/data structures coding. One of the questions in the book is:

    "The Big O of a particular algorithm is O(log_2 n). Given that it takes 2 seconds to complete the algorithm with 3 million inputs; how long would it take with 4 million inputs?"

    I calculate log_2(4000000) / log_2(3000000) = 1.01928923849, so the time the algorithm would run on 4 million inputs would be 2 * 1.019 = 2.038. However, this isn't shown to be an option. According to the textbook, the correct answer is 2.53. Is this an error on the textbook's part, or mine?

    edit: the possible answers are 2, 4, 2.53, and 3.444.

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

    My friend and i are trying to make a Visual Novel

    Posted: 12 Dec 2020 02:11 PM PST

    My friend and i are trying to make a Visual Novel but every tutorial is like "use Ren'Py". However we want to do everything on our own. Is it possible to do it with C++? What programming languages would you suggest? Any articles or tutorials?

    ps: we are complete begginers but we are eager to learn and v passionate so your help is appreciated a lot thank you!!

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

    What tool is to JSON as XPath/XSLT is to XML?

    Posted: 12 Dec 2020 07:57 AM PST

    My coworkers are advocating that a new system we are designing use JSON rather than XML. I can see the positive points and why it would be convenient since most of the browser side widgets we use consume JSON. But I am bothered by the lack of tools for JSON such as XPath the XSLT. With these XML can queried and transformed and thereby easily be converted to JSON when necessary.

    So is there an equivalent for XPath/XSLT/XML for JSON?

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

    Auto-Torrent Downloader

    Posted: 12 Dec 2020 12:47 PM PST

    Would it be possible to code a script that would automatically download torrents when you send the title by text to some number? Would that be possible?

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

    Java or Javascript?

    Posted: 12 Dec 2020 03:01 AM PST

    Hi guys! This is a trivial question but i hope i could get some feedbacks. The question is: Do you think I should stop learning javascript and focus on java instead?

    So here's my situation, I'm currently working as a Junior Software Dev in a Japanese company in the Philippines. I'm also currently learning Nihonggo. I won't have any projects for 5 months since the company wants us to focus on our Nihonggo lessons. But i still want to code and study programming while learning Japanese.

    For the past 6 months I've studied Web development, HTML, CSS, JS in the freeCodeCamp. Now I'm on the Javascript curriculum and I'm 60% until I complete the curriculum. Now I have learned that our company uses Java in their projects.

    **I feel like I haven't mastered a single Programming Language yet so I was about to go in depth with Javascript since I already started studying WebDev. But I learned that I'll be working with Java in the future, do you think I should switch to learning Java?

    Thank you for reading this far. Please be kind with your responses. Thank you again!

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

    27" 4k TN vs. 32" 1440p IPS

    Posted: 12 Dec 2020 12:09 PM PST

    Hey I found a good deal for two different monitors over black Friday and have been having trouble deciding which one to keep. The 27" 4k one is a TN panel, if it was IPS I would keep it for sure. The 32" 2k monitor is IPS. Both of them were the same price. Does the higher DPI of the 4k panel help a lot with reading code for a long period of time ? Or would it be useless and its better to get an IPS display ? What have been your experiences with your monitors and anything I should be valuing more heavily ?

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

    Starting my first web app project that's not a tutorial. Where should I start as a best practice? Website design or web app implementation?

    Posted: 12 Dec 2020 11:50 AM PST

    For background, I learned how to make pretty, modern websites using just HTML and CSS. I also know how to use Javascript in a basic capacity and use selectors to change things. I also learned a bit of python over a couple tutorials and I have a basic understanding of Flask. I should also mention that this is my first solo project in general, not just web app.

    That said, I'm going to make myself a Pomodoro tracker using HTML, CSS, and Flask. Javascript, too, if I think I need it. I'm just wondering where I should start in the design process. Should I start building the timer functionality in Flask or should I start designing how the website will look in HTML and CSS then work on Flask functionality. How should I structure this from a project planning perspective?

    Also, just for extra info, I might also add SQL or something later for saving progress (not just sessions) after I get the basic app and whatnot done. I also plan on using media queries later on for mobile design.

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

    How do computers deny ip addresses, and can someone approve or deny access through the terminal?

    Posted: 12 Dec 2020 07:09 AM PST

    One more question: Are switches usually part of the router nowadays? I know switches can see the MAC address. But nowadays is it like the packet contains ip addy, mac address and all that and so the router just handles it, or is there a switch inside the router?

    Thank you!

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

    I followed this tutorial and met this error, how to fix it?

    Posted: 12 Dec 2020 06:50 AM PST

    https://learndataanalysis.org/how-to-upload-a-video-to-youtube-using-youtube-data-api-in-python/

    403: access_denied

    The developer hasn't given you access to this app. It's currently being tested and it hasn't been verified by Google. If you think you should have access, contact the developer (hereistheemail).

    access_type=offline

    response_type=code

    redirect_uri=http://localhost:8080/

    state=GQrok15W2Nbtm9FV9QtaJMexoPVd51

    client_id=981765332381-4iffea2uvu8tnhcj2loedbs9u8rancit.apps.googleusercontent.com

    scope=https://www.googleapis.com/auth/youtube.uplo

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

    Would you recommend learning iOS over web dev in 2021?

    Posted: 12 Dec 2020 02:56 AM PST

    I am looking to change careers from finance to tech but still unsure which specialization to focus upon.

    I like the idea of making apps but webdev has far more job opportunities (especially on remote websites.) There is also a lot of hype of PWA and Flutter, React Native being the future which is forcing me to think that maybe iOS dev isn't a safe bet in the long term.

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

    anyone know this website where u would spam your keyboard and random code would appear?

    Posted: 12 Dec 2020 06:22 AM PST

    i cant remember but it was this site where me and my mates would just spam the keyboard and code would just appear

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

    Django or Web security as elective in next semester

    Posted: 12 Dec 2020 06:01 AM PST

    Hi!

    For my next semmester I have to choose an elective. I have to decide between Django and Web security. I may choose web security but also interested about your opinion.

    Here are the skills and knowledge they offer for each programme:

    Django skills and knowledge:

    • Python programming
    • Django framework features and design approach
    • Model-View-Template design pattern
    • Standard web-based protocols and technologies
    • Best practice web-development methods
    • Issues related to real-world web hosting

    Web security skills:

    • Apply risk management with focus on IT-security
    • Apply the principle of layered security
    • Spot potetntial security flaws in webapps
    • Use best practices on some web security challenges

    It is good to mention that they let us enough time to learn as much as possible( this is the only class in the semmester ), so in 3-4 months it is possible to get a deep knowledge in each topic.

    My current skills are: HTML | CSS | PHP / Wordpres| Javascript | Node.js | React / Gatsby / Next.JS | SQL | Relational DBs | Document DBs | Graphql | Prisma / Postgraphile | WebGL and some GLSL coding + a tons of other libraries / framworks I checked and tried & Basic GIT / Docker etc ( never used them in production )

    My problem is that Django doesn't give me anything "new", but just another method of building the same thing I can already can with JS etc. I already think that I learned way too much things before getting a proper junior position and learning the same thing in different language and framework doesn't make me more competetive but a master of none.

    Meanwhile web-security could be an other layer on my web-dev skills which is more or less language and framework agnostic.

    What do you think?

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

    Hello, I just started Programming.

    Posted: 12 Dec 2020 02:14 AM PST

    Hi everyone, Im new and idk if this is a dumb question or not but is this a while loop structure?
    m8scvom6dq461.png (291×178) (redd.it)

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

    To Game Developers

    Posted: 12 Dec 2020 04:53 AM PST

    How did you manage to get out of the tutorial phase and how long did it take you?!

    Been stuck there for a while!

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

    How do I output an image that I just uploaded? (Vue / Firebase)

    Posted: 12 Dec 2020 02:51 AM PST

    This has been bugging me for about a month now.

    In my Vue application I have created a component, which has a template that includes a file-input field and a img tag. When you enter an image in the input field and press "upload", the image is sent to my Firebase storage folder. That part works with no issues.

    But what I want it to do, is to take that image that I just uploaded, GET it from the storage folder and save it inside the img tag. I don't mean as a preview, I want it to permanently save the image on the template until I choose to delete it.

    I have been looking at tutorials, but they all cover the upload part, which I already know how to do. I also read the Firebase documentation about getting data, but in the examples I have seen you need to specify which file / image you want it to get and output. There is (as far as I can see) no information about how you automatically get and output a file you just uploaded.

    Here is my code. It only includes the upload method, because I still have no idea how to output it. If by any chance you know of a good tutorial that focus on what I want to do, I would be happy to get a link to it.

    <template> <div> <h2>image upload</h2> <input type="file" @change="uploadImage" value="upload" id="fileButton" ref="myFiles" /> <div class="image_section_content" fluid v-for="(files, index) in file" :key="index.id"> <b-img :src="file.imgURL" fluid alt="Responsive image"></b- img> <progress max="100" :value="value" id="uploader">0% </progress> </div> </div> </template> <script> import db from '@/firebase/init' import firebase from 'firebase' export default { name: 'ImageUpload', data () { return { value: 0, fileButton: document.querySelector("#fileButton"), file: [], imgRef: null, imgURL: null } }, methods: { uploadImage(e){ //get file this.file = this.$refs.myFiles.files[0] console.log(this.file) //create storageref let storageRef = firebase.storage().ref('images/'); //save image reference this.imgRef = storageRef.fullPath; //upload file let task = storageRef.put(this.file); task.on('state_changed', (snapshot) => { let percentage = (snapshot.bytesTransferred / snapshot.totalBytes); this.value = percentage; snapshot.ref.getDownloadURL().then( (DownloadURL) => { this.imgURL = DownloadURL; console.log(this.imgURL) } ) }) } } } </script> 
    submitted by /u/HjerterKnaegt
    [link] [comments]

    C++ compiler in vscode ain't working

    Posted: 12 Dec 2020 02:39 AM PST

    So, I'm trying to switch to visual studio code but every time I try and compile anything in c++ it gives me all kinds of errors. I've installed win builds, installed all of the packages from there (installed directly in c btw) and set the path in environment variables. here's my launch.json, tasks.json and settings.json. this is probably a very dumb question but nothing on google helped me so far.

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

    No comments:

    Post a Comment