• Breaking News

    Thursday, January 17, 2019

    Let's try to clear up some Git misconceptions learn programming

    Let's try to clear up some Git misconceptions learn programming


    Let's try to clear up some Git misconceptions

    Posted: 17 Jan 2019 10:40 AM PST

    I've learned quite a bit about Git since I started using it, and I'd like to share some hopefully instructive 'revelations' I've had along the way.

    1. You don't need Github to use Git

    That one can seem fairly obvious, but I remember being confused at first. You can use git entirely locally, and I would even say you should learn that way.

    2) A remote repository can be anywhere

    A remote repository is simply a repository your "local" repository is communicating to. From the Pro Git book:

    Remote repositories can be on your local machine. It is entirely possible that you can be working with a "remote" repository that is, in fact, on the same host you are. The word "remote" does not necessarily imply that the repository is somewhere else on the network or Internet, only that it is elsewhere. Working with such a remote repository would still involve all the standard pushing, pulling and fetching operations as with any other remote.

    3) A branch (in the Git sense) is a reference to a commit

    Edit: this paragraph seems to be confusing people. Please checkout the Pro Git Book for a better explanation!

    That is certainly one of the most important things to understand about Git. A branch is just a bookmark. When you delete a branch, you're removing the bookmark/branch, not the pages/commits (*). Branches are there to help you make sense of the commit graph you're building, they do not constitute the graph.

    4) A rebase does not modify any existing commit

    When you rebase a branch, you're creating new commits on the branch you are rebasing onto. Your branch bookmark will follow, but the 'former' commits are still in your graph (*).

    Edit: as oselcuk points out, it's not just rebase:

    pretty much nothing you do in git will actually delete/modify an existing commit other than garbage collection of unreferenced commits. So as long as you've committed your work at some point (recently), you can recover the lost work through reflog

    5) There are SHA hashes, but it's not about encryption

    At first, I believed that since Git used SHA hashes, some sort of encryption was going on. In fact, your files are simply compressed, and SHA are mostly used because they provide a nice (quasi) unique identifier for everything that Git stores.

    6) A merge commit can have more than 2 parents

    You can merge 3, 4 or more commits if you like to. They are called octopus merges, and they can go wrong sometimes. Linus once wrote this after a 66-parent commit broke some stuff:

    I just pulled the sound updates from Takashi, and as a result got your merge commit 2cde51fbd0f3. That one has 66 parents. [...]

    It's pulled, and it's fine, but there's clearly a balance between "octopus merges are fine" and "Christ, that's not an octopus, that's a Cthulhu merge".

    (*) Even if it's not immediate, keep in mind that at some point a non reachable commit will be garbage collected.

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

    I just completed #100DaysOfCode and I have a few tips for anyone trying it themself

    Posted: 17 Jan 2019 02:33 PM PST

    1. Get a whiteboard Yes, a plain old whiteboard. Words can't really express how much this simple purchase has helped me on my journey to become a software developer. My initial justification for buying one was hearing that "white boarding" was a common interview technique. So part of the reason of buying one was to make sure that I knew my way around a dry-erase marker should I ever need to use one. However, after the blank canvas was hung up on my wall for a week or so, it took on an entirely different role that was not anticipated. Every day, I began writing my progress. Every night, I worked out problems and ideas. Then, the next morning, waking up and looking at the board put me right back into the mindset I had the night prior. Checklists, goals, priorities, and issues all went up there, and I was tackling each with increasing focus and vigor.

    2. Code with someone Getting stuck in programming sucks. Finding someone who you can bounce things off of is critical. For some, this comes in the form of a small rubber ducky. For me, this came in the form of pair programming with my best friend. Fran and I decided study Android programming together, and join forces to build an app together from the ground up. This was one of the smartest decisions I could have made. Fran is doing 100 days as well, and is close to finishing. Closely working with someone going through the same battles and jumping the same hurdles as yourself helps put in perspective any one individual problem. If you don't know anyone personally that codes, I urge you exit your comfort zone and seek someone out. Use meetup and find a local group.

    3. Participate fully in the community The official site, www.100daysofcode.com, lists steps that you can take to increase your chances of success. One of those steps is to encourage others also participating. This is something you may not feel like doing every day, but I urge you to try. After dropping a compliment, or cheering someone on, you begin to become more and more invested. The more you put support out there, the more it will come back to you.

    4. The Pomodoro Technique I came across an interview with freeCodeCamp founder Quincy Larson on the subject of teaching yourself to code. The entire interview is great, and I highly recommend watching it in full. The relevant bit starts at 4:20. In the interview, Quincy explains the Pomodoro Technique. This technique is the practice of breaking your work down into 25 minute segments, followed by 5 minute breaks. As they mention in the interview, what happens is you commit to that first 25 mintues, and by the end of it, you want to keep going. This technique ended up be enourmously helpful, especially after long days at work and class.

    5. Constantly seek out inspiration Some days you just can't do it. Work was tough, school was long, you stayed up too late the night before. I've been there. I took about 20 days off during my 100 days. While I think some of those days off were key to remaining fresh, the truth is I was probably being lazy for some of them. Something I did to combat that was to seek out inspirational content. If I told myself I didn't want to code, I'd find a podcast, an article, or youtube video on interesting programming topic. I'd listen to a CodeNewbie or freeCodeCamp podcast about someone who overcame enormous odds and found a way into the tech industry. I'd listen to a Fragmented Podcast on an Android topic and be inspired to try and implement it myself. I'd listen to an Andreessen Horowitz podcast about the direction of the tech industry in general, and remind myself why I so desperately want to be a part of it. Every once in a while, you should pick your head up and remind yourself why you want this, who has done it or doing it, and that you can do it too.

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

    Scrapy : Python Web Scraping & Crawling for Beginners

    Posted: 17 Jan 2019 09:44 AM PST

    I am making a video series on Scrapy ( python library for web scraping ) which you can check out below

    Youtube Playlist - https://www.youtube.com/playlist?list=PLhTjy8cBISEqkN-5Ku_kXG4QW33sxQo0t

    Have already recorded 20 videos and will be uploading them on alternate days.

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

    Early Career People, How Can I Best Add Value to This Community?

    Posted: 17 Jan 2019 11:15 PM PST

    I've been a long time lurker of this, and related subs. Been in the industry for a few years now.

    Graduated university in Canada a year and a half ago, currently a Senior Engineer at a large software company in The Bay Area (Silicon Valley)  
     

    I'm looking for ways I can give back to this community.
    Specifically I'd like to add value to people considering a career in CS, currently in school, or just graduating.  
     

    What do you wish there was more of?

    • AMAs?
    • 1-on-1 conversations with someone knowledgable?
    • More guides/tutorials/videos on interview prep?
    • General information about what life at Big Tech Companies is like?
    • Something else?

     
     
    I know I wouldn't be where I am today if it wasn't for some great mentors in my life.
    If I'm able to help even one person with their career, I'll feel like this is successful.

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

    I can code but dont know how to make an app

    Posted: 17 Jan 2019 10:25 PM PST

    So I'm in my second year of University of Comp Sci. I know 3 languages enough to solve a fair share coding problems and make programs that lack a real GUI. I know since I'm asking this question, I still have a long road ahead of me in coding, but I wanna speed it up and want to make some apps even though I know I'll get there from University eventually.

    My main weakness is making files interact with each other and different user info. If I wanted to make a clone of Uber for example. Getting a login, validating it, storing user info specifically and for multiple users, maps integration, and the actual features, I dont know where to start. What would be the best way to learn?

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

    16 year old beginner looking for advice on what to learn and what resources to use.

    Posted: 17 Jan 2019 07:32 PM PST

    16 years old, recently got very interested in programming. I've watched some YouTube guides and practiced writing HTML and python so far. I really want to grind hard for 100+ hours in my free time and hone this skill, and possibly pursue computer science in university. What kind of study plan would you advise for someone in my position? I'd love to hear about useful websites or videos.

    Thanks!

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

    Github/Hosting alternatives

    Posted: 17 Jan 2019 08:58 PM PST

    Hello.

    I have been coding a few programs for a portfolio. But I am under the impression that anything posted to Github is shared with a community or usable in other peoples' projects.

    Basically, I am just looking for a free place to host my code, applets (Mac and Windows executables), etc. Does anyone have any good suggestions? I've never done this before. I don't mind other people looking at the code, but I'd rather it not be open-source or reusable without consent.

    Thanks and sorry if this is the wrong Subreddit to post in.

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

    Arranging objects in a matrix based on rules about their neighbors

    Posted: 17 Jan 2019 08:48 PM PST

    I have a 2D grid of X by Y dimensions that I want to fill with some number of objects that fit into 4 classes (A,B,C,U). I also have a set of rules about how they can be arranged (i.e. B's can't go next to C's. C's can only be next to one U, etc.). Conceptually, how do I go about writing a program that will fill in this grid if given a certain number of objects? I think I'm hung up in part because I'm not even sure of the verbage to use to look up this type of problem.

    For what it's worth, the end goal would be to define a "Current" version of the grid and then input some change in the # of objects (broken down by class) and have it output a filled in grid that's as similar to the "current" version as possible

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

    Just had my first product put into production

    Posted: 17 Jan 2019 12:42 PM PST

    No question, not self-promotion, just super excited. I didn't graduate with a degree remotely resembling computer science and I've never been through a code boot camp, I just scraped and clawed my way into my first programming position 2 months ago and was tasked with a super small UI. The thing is more or less trivial, it's only for use by other devs, and it was a very small codebase, but I could not be more excited about it!

    I just wanted to toss up some encouragement for those who don't have degrees (those who do as well, I suppose) that with a bit of hard work, you'll land the gig someday! And then once you're there, with a bit more hard work, you're going to do great!

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

    In C, it is said that spaces/white space doesn't matter, but how come this example of Hello World doesn't compile?

    Posted: 17 Jan 2019 03:51 PM PST

    From what I can read on the internet, spaces/white space doesn't matter in C. For example

    #include <stdio.h>int main(){printf("Hello World");return 0;} 

    will run fine

    But how come something like this doesn't compile?

    #include <stdio.h> int main() { printf("Hello World"); return 0; } 

    Shouldn't the new line be ignored? Is it a matter of the compiler I'm using? How can I reduce the length of my lines neatly, do you just have to rely on wordwrap of your IDE?

    submitted by /u/PyS-C
    [link] [comments]

    MVC- What is Model?

    Posted: 17 Jan 2019 07:51 PM PST

    Programming in java. Learning to use multiple classes to make my code more "clean". Someone recommended me MVC; I love it. I think I'm having trouble understanding what model means. Please correct me if I'm wrong.

    Let's say we have 3 buttons on a panel.

    Model would define it like, new JButton startButton = JButton(); But obviously define panel to but the button on and a window to add the panel to.

    View would display the button on the panel on the window.

    Controller would let the user press the button to go from the start menu to the next screen, and so the cycle continues.

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

    Write 256 in binary while padding the binary numbers with zeroes to the nearest four . bits?

    Posted: 17 Jan 2019 11:27 PM PST

    This isn't making any sense to me. How Am I supposed to write 256 and it says pad the binary numbers on the left with zeroes to the nearest four bits.

    The answer I got is 00000001 00000000

    How am I supposed to pad that to 4 bits? He makes no sense. You can't.

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

    [HOMEWORK] n-th composition of a function in python

    Posted: 17 Jan 2019 11:19 PM PST

    So the question is as such.

    "Implement the repeated function, which takes a one-argument function f, a positive integer n, and a parameter x. It returns the result of composing, or applying, f n times on x, i.e., f(f(...f(x)...))."

    So these are the functions I defined in global to use

    def identity(x):

    return x

    def compose1(f,g):

    def h(x): return f(g(x)) return h 

    def square(x):

    return x*x 

    I figured that I needed compose1 and identity to combine f and x together first and assign it to another name so that I can input the name into the function for it to repeat itself. Then I use a while loop to repeat that n times.

    so this is my code.

    def composition(f,n,x):

    counter = 0 while counter<n: 

    However, basically i got a lot of wrong answers and spent many hours trying to figure out what I don't know. Can anyone post some hints to guide me? Thank you very much!

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

    Converting byte array to hex string in java

    Posted: 17 Jan 2019 11:14 PM PST

    My program uses DatatypeConverter.printHexBinary to convert a byte array to a hex string, but my output isn't correct. The only difference between my code and the example code I'm emulating is that the latter uses Apache's Hex.encodeHexString, but wouldn't that give the same output?

    submitted by /u/rat-butter
    [link] [comments]

    Need recommendation of a library for a loop station...

    Posted: 17 Jan 2019 11:14 PM PST

    Hi!

    I'm new to programming with audio so I don't know how 'things' work yet.... But I don't want to pay 30$ for software I can possibly make myself(http://sonnit.co.uk/software.html)!

    Basically, all I need to do is:

    - Record audio into a buffer(simultaneously)

    - Play audio from the buffer(simultaneously)

    - Overdub

    So... What's the easiest library for me to get started? Oh... and language doesn't matter.... It's probably going to be terminal only anyways.

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

    How to create a VR game?

    Posted: 17 Jan 2019 11:11 PM PST

    I have no experience programming or crafting games. I aspire to create a simple VR game similar to beat saber. Where/how do I start learning how to do this? Free resources? Newbie topics?

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

    Medicine student,decided to learn programming

    Posted: 17 Jan 2019 11:01 PM PST

    I saw many videos recently showing the good things about coding and I actually feel that the end result of learning to code is fun.I had some very basic intro to programming in c when I was in high school but I don't remember shit.I may have a very minute level knowledge about what coding is but I am starting from scratch.

    I have decided on learning python.I know it can be used for app developments in android,but I cannot get the bigger picture.So can someone help me in understanding,like

    use "this"-to code Use "this"- to learn to code Use "this"-to make an app out of python Where I don't know what the "this" are.

    I don't know what more questions to ask too.So any help would be appreciated!

    Please and thank you

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

    [STUDY GROUP] Discord CPP C++

    Posted: 17 Jan 2019 10:46 PM PST

    G'day guys,

    Last week i formed a study group with a few randoms, and loved it, since it brings us all close talking about programming helping eachother out. Mainly for CPP (C++)

    We range in the ages of 18-30, personally im 21 myself.

    We are all at different levels, we are looking for a few more people to keep it fully active 24/7. We are looking for beginners, intermediates and advanced to help improve our code, and give us insights. After this post i hope the rest is just word of mouth

    We have keen people that are creating small projects as i type this message. Like a database system with cpp for a timetable, logging jobs, a lotto project and an unreal project

    If your keen hit us up, and ill chuck you the Discord invite IP'

    Legends

    SkinBruv

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

    I just finished my first project ever: DnD Dice!

    Posted: 17 Jan 2019 07:01 PM PST

    Hey!

    So I have been learning to code for about 3-4 weeks now, and I finally finished my first ever project! So I transferred into CS this semester (hence my only been coding for 3-4 weeks) and I left my DnD dice at home over break..

    So, I decided to write a program in python that lets me roll d20, d20+d6, d20+d6(*2) or d20+d6+d8!

    It's actually been really useful and I'm kinda proud of myself. I never thought I could do something like this haha.

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

    [C++][Programming project: Rock, paper, Scissor][Beginner]

    Posted: 17 Jan 2019 10:46 PM PST

    Hello, This project is my first CS project on C++, and I have been struggling a bit. The problem I am having is that I am supposed to created a Rock, Paper, Scissor game that have an User Input and the Computer Input.

    However, the Computer Input is to be randomly generated. For the computer to random generate, I used the command rand() % 3, so that it has a range from 0 to 2, and then I assigned 0-2 to corresponding rock, paper, and scissor for computer's choice. And, the problem is that the project requires to predetermined "carefully chosen" so that the computer wins or the human wins.

    Could anyone mind sharing a thought to help me in the line of thinking on how to predetermined a winner if the it's random? Right now, I have been using if-else if to compare each possible scenario separately, such as if the computer picks Rock and user picks Rock, and it will be a tie, and it's not working. Sorry for the long text and no written code, because I can't get access to a lap and have to post it on a mobile. I'm deeply appreciate any line of thinking to set me up to solve this problem. Thank you.

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

    Can somebody help me improve this baby app?

    Posted: 17 Jan 2019 10:38 PM PST

    https://github.com/jakehamtexas/Loan_Repayment_Utility

    I tried to make the smallest project possible, basically. I'm hoping for some feedback. Is there anything that's counterintuitive, hard to understand? Any feedback is very welcome!

    Project is written in C#, FWIW

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

    Question for the Programmers of Reddit

    Posted: 17 Jan 2019 06:36 PM PST

    Hello computer literate people!

    This is my first post on this sub, so please excuse any errors. I know absolutely NOTHING about programming.

    I am the Operations Director of a small non-profit that is branching out our scope of business. I am interested in developing an online platform (system?) that can is for internal use only as sort of a filing system. Think patient filing system type thing. I do not want to use one of the many already built ones out there, I would like to either learn to do it, or hire a programmer to build it specifically for our company. I just need help understanding exactly what I am asking for if I shall go to a professional. I hope I am making sense here. What would such a thing be called? Our company has a website, of course. But I am looking for an online management system to kind of organize all of our documents for each "patient."

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

    Creating an algorithm from a flowchart

    Posted: 17 Jan 2019 06:32 PM PST

    Hi, I'm completely new to programming/coding. What I'm trying to do is create a PDF or other web page or document that will populate certain sections of information based on the answers in a flowchart of scenarios. I am trying to create personalized documents for participants in a program, but I'm unsure how to take it from the flowchart stage and determining the limitations and end points of the chains of logic to something that actually will populate a PDF or other document. Any suggestions either on how to do it or what sort of information I should be searching for? I don't really know the correct terms for anything so I haven't really had much luck in my research.

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

    [API Fetching Help] For some reason I am unable to get the data out the api link I've been given.

    Posted: 17 Jan 2019 06:10 PM PST

    https://codepen.io/anon/pen/WLqeov

    I keep getting the error:

    index.html:1 Uncaught (in promise) SyntaxError: Unexpected token in JSON at position 2 

    You should know I am noob with API stuff and started learning JS about 1 month ago. So please be kind :).

    I just want to be able to get access to the data. Once I do, I'm confident in my own skills to use it!

    Sidenote: in the codepen, I obviously got rid of the api key I currently have. If you think it's necessary to have there for you to troubleshoot and help me, getting one is as easy as and free as going here and registering.

    submitted by /u/01123581321AhFuckIt
    [link] [comments]

    No comments:

    Post a Comment