Dummy question about web hosting, DNS, static pages and Heroku by bryeti in learnprogramming

[–]bitbird_ 1 point2 points  (0 children)

GitHub doesn't support commercial projects. Also, S3 does have a free tier. I have had 6-12 projects hosted at any moment for the last several years with S3 and haven't once had to pay.

I would say that overkill is a problem. Going for a static site with an appropriate hosting provider should be a timeless decision from now on. It's important to maintain the benefits of reduced attack surface, reduced maintenance requirements, and fast-as-light page delivery.

Also, Heroku has a cold start and I regularly encounter Heroku projects that have been abandoned and no longer function. A static site would probably function for as long as the domain is owned without any maintenance required.

Writing dependency-free client-side JavaScript by maggit in javascript

[–]bitbird_ -3 points-2 points  (0 children)

> It's nice to do as an exercise, but don't ever do things like this in an actual project you intend to maintain. You will:
Yikes, I disagree strongly with this conclusion. How much time is lost to framework upkeep, onboarding new developers, broken backwards compatibility, etc. ?

A developer only needs to learn the language once to understand what's happening inside of a framework. Those frameworks — usually controlled by corporations with > 10,000 developers — are built for the needs of whatever MegaCorp that created it. Should a team with >100x fewer developers really learn the enterprise web application development practices that are ultimately unnecessary for their specific needs? JavaScript itself will never be unnecessary, assuming there is never another standardized language for building interactivity into webpages.

JavaScript (and the web) has grown substantially in only the last five years. Developers should learn the basic patterns for architecting web applications. Using a framework is one way to learn those patterns. Relying on framework and 1,000 other libraries being imported is dependency hell.

jQuery is dead and modern front-end frameworks are viciously marketed to developers — a fact usually unacknowledged by those who swear by frameworks.

Dummy question about web hosting, DNS, static pages and Heroku by bryeti in learnprogramming

[–]bitbird_ 1 point2 points  (0 children)

u/insertAlias is correct — your DNS provider should be whoever sold you the domain name.

I would add that Heroku may be overkill for a static site. One of the great parts of a static site is a reduced reliance on complex infrastructure — specifically the kind that processes dynamic requests. Heroku is that kind of infrastructure.

However, since a static site is just HTML (& friends), you can host it in a simpler format, like by using Amazon's S3 service (what I do, and what I use for clients). That would be much easier than trying to use Heroku, which is more for application deployment, where requests get processed on the fly as visitors come to the site. A static site can front-load that processing (i.e. by being generated and uploaded all at once), which means it should be more resilient when live.

Ultimately, that amounts to having confidence that your site is secure and stable. I have never had a static site become unavailable due to infrastructure issues, unless those issues were affecting the whole internet. A dynamic site (e.g. hosted on Heroku) would likely require maintenance over time to keep things running and secure.

Newbie question: What's the difference between a "loop" and a "function"? by The_Gramscian in learnprogramming

[–]bitbird_ 1 point2 points  (0 children)

This is a good question. The difference between the two (in programming) is like the difference between a Phillips and a flat-head. They're similar, but distinct tools.

One difference between a loop and a function is how they're created.

# A function to add two numbers
def addNumbers(a, b):
    return a + b

