• Breaking News

    Tuesday, June 11, 2019

    When you have to walk away from a program to come back with fresh eyes, what do you do to distract yourself? learn programming

    When you have to walk away from a program to come back with fresh eyes, what do you do to distract yourself? learn programming


    When you have to walk away from a program to come back with fresh eyes, what do you do to distract yourself?

    Posted: 11 Jun 2019 05:43 PM PDT

    Hi, I'm new to this sub and read the rules and do not think this violates them, but if a mod disagrees I apologize.

    I'm relatively new to programming and have touched on beginner JavaScript and beginner C# concepts. However, my question really applies to learning/coding something for any language.

    If my question is unclear, I'm referring to when you're working with a complicated program or learning new functionalities in a given language and you are starting at your code with confusion or anger because you just can't figure out where you went wrong. I've heard the advice, walk away for a little bit so you can come back with "fresh eyes". Those that have been doing this for 0.02 seconds... I'd love to hear what you do when you're trying to take your mind off your program.

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

    I would like some feedback

    Posted: 11 Jun 2019 05:13 PM PDT

    I started a blog about programming in the hopes of increasing job opportunities and refining my programming skills. However it just feels like I'm doing it all wrong lol. So I was wondering if anyone here can provide some tips

    http://usefulprogramming.com/

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

    C++ Programming Help

    Posted: 11 Jun 2019 04:49 PM PDT

    I am currently taking C++ programming in college and my professor asked us to modify some code to make a clock. I modified the code he provided and it runs fine, however, the program runs the clock very fast 24 hours in a few seconds. I unfortunately missed the class after he gave the assignment on how to use the delay function. Could anyone help me and provide some details on how I can get the clock to delay (my professor said it doesn't matter the time it shows). Any help would be appreciated.

    #include <iostream>

    #include <iomanip>

    using namespace std;

    int main()

    {

    int secs; cout << fixed << right; cout.fill('0'); for (int hours = 0; hours < 24; hours++) { for (int minutes = 0; minutes < 60; minutes++) { for (int seconds = 0; seconds < 60; seconds++) { 

    std::cout << "\r" << setw(2) << hours << ":";

    std::cout << setw(2) << minutes << ":";

    std::cout << setw(2) << seconds;

    secs = seconds;

     } } } return 0; 

    }

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

    Online profiling

    Posted: 11 Jun 2019 08:26 PM PDT

    I just finished my Freshman year as a Computer Science major student and currently am working for an IT company as an intern. A few days ago, I teamed up with a guy to figure out how we can efficiently profile web users for commercial advantages, specifying their purposes, tastes, interests, and other aspects. So my questions are: What kinds of information we can take away from web users while they're browsing on our websites, any unique user ids, Gmail, social media account,...? What are the key components for online web users profiling? I'm just trying to understand the ideas of this concept. I'd be extremely grateful if anyone can help me map out applications and coding tips I can use to develop on this.

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

    Learning to Program without Internet

    Posted: 11 Jun 2019 06:17 PM PDT

    I'm about to be on a work trip for 5 days with no access to the Internet. I'll have a ton of down time and would like to brush up on my programming. As some background, I learned javascript, asp.net, php, and Java in high school, almost 12 years ago. I've done very limited bash scripting since then so I basically need to start over. I think I'd like to pick java back up since our contractors write their software in it. I'm also interested in python if that's a better fit at the moment.

    What I'm looking for its a resource I can download and spend 16 hrs a day for 5 days going through. An ebook would be ok but I'm worried about only having access to the book and an api for understanding. My first time learning programing was done in large part by reading stack overflow posts. I'm not sure what resource I can use to substitute that level of explanations when I have a question.

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

    Programmers - do you use blue light glasses for your eyes?? Do they work?My eyeballs feel so strained since programming this year. I’m thinking of buying them.

    Posted: 11 Jun 2019 09:39 PM PDT

    It drives me crazy. I feel like my eyesight has gotten worse and I can't focus on my work as well either. I use dark mode on everything. Maybe I'm stressed, or maybe blue light glasses will help.

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

    Transition between states

    Posted: 11 Jun 2019 11:03 PM PDT

    I was wondering what you all think is the best way to handle transitions between states in a state pattern design. Should you:

    • let the context own the states and handle transitions between them?
    • allow a separate object (controller, factory or or such) to own the states and offer a way to transit between them?
    • design it in such a way that the states themselves (in a more direct manner - say, by returning the next state for instance) handle the transitions?

    What are the drawbacks for each design choice? What are the gains? Which approach am I missing?

    Thanks.

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

    Need help with a seg fault using inheritance [homework]

    Posted: 11 Jun 2019 10:56 PM PDT

    Hi there, sorry if this is obvious, running out of gas in the tank lol. I have a project kinda where I'm building a house, and have a base class called space and some derived classes from it. I'm supposed to link the directions with pointers. Here's the part this is giving me trouble.

    Here is a snippet from space.h:

    #ifndef SPACE_H #define SPACE_H class space { public: space(); space *top; space *bottom; space *right; space *left; 

    Here is a snippet from attic (derived):

    #ifndef ATTIC_H #define ATTIC_H #include "space.h" class attic : public space { public: attic(); void intro(); int options(); void boxes(); 

    Part of main where debugger stops:

    attic *attic1; basement *basement1; bedroom *bedroom1; chamber *chamber1; kitchen *kitchen1; parlor *parlor1; hallway *hallway1; attic1->top = nullptr; attic1->bottom = parlor1; attic1->right = chamber1; attic1->left = nullptr; 

    Just not sure why attic would not have access to those direction pointers. I think the rest of my program should be ok once I figure this out, I just coded for a looooong time without compiling. Thank you

    gold to the first person who can help my sleep deprived brain figure it out

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

    Looking for a study partner/group! LA Koreatown (Near Western Ave and 5th Street)

    Posted: 11 Jun 2019 02:46 PM PDT

    *If this post isn't suitable for this page I will remove it ASAP!

    I'm looking for a study partner or group that wants to begin studying JavaScript over the Summer. I'm looking into taking some cheap courses online but I think would be a better learning experience to work in a group. I just feel that I can't use my time efficiently when I'm trying to work out a problem I'm stuck with.

    Even more so, I've been trying to study on my own but lack the discipline to be consistent, especially in this summer heat and post-work sleepiness. It would be awesome to find a group that is motivated as I am intending on enrolling for an immersive boot camp course within the next few months!

    It's usually around 3~3:30 when I get back from work, and I'm looking to study until 7-pmish on the weekdays.

    Comment if anyone's interested!

    Much Thanks!

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

    [Python] How to take same elements from different lists?

    Posted: 11 Jun 2019 10:02 PM PDT

    For example, say I have two lists:

    A = [1, 2, 3, 4]

    B =[3, 4, 5, 6]

    What can I do to get the output [3, 4]?

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

    Connecting to database

    Posted: 11 Jun 2019 09:48 PM PDT

    I'm currently trying to connect to a database on my local machine, I'm using appserv to host my php files, I have also installed sql and to manage my database I'm using mysql-front. From mysql-front, I can connect to the database using the root as the username and the password I set up when installing mysql. However when I try to do so from my php file i get this message

    Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\AppServ\www\Intergraph\login.php on line 111
    Connection failed Access denied for user 'root'@'localhost' (using password: YES)

    I've been told that I'm using the wrong password but I've checked it many times and it is the same password I'm using in mysql-front.

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

    [SQL] Select most recent comment per user if the newest comment from that user is over 30 days old

    Posted: 11 Jun 2019 09:43 PM PDT

    Using Postgres 9.6. Using Rails as well, but ideally this would be done via SQL (open to ActiveRecord based solutions as well)

    Anyway, down to it. Given that:

    A User has many Comments A Post has many Comments 

    I'm looking to get a list of all comments from a given user, but only the most recent comment from that user per post (if a user commented yesterday and today, only the comment from today would be returned). Finally, I only want the comment to be returned if the most recent comment per-post is over 30 days old.

    Here's my current attempt, even though it doesn't work (ERROR: column "creation_date" does not exist):

    SELECT id, post_id, user_id, MAX(created_at) as creation_date FROM comments WHERE user_id = ? AND creation_date < NOW() - INTERVAL '30 days' GROUP BY post_id 

    Any help is appreciated!

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

    When writing a custom .equals() method for an object, what does it mean to "convert the argument to the type of our class, so getters and other methods can be called"?

    Posted: 11 Jun 2019 05:49 PM PDT

    I am reading "Java for Python Programmers" and this particular line in it elaborating on details for creating a custom .equals() method for objects has me confused. Could anyone elaborate on this?

    Many thanks in advance.

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

    I've finished a bootcamp course and watched a ton of tutorials, with some smaller projects behind me, where to go from here?

    Posted: 11 Jun 2019 06:59 AM PDT

    As the title says, I am stuck not knowing what I should make next.

    I know that inspiration doesn't just come, but today I wanted to make something that would generate me different sets of random comments for my friend's online teaching job, and just when I started I realized that there are plenty of others made already and it kind of killed my mood.

    I don't know what I want to make , but I also want to practice a lot. I've been working with Javascript and other front end stuff mostly, but I struggle to see where I should go from here.

    I find it difficult to just come up with something and make it , since plenty of stuff seems too complex for me to make, no matter what I think of.

    What's really depressing for me is that I've spent the past 3 hours pondering about that while watching some tutorials and it feels like I wasted my day...

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

    Intermediate Python Tutorials?

    Posted: 11 Jun 2019 09:08 AM PDT

    I'm uncertain where to find quality intermediate videos for Python. I've been going on edabit.com to try and continue practicing. But I found that the resources don't help me out as much as I would've hoped. Youtube tutorials almost entirely focus on the beginner phase of Python up to like classes. From there I don't know where to go. If I do feel like practicing I go on edabit, get stumped on a challenge, look at resources, still stumped, and then solutions to try and decipher what they have done. The sad part is this is on Very Easy level of difficulty...

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

    Errors creating code for Teensy 2++ Keyboard

    Posted: 11 Jun 2019 08:00 PM PDT

    I'm attempting to write some basic button press and release code for use on my Teensy 2++ using the teensyduino libraries. i can't seem to flash onto my teensy. i got this code to work once but i lost it (stupid for forgetting to save) and now i can't figure out how to compile it again.

    can somebody please tell me what im doing wrong????

    my code looks like this:

    #include <Keyboard.h>

    #include <Bounce.h>

    Bounce button0 = Bounce(0, 10);

    Bounce button1 = Bounce(1, 10);

    Bounce button2 = Bounce(2, 10);

    Bounce button3 = Bounce(3, 10);

    Bounce button4 = Bounce(4, 10);

    Bounce button5 = Bounce(5, 10);

    Bounce button6 = Bounce(6, 10);

    Bounce button7 = Bounce(7, 10);

    Bounce button8 = Bounce(8, 10);

    Bounce button9 = Bounce(9, 10);

    Bounce button10 = Bounce(10, 10);

    Bounce button11 = Bounce(11, 10);

    Bounce button12 = Bounce(12, 10);

    Bounce button13 = Bounce(13, 10);

    Bounce button14 = Bounce(14, 10);

    Bounce button15 = Bounce(15, 10);

    Bounce button16 = Bounce(16, 10);

    Bounce button17 = Bounce(17, 10);

    Bounce button18 = Bounce(18, 10);

    Bounce button19 = Bounce(19, 10);

    Bounce button20 = Bounce(20, 10);

    Bounce button21 = Bounce(21, 10);

    Bounce button22 = Bounce(22, 10);

    Bounce button23 = Bounce(23, 10);

    Bounce button24 = Bounce(24, 10);

    void setup() {

    pinMode(0, INPUT_PULLUP);

    pinMode(1, INPUT_PULLUP);

    pinMode(2, INPUT_PULLUP);

    pinMode(3, INPUT_PULLUP);

    pinMode(4, INPUT_PULLUP);

    pinMode(5, INPUT_PULLUP);

    pinMode(7, INPUT_PULLUP);

    pinMode(8, INPUT_PULLUP);

    pinMode(9, INPUT_PULLUP);

    pinMode(10, INPUT_PULLUP);

    pinMode(11, INPUT_PULLUP);

    pinMode(12, INPUT_PULLUP);

    pinMode(13, INPUT_PULLUP);

    pinMode(14, INPUT_PULLUP);

    pinMode(15, INPUT_PULLUP);

    pinMode(16, INPUT_PULLUP);

    pinMode(17, INPUT_PULLUP);

    pinMode(18, INPUT_PULLUP);

    pinMode(19, INPUT_PULLUP);

    pinMode(20, INPUT_PULLUP);

    pinMode(21, INPUT_PULLUP);

    pinMode(22, INPUT_PULLUP);

    pinMode(23, INPUT_PULLUP);

    pinMode(24, INPUT_PULLUP);

    button0.update();

    button1.update();

    button2.update();

    button3.update();

    button4.update();

    button5.update();

    button7.update();

    button8.update();

    button9.update();

    button10.update();

    button11.update();

    button12.update();

    button13.update();

    button14.update();

    button15.update();

    button16.update();

    button17.update();

    button18.update();

    button19.update();

    button20.update();

    button21.update();

    button22.update();

    button23.update();

    button24.update();

    if ( (button0.fallingEdge())

    keyboard.press (KEY_1);

    delay(300):

    Keyboard.release (KEY_1);

    if (button1.fallingEdge()) {

    Keyboard.press(KEY_2);

    delay(300):

    Keyboard.release(KEY_2);

    if (button2.fallingEdge()) {

    Keyboard.press(KEY_3);

    delay(300):

    Keyboard.release(KEY_3);

    if (button3.fallingEdge()) {

    Keyboard.press(KEY_4);

    delay(300):

    Keyboard.release(KEY_4);

    if (button4.fallingEdge()) {

    Keyboard.press(KEY_5);

    delay(300):

    Keyboard.release(KEY_5);

    }

    if (button5.fallingEdge()) {

    Keyboard.press(KEY_6);

    delay(300):

    Keyboard.release(KEY_6);

    }

    if (button7.fallingEdge()) {

    Keyboard.press(KEY_Q);

    delay(300):

    Keyboard.release(KEY_Q);

    }

    if (button8.fallingEdge()) {

    Keyboard.press(KEY_W);

    delay(300):

    Keyboard.release(KEY_W);

    }

    if (button9.fallingEdge()) {

    Keyboard.press(KEY_E);

    delay(300):

    Keyboard.release(KEY_E);

    }

    if (button10.fallingEdge()) {

    Keyboard.press(KEY_R);

    delay(300):

    Keyboard.release(KEY_R);

    }

    if (button11.fallingEdge()) {

    Keyboard.press(KEY_T);

    delay(300):

    Keyboard.release(KEY_T);

    }

    if (button12.fallingEdge()) {

    Keyboard.press(KEY_Y);

    delay(300):

    Keyboard.release(KEY_Y);

    }

    if (button13.fallingEdge()) {

    Keyboard.press(KEY_U);

    delay(300):

    Keyboard.release(KEY_U);

    }

    if (button14.fallingEdge()) {

    Keyboard.press(KEY_I);

    delay(300):

    Keyboard.release(KEY_I);

    }

    if (button15.fallingEdge()) {

    Keyboard.press(KEY_O);

    delay(300):

    Keyboard.release(KEY_O);

    }

    if (button16.fallingEdge()) {

    Keyboard.press(KEY_SPACE);

    delay(300):

    Keyboard.release(KEY_SPACE);

    }

    if (button17.fallingEdge()) {

    Keyboard.press(KEY_BACKSPACE);

    delay(300):

    Keyboard.release(KEY_BACKSPACE);

    }

    if (button18.fallingEdge()) {

    Keyboard.press(KEY_Z);

    delay(300):

    Keyboard.release(KEY_Z);

    }

    if (button19.fallingEdge()) {

    Keyboard.press(KEY_UP);

    delay(300):

    Keyboard.release(KEY_UP);

    }

    if (button20.fallingEdge()) {

    Keyboard.press(KEY_DOWN);

    delay(300):

    Keyboard.release(KEY_DOWN);

    }

    if (button21.fallingEdge()) {

    Keyboard.press(KEY_LEFT);

    delay(300):

    Keyboard.release(KEY_LEFT);

    }

    if (button22.fallingEdge()) {

    Keyboard.press(KEY_RIGHT);

    delay(300):

    Keyboard.release(KEY_RIGHT);

    }

    if (button23.fallingEdge()) {

    Keyboard.press(KEY_TAB);

    delay(300):

    Keyboard.release(KEY_TAB);

    }

    if (button24.fallingEdge()) {

    Keyboard.press(KEY_ENTER);

    delay(300):

    Keyboard.release(KEY_ENTER);

    }

    I really think im just missing something weird like using ) or } or ] in a wrong location, but i am very new to this, so im not even sure where to look.

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

    Reviews on Paradigms of Computer Programming - Fundamentals

    Posted: 11 Jun 2019 04:00 PM PDT

    I've been looking at this course:

    https://www.edx.org/course/paradigms-of-computer-programming-fundamentals

    Someone recommended it and the course after that to learn better about concurrency and threading.

    I'm not real sure I like the Oz Programming Language. I used it once before in a college class and it was just awful.

    I would like it if someone that already took this course could tell me more.

    Otherwise I would like to learn more about functional programming and concurrency. I don't suppose anybody knows any better courses on those subjects.

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

    Should I learn to write Windows forms code manually?

    Posted: 11 Jun 2019 07:39 PM PDT

    I decided the other day to learn C# so that I can make GUIs.

    I started out using Notepad++, just to keep it simple. After a significant amount of Googling, I was able to write out a nice small program, with a simple GUI. The problem is, my Googling was far more time consuming than it needed to be because everything was "In Visual Studio do xyz...".

    I have given in now and switched over to Visual Studio. I have noticed that it does a lot of the initial coding for me, like setting up the form(s), creating components and writing blank event handlers. I worry though, that I should be writing this out myself, just so I can do it properly.

    Should I learn to do this stuff by hand? Or is it Ok to let Visual Studio handle this so that I can just get on to actually writing my program?

    submitted by /u/19Ant91
    [link] [comments]

    [Java] Why are there multiple sub-classes for I/O readers and writers?

    Posted: 11 Jun 2019 07:35 PM PDT

    I'm currently learning about the I/O class of java, and found that there are multiple ways of writing or reading data to and from files or the console.

    I'm also aware that Buffered Writers and Readers are useful for increasing efficiency.

    I've just searched that Strings are simply arrays of characters, and characters are any combination of 8-bits assigned by ASCII (and how we're now moving on to UTF-08), so the need for a byte reader, character reader, and string reader, and their writer counterparts, are useful to have around, as well as file writers and file readers to send an output to a target file.

    But still, I can't wrap my head around the idea for having streams and buffers, as well as filter streams, and all its other combinations. What are they supposed to be, and supposed to do?

    Is there a simple way where I can chart/explain these things so that one day, I'll know when and why I have to use a particle subclass of the I/O class in java?

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

    How to add a context menu option for a Firefox extension I'm making?

    Posted: 11 Jun 2019 07:33 PM PDT

    So I'm trying to add a context menu option (highlight text and right click) for my project here. My experience is Java/C/Data Structures so understanding this stuff isn't too hard.

    What I want to do is an extension that allows the user to highlight a word, right click, search definition, and it opens a compact window that gives the definition for the highlighted word.

    I think I'm just looking for a point in the right direction, there's the manifest.json, Javascript, CSS, HTML, stuff I'm not too familiar with.

    submitted by /u/3v3rgr33nActual
    [link] [comments]

    At my University, my professor taught C++ to sophomores. Do you think this is overkill?

    Posted: 11 Jun 2019 07:31 PM PDT

    My professor was a really nice guy. I enjoyed the class but I feel like a lot of the lessons were a hit or miss. Sometimes the teacher would speed through the lessons because the class was very small. I tried my hardest to truly learn C++ but without any ulterior motive (build a personal project) it didn't make any sense. I managed to get an A in the class because the answers were online, however, that doesn't mean I learned anything. Understand, this was my supposedly first coding language. It almost discouraged me to learn code until I bought a course on Udemy and taught myself HTML5 and CSS3 and found much better success with it as opposed to the college course. Do you think teaching C++ to beginners is overkill? Please post your responses below.

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

    Any recommendations for learning how to BEGIN to solve questions like the Knight's Tour?

    Posted: 11 Jun 2019 07:03 PM PDT

    I can handle standard dynamic programming questions but questions like the Knight's Tour (https://www.geeksforgeeks.org/the-knights-tour-problem-backtracking-1/) I find extremely difficult. Any recommendations on online courses or other material that can warm me up to being able to start solving these kinds of problems?

    Thank you!!

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

    Looping through xpath selectors

    Posted: 11 Jun 2019 06:50 PM PDT

    I'm trying to loop through the jobs on this page and only pull out jobs that have "remote" or "anywhere" as the location. For jobs that fit the criteria, I want to extract the href, and then extract some more data from that page. I can't figure out the right way to loop through the listings on the first page so I can properly extract the right links. Right now, my spider looks like

    import scrapy class JobsSpider(scrapy.Spider): name = 'jobs' allowed_domains = ['jobs.lever.co'] start_urls = ['https://jobs.lever.co/15five'] def parse(self, response): listings = response.xpath('//div[@class="posting"]') openings = [] for listing in listings: if listing.xpath('.//span[contains(text(), "remote")]'): openings.append(listing.xpath('.//a[@class="posting-title"]/@href').extract_first()) elif listing.xpath('.//span[contains(text(), "Remote")]'): openings.append(listing.xpath('.//a[@class="posting-title"]/@href').extract_first()) elif listing.xpath('.//span[contains(text(), "Anywhere")]'): openings.append(listing.xpath('.//a[@class="posting-title"]/@href').extract_first()) for jobs in openings: link = listing.xpath('.//a[@class="posting-title"]/@href') yield scrapy.Request(link, callback=self.parse_listing, meta={'link': link}) def parse_listing(self, response): link = response.meta['link'] 

    I'm getting the error "line 56, in _set_url raise TypeError('Request url must be str or unicode, got %s:' % type(url).__name__)" The URLs are showing as strings inside my list, so I'm not sure why I'm getting this error. Any ideas on how to fix or a more efficient way to pass the URL to the parse_listing function?

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

    Is the use of public functions inside a class by another function inside the same class unsafe and bad practice?

    Posted: 11 Jun 2019 12:41 PM PDT

    I was just implementing a vector class in C++ for practice and noticed. While implementing the insert method I was having struggle to do it with all the pointers and stuff, but then I decided it would be easier to just do the classic algorithm like I would insert something in a C array, but this would imply me using another function from the same class, the .at function. It would make my code much more cleaner and will take less to implement but in case the .at function breaks or I change something in it, all the functions using that function will also break, thus making my functions dependent on each other and I thought this may be unsafe. Is it true or am I worrying too much?

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

    No comments:

    Post a Comment