• Breaking News

    Tuesday, December 26, 2017

    Coding idea: Write a command-line utility learn programming

    Coding idea: Write a command-line utility learn programming


    Coding idea: Write a command-line utility

    Posted: 26 Dec 2017 09:38 AM PST

    I wrote and published a command-line utility as a coding exercise a few days ago. I'm a self-taught developer and I had a great time coding it and learnt a ton. I think writing and releasing a command-line tool might be under-appreciated as learning exercise -- I think it may make a great addition to the curriculum of a self-teaching developer.

    • Coding a command-line utility allows you to focus on one, small but contained problem, and doesn't require much adjacent knowledge -- which decreases the risk of getting overwhelmed and abandoning the project. Your command-line utility can be just a single file written in a single language and still be a perfect solution to your problem. No more quitting before you even start because you can't get Webpack to work.
    • It lets you solve something relevant to you -- it's way easier to stay motivated when you're working on solving a problem you face as opposed to a generic problem you don't really care about. Completing coding challenges on HackerRank, for example, is great exercise but tends to get a bit boring. The alternative -- coding your own
    • A command-line utility doesn't have a GUI. This means you don't need to waste time designing anything! This was huge for me. Designing can be a real time-sink. UI and UX are already taken care of before you even start!
    • Building a command-line utility gets you friendlier with the terminal -- an essential tool in the well-rounded developer's toolkit.
    • It teaches you to release. There's a pretty clear point at which your command-line utility does everything you set out to code it to do. It is at this point you get the rare opportunity to practise an incredibly important auxiliary skill -- releasing. Besides the super cool feeling you get when you proudly release your finished product for the whole world to enjoy, finishing a project by publishing it builds your ability to finish more. It's an awesome antidote to the pernicious momentum that can build up if we start projects but never get around to finishing them. After I published a package to npm -- now I know how to share my code for everyone else to benefit from, I feel compelled to write more!

    Possible command-line utilities you could build, for three skill levels:

    • A converter or calculator. This is the simplest. If you're still quite new to programming, start here. Write a temperature, length, or time converter (how many hours is 9000 minutes?). Write something to calculate how much you spend on fuel for your car, or something a little more complex like how many of a given fruit to eat to get your recommended daily amount of a given nutrient.

    • A data storage system. This is a bit more complicated. Use a database, like SQLite, to store information, then get information about your information (this is the information age after all). Build a calorie-tracker if you're watching your weight -- input the number of calories you ate today, see if that number is going up or down. Or if you like writing, build a command-line journal which lets you write and save entries. It could track info like what your favourite words are, how much you've written this year, and how many words you write on average per hour of the time you spend awake.

    • An API wrapper for a website you use often, to let you consume the info you gotta consume from the comfort of your own terminal. This is a somewhat more complicated. Build a one-command weather-report if you check the weather often. A headline-and-summary-grabber if you're into the news. A twitter report. An ISBN lookup if you're into books. A BTC-USD price ticker to help you feel bad about yourself as you think about how rich you could be if you got in way back when. You may not even need an API -- try scraping the site if its robots.txt doesn't prohibit that.

    But those options are only the beginning. Try choosing something you know you're going to want to use -- if it makes your life easier, you'll have a far easier time creating it! If you're struggling to come up with something, try just watching the way you use your computer for a day or two. Notice patterns. If something is a repeated frustration, you may have found the problem to solve! For me, this was, when copy-pasting commands from the internet (stackoverflow <3), I often inadvertently copied the "$" preceding the command. I'd paste these into my terminal but the "$" would cause an error. This formed a pattern, which I noticed, and was then able to solve with a command-line utility I built to strip the "$" from pasted commands.

    Good luck and happy programming!

    PS: First post on Reddit! Let me know how I can improve.

    PPS: I'd love to write tutorials to help self-teaching developers! I was thinking of starting with a tutorial diving in to the details of how to plan, build and release a command-line utility if people want to read it. Maybe also a tutorial on Google's new boardgame.io -- I think that would be really fun. Also, maybe a tutorial on softer skills like how I landed an internship with a tech startup with just one cold email I wrote with my dad (lol). If think you'd benefit from this, please let me know, and I'll write it!

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

    Learn HTML/CSS and Javascript By Creating A Startup Website!

    Posted: 26 Dec 2017 04:10 AM PST

    How much should you upload for a github portfolio?

    Posted: 26 Dec 2017 07:52 PM PST

    Hello, I'm a computer science student who has started to work hard to learning coding itself, as I understand employers are looking more at what you've made instead of your GPA.

    My question is, what exactly is appropriate to be uploading to Github? Should I save it for when I get good enough to starting making "projects", or should I be documenting my progress as I do exercises in the books I'm following? Is it going to look bad on me if I upload stuff from my early days of programming, or do employers like to see the initiative and progress?

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

    Would like to find new friends I can learn programming with!

    Posted: 26 Dec 2017 01:18 PM PST

    Hello guys ! I started to self-study in HTML,CSS,JS about 1-2 months ago and it happens time to time I lose my motivation and to just keep going forward. So I thought maybe if I had online friends who is also learning or is already working with programming, we could help and motivate each other. I'm not sure if this is the right place to post this but I would really enjoy talking to people and help each other out. My discord Vookie#2473

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

    What language should I learn to code a quiz app for phones?

    Posted: 26 Dec 2017 06:00 PM PST

    I want to have an image or a few images appear, a question, and a multiple choice selection, and use sounds also. Please let me know everything I need to be set up with to make this program. Thank you.

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

    HTTPS And Multiple Applications On A Single Server

    Posted: 26 Dec 2017 03:12 PM PST

    Hello r/learnprogramming!

    TLDR below

    I am building a web application that uses loopback.io as a back end REST API, and Wordpress as the "front end". Both components are running on the same VPS. I'm still in development, so when I am working on the site, I manually SSH into the server to start and stop the API as needed. The Wordpress site is always available.

    I'm getting closer to deployment time, so I decided to set up https for both Wordpress and Loopback.

    I was able to activate my hosts AutoSSL features, and set Wordpress to redirect to https. This takes care of the website residing at my primary domain

    And I have followed the instructions here for setting up loopback to use https, using a new SSL certificate, which I believe is self-signed.

    Loopback seems to be happy responding on https now, but when I access an endpoint, chrome is declaring that it is unsecure. I'm pretty sure chrome is saying this only because the cert is self signed.

    My Questions:

    • Since my intention is for users to only use the wordpress site, is it safe to disregard chrome's warnings?
    • Is this a proper way to implement a two component system?
    • Should the frontend component be sending requests to https://localhost:port, https://0.0.0.0:port, https://domain.com:port, or possibly none of these?

    TLDR Question: What are some general tips for a two part, "frontend/backend", setup running on one machine.

    edit (clarification): I'm referring to Wordpress as a "front end" in this post. Wordpress is a Content Management System that runs on the server. I'm calling it a front end because it is acting as a layer between the users browser and my "business logic" application built with Loopback. Normally Wordpress is considered the back end, and any javascript that is sent to the browser is front end.

    edit (update): u/ziptofaf reply really cleared some of this mess up for me, and I hope it helps others in the future. His(?) reply convinced me that I needed to provide an ssl cert and key that had been generated by an established company.

    "Let's Encrypt" seems to be a really nice way to get Free SSL certificates, auto-renewed every 90 days, usually implemented with a command line tool known as certbot.

    Unfortunately I found that certbot is not recommended for systems using cPanel.

    with my Host, I was able to activate a similar plugin called AutoSSL via cPanel/WHM. This is how I had secured the wordpress site.

    Inside of WHM, I can actually view the public key and cert file contents. I copied these contents into new files, and set up my loopback application to use these new files on boot.

    This resolved the issues that I was having.

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

    An app for browsing Codechef questions and contests on android phone, especially useful for long challenges

    Posted: 26 Dec 2017 11:07 PM PST

    I have made Fridge for Codechef, an open source app for browsing codechef. Download the app at http://play.google.com/store/apps/details?id=fridge.site.tivra.fridgeforcodechef

    Download and browse contests and questions, and read them whenever you want without any ads.

    Do leave feedback and reviews.

    PS: This app was made especially for long challenges which go on for over a week. So having the questions accessible on your phone has been my motivation in making this.

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

    Where to start with PHP

    Posted: 26 Dec 2017 10:47 PM PST

    I promised my friend that I would learn how to program PHP, but I have no idea what exactly I should focus on learning. What are the most important parts of PHP to focus my energy on?

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

    What part of this javascript code for adding all numbers between 1 and base_number is wrong?

    Posted: 26 Dec 2017 10:45 PM PST

    Please! what is wrong here? It's not printing the sum even though I have a println(sum); in it! Thanks so much!

    function start(){ var base_number = readInt("What is the base number? "); adding(base_number); }

    function adding(base_number){ var sum = 0; for (var i = 1; i < base_number + 1; i++){ sum += i; } return sum; println(sum); }

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

    How I learned to program - by danluu

    Posted: 26 Dec 2017 10:42 PM PST

    New to programming, how do I download pip on windows?

    Posted: 26 Dec 2017 10:16 PM PST

    I've just started programming with "automate hte boring stuff with python" but I seem to be stuck with downloading pip.

    I have the file "C:\Python34\Scripts\pip.exe" however in the shell it doesn't recognize pip (says it undefined)

    How should I proceed from here?

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

    [LEETCODE BUDDY]: Looking for leetcode beginner buddy

    Posted: 26 Dec 2017 04:18 PM PST

    Hello, Anyone willing to get started on leetcode and is looking for a buddy? Please PM me we can work on questions together. As of now I willing to work on the easy problems.

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

    Geany and kivy for python

    Posted: 26 Dec 2017 09:54 PM PST

    In my computer class we use geany and kivy for python. I got a laptop and downloaded python, and I was wondering if geany and kivy are most commonly used with python, and what other applications work like them for python. What are they called. I would like to know so I can search for different applications like them.

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

    Algorithm Design Pattern: Bisection Method (Uber Binary Search)

    Posted: 26 Dec 2017 09:47 PM PST

    I am writing some articles for my self to properly understand some common algorithm design techniques. Here is one: https://gist.github.com/scotch-bright/af37a885e04ddd14da4984f6fe194a71

    I thought, maybe it would be helpful to others here. Will share more if people like them.

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

    Ocaml,I think I have installed it ,but ...

    Posted: 26 Dec 2017 08:20 PM PST

    Ok, I am by no means an expert on Ocaml and the only language I programmed in before was Java and C. I am trying to install Ocaml on my system by using the guide here! I have the Ocaml Icon on my desktop along with the Cygwin. What do I do from here? From my understanding you cannot write actual programs when you click on the O caml Icon and use that to compile the programs you have written, but where should I run the actual programs? Do I need to link the supposed text editor with the Ocaml compiler somehow? How do I "upload" my .ml files into the Ocaml terminal for execution and compilation ? Please excuse my lack of understanding on this subject as I am very clueless.

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

    JS/Any - Simulated Annealing, deciding when to accept neighborhood states?

    Posted: 26 Dec 2017 08:07 PM PST

    I've got a question about Simulated Annealing and accepting the neighborhood states. It's for a scheduling application run on Node.js. So far I've managed to generate an initial schedule based off of several hard constraints but would like to optimize it for soft constraints, if possible.

    function acceptSolution(currentSolution, neighborSolution, t) { if(currentSolution && neighborSolution){ if (neighborSolution < currentSolution) { return 1; } return Math.exp((currentSolution - neighborSolution) / t); } return 0; } //accept or ignore neighbor solution res = acceptConstraint(currentSolution, neighborSolution, t); if(res === 1){ currentState = neighborState; } else if(res > Math.random()){ currentState = neighborState; } 

    Would this work for both hard & soft constraints or should you only accept a worse state as long as the hard constraints are not violated? Such as a person not having qualifications to work a certain shift/position should not be assigned to it. Or accept it but revert back to the previous solution if the hard constraint is not corrected later in cooling?

    Also when generating neighboring states should I only focus on one constraint at a time or any/all?

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

    How important is it to know how to code if you want to work in tech?

    Posted: 26 Dec 2017 07:13 PM PST

    What are the career prospects for someone who doesn't know how to code, but wants to work in tech? Specifically along the lines of a startup, or for a company like Tesla?

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

    Summer program to learn programming?

    Posted: 26 Dec 2017 07:09 PM PST

    I'm a senior going to high school next year and I want to spend my summer learning to code (and animation). I've tried self studying but I can't stay disciplined enough to self study from that start so I want to study the basics in a classroom environment and then take it further myself before I take classes in college. The location doesn't matter as long as the program provides housing and as for price, budget is about $5000

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

    (Java)Exception Handling: Expecting an Int but receiving a String.

    Posted: 26 Dec 2017 07:01 PM PST

    I want the user to be able to put in a number and get back a response from my program, but what if they put an "F" instead of "3"? I need someone to show me how to set that up properly. My main Class is called Integrate.java and is in the file that I'm providing. Link

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

    Help on creating a program that fetches inputted data based on a phone # input.

    Posted: 26 Dec 2017 06:56 PM PST

    I am using eclipse to create a project for my dad that takes the last 4 digits of a phone number to display the customer's previous order.

    So I recently started coding (literally like a month ago) and I am currently creating a code that takes the user input of their last 4 digits of their phone number and uses it to fetch data from a stored location. I am unsure about how to set up a window that displays their previous order based on the specific input. I would like to have a page that displays all of the orders based on phone # after entering a password (I already set this up) but I do not know how to create a window that displays the information and in the same window, a way I can add the order information. I also need to be able to display the specific order to the corresponding phone # when a specific number is submitted. Any help one how I should go about learning how to do this/doing this in general? Thanks for all the help and please ask questions if you don't understand what I am asking.

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

    Is there a public API for traffic light data?

    Posted: 26 Dec 2017 10:00 AM PST

    My commute is mostly local roads with lots of traffic lights. So I want to make an app that tells me when the optimal time to leave my house is based on the traffic lights. Is there any way I can gather traffic light data? (Virginia, USA)

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

    [I've made some videos with algorithms tutorials and competitive programming solutions explained, Please provide feedback to improve](https://www.youtube.com/channel/UC4_UzoF8Wc7z-rg8KTn8hKw/videos)

    Posted: 26 Dec 2017 06:15 PM PST

    I've made some videos explaining solutions to some competitive programming problems and some algorithms here : https://www.youtube.com/channel/UC4_UzoF8Wc7z-rg8KTn8hKw/videos and would love to get some feedback to improve my next videos as i plan to do this regularly, i'm just starting so not a huge number of videos yet but would love some feedback on which ones benefit people most.

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

    Java - Comparing strings and submitting a response based on

    Posted: 26 Dec 2017 05:56 PM PST

    Hi all,

    I'm pretty new to Java and I'm trying to make my first text based game.

    The program asks the user for a string, then responds with a random string from an array. Kind of like rock, paper, scissors.

    So far, I have been able to get this far with the program. I'm having trouble figuring out a way to compare both the string provided by the user and the string that was randomly generated from the array, so that I can have the program respond with either a win, lose, or draw answer.

    Is this possible? I know how to compare strings from variables, but not from a random generated string from within an array and user input.

    Any help is much appreciated!

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

    What's the best way to make a responsive div?

    Posted: 26 Dec 2017 05:32 PM PST

    I am trying to make a div that scales based on the users screen size, but I'm not sure if I'm taking the right approach. Currently I'm using em for the width and height, but I feel like there's a better way.

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

    No comments:

    Post a Comment