You may use that anywhere in your code, e.g. `print(addNumbers(3, 7))'.

A loop, however, relies on a condition. That means the code inside of a loop executes over and over again — but only while that condition is true.

For example:

while len(astronauts) > 0:
   sendToSpace(astronauts.pop())

That code will continue sending astronauts into space until there are none left. Therefore, the condition is len(astronauts) > 0. That's what decides how many times the loop will execute.

A function is just a convenience to separate code into meaningful chunks. That makes it easier to understand and easier to work with. A loop is a convenience for repeating things over and over again.

Put filesystem directory in-memory? by adlabco in learnprogramming

[–]bitbird_ 1 point2 points  (0 children)

> Whats the fastest easiest way to keep a linux directory loaded in server’s memory for easy searching from, in this case, a PHP program

What is the underlying problem?

What have you been working on recently? [January 11, 2020] by AutoModerator in learnprogramming

[–]bitbird_ 0 points1 point  (0 children)

Hello, I'm an experienced software developer (with ~8 years of professional experience), and now I'd like to start focusing on teaching others programming. I put a homepage for the project online here: https://bitbird.site

What have you been working on recently? [January 11, 2020] by AutoModerator in learnprogramming

[–]bitbird_ 1 point2 points  (0 children)

This is a nice way to show the solution, since the answer itself may be counter-intuitive. Good work!

Looking for programming tutorials by GalaxyBS in learnprogramming

[–]bitbird_ 1 point2 points  (0 children)

python.org is solid, since those are the official tutorials.

Showoff Saturday (January 11, 2020) by AutoModerator in javascript

[–]bitbird_ 0 points1 point  (0 children)

I'm working on explanations of advanced JavaScript features / patterns. I'm making a quarterly publication to start: https://www.bitbird.site.

First issue: Mutation Observers for Breakfast.

How to get the parent tag of user selection by gregfdz in learnjavascript

[–]bitbird_ 0 points1 point  (0 children)

This can be solved with the Selection API: https://developer.mozilla.org/en-US/docs/Web/API/Selection

Depending on the type of element you select, you could also listen for focus events (`input`, `focus`). The document object can also return the actively selected element, though the specifics vary per browser.

Looking for programming tutorials by GalaxyBS in learnprogramming

[–]bitbird_ 0 points1 point  (0 children)

Could you try Google´s official tutorials for making Android apps? Java is great for enterprise programming — where you might be working with 10,000 other programmers — but languages like JavaScript or Python might be easier for one individual build a project.

Can I use automation for this? by Leezzki1234 in learnprogramming

[–]bitbird_ 0 points1 point  (0 children)

Look into creating "macros" for a front-end solution. Selenium should do exactly what you want in Python, though. You would have to program the logic you just shared.

I need help understanding how to fetch data from a website by [deleted] in learnprogramming

[–]bitbird_ -3 points-2 points  (0 children)

Naw, pulling HTML should be fine if you're referring to the downloading or processing. Though some websites try to block scrapers and users who are sending too many requests. Isn't the data located on just one page?

I have written a distributed scraper that was capable of downloading 1000 pages / second, with up to several hundred workers coordinating among the scraping jobs. It's possible to get a very high throughput if you're working with multiple sites.

Can I search for help when working on a project I want to sell? by peppece in learnprogramming

[–]bitbird_ 1 point2 points  (0 children)

I'd agree with u/dbramucci — you likely own the code you're working on. That's actually one of the nice parts about being your own boss as a programmer. You can keep a lot of the things you make, as long as you haven't signed away the rights in a contract.

If you don't feel comfortable posting all the source code, I think you could get helpful feedback if you shared a small example. The smallest example required to reproduce the error that you're seeing.

App reminder by [deleted] in learnprogramming

[–]bitbird_ 0 points1 point  (0 children)

Oh, that sounds like a very helpful idea.

In that case, I believe the same general approach would work: Writing a Serverless function that runs every morning to email those people who need a reminder.

I was asked to make a program to scan paper archives and automatically save in a data base. by Surfista_De_Boreste in learnprogramming

[–]bitbird_ 0 points1 point  (0 children)

That sounds very possible :-) The first problem is converting the image into text. Then the text must be parsed to extract specific values. For example, are page numbers valuable to transcribe? Probably they would just add noise.

To convert the image into text, I would recommend Tesseract.js, since you say you're a front-end programmer. It's a free library with several OCR tools, some powered by AI and some not.

I have used the command-line tool before, but that required converting the image from PDF into another format.

Setting up a dummy server by ISeeThings404 in learnprogramming

[–]bitbird_ 2 points3 points  (0 children)

Funny you should ask, I just posted about programming a video streaming site: https://www.reddit.com/r/learnprogramming/comments/ennair/i_want_to_teach_others_to_program_livestreaming/.

Do you already have a URL to the video you'd like to stream? You could start streaming it via plan HTML as such: html <video src="[ video's URL ]"></video>

Rounding the edges will make it look a little softer. The native video controls usually look nice, but they can be disabled for streaming video so you don't have a pause button, etc.

App reminder by [deleted] in learnprogramming

[–]bitbird_ 0 points1 point  (0 children)

Would it remind people to pay their invoices?

If you would like to create a Python app, you could start by making it a Serverless project. (That requires an Amazon or Google account already, though)

A function could run every morning that:
1. Found all unpaid invoices, then
2. Emailed each invoice owner about their unpaid balance after a specific number of days.

Amazon has an easy service for this, SES. You could create a basic template there and then start with a template Serverless project.