Programming

PYTHON Getting urlopen errors even though the url works

Learn Programming - Tue, 06/19/2018 - 08:58

I've created a webscraper which iterates through url's, however for some of the urls I get a 404 error or this error:

<urlopen error \[WinError 10060\] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

even though if I tried the url myself it would load up fine, it doesn't do this with all urls just some, and it's not the same one everytime they change.

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

A basic introduction to TypeScript

Programming - Tue, 06/19/2018 - 08:55
Categories: Programming

6 Reasons to Choose Node.js for Web Development

Learn Programming - Tue, 06/19/2018 - 08:45

Node.js has been successful since it was launched. Many developers find it perfect for building fast, multi-user web applications. As you may know, Node is written in JavaScript.That is why it is very easy to learn if you know JavaScript. In this article, you are going to get a list of reasons to choose Node.js.

1.Building real-time applications in Node.js

Do you want to create a chat application? Or maybe a gaming site? To build that kind of apps, Node.js is the best option for you.It is also a good choice for apps that need an event-based server and non-blocking driven servers. Popular websites like PayPal, Yahoo, Ancestry, and Quizlet use Node on their servers.

2.Speed

Google created fast V8 JavaScript engine for their browsers. Node.js uses it too. For you as a developer, only thing to worry about is writing proper code, and Node will take care of the speed.

3.Code reusability

Creating web apps in Node.js is much easier thanks to NPM(Node package manager). Developers can easily share and reuse their code with NPM. There are many useful packages out there, including packages for security, file uploading, databases and more.

4.One programming language for everything

Another reason why Node is game-changer in web development is that developers can use same programming language on both client- and server-side. This feature does not only save time but also helps to synchronize different data automatically between server and client.

5.Data streaming

Node.js allows you to access a particular file while uploading it. Developers who work with real-time audio or video encoding benefit from this. If you want to create a streaming app like YouTube or Twitch, it is very easy in Node.js.

6.Express.js

Express is the most popular Node framework. Express.js is easiest to learn when comparing to other Node frameworks. It provides a wide variety of middlewares for all kinds of purposes.Two reasons why I would choose Express over other Node frameworks:

  1. It is very easy to handle middlewares.
  2. You can use Node.js native HTTP classes in Express.

I recommend you to try Node.js if you like JavaScript. You can skip learning curve of another programming language if you choose Node for your back-end technology.Leave a comment if you have any questions. Share this article if you liked it. Also, check out these video tutorials by Traversy Media if you are interested in Node:

https://www.youtube.com/watch?v=U8XF6AFGqlc

https://www.youtube.com/watch?v=gnsO8-xJ8rs

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

Failed c++ Theory exams but did good on all my c++ practicals, any advice?

Learn Programming - Tue, 06/19/2018 - 07:58

Hey guys!

So some input beforehand.. I do have Programming experience OOP related i started with C#(and still going strong with it for over 3 years), before that i did a lot of web development and some Python.

So this year in our Univeristy they started us with C++. The first semester i did good. But now at the end of the year a.k.a the second semester for me, i failed all my 3 theory exams. But did almost perfect on all my practicals. And i feel kinda discouraged. I'm unsure if it means im a bad programmer or ? What should i try to improve?

I often can explain most of the stuff that we study, but with my own world, but when asked in a textbook manner i totally flunk. Which i believe caused a major problem here. I'm totally dumfounded and i don't know what ot think. All the theory exams failed, but the practicals were all good ;/

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

[TortoiseSVN] How do you move a local repository?

Learn Programming - Tue, 06/19/2018 - 07:46

Hello, I am new to TortoiseSVN but I have experience with source control. I currently work as government contractor. The work I do is secret and thus my workstation has no internet. It is connected to a secure network. So my supervisor tasked me to edit his MATLAB code. I did and I want to use TortoiseSVN to keep track of the changes I did. So I made and saved a local repository to my user folder. After doing this, making changes, and committing my changes I realized because this is my supervisors code, it would be better to have the repository in his folder(because what if I leave or get a new job? My folder would be deleted).

Is there anyway to move a local repository? Is there a way to move a local repository? Do i have to make a new repository? Is it possible to make a new repository and import the changes previously made?

Thank you and I look forward to responses.

Edit: spelling

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

[C] Multiplication of two 8 bit integers and bit shift

Learn Programming - Tue, 06/19/2018 - 07:34

Hi!

I have a question regarding the following C code snippet:

uint8_t a = 128; uint8_t b = 128; uint8_t x; x = a; // x = 128 x *= b; // x = 0 because 128*128=16384, mod 256 = 0 x >>= 8; // x = 0 because 0/256=0 x = (a * b) >> 8; // x = 64 because 16384 / 256 = 64

I came across this when looking for a linear interpolation method for two 8 bit integers. I'm wondering why the last line gives a different result than the step by step calculation. It looks like the compiler keeps the product of a and b as an 16 bit and shifts this 16 bit number, but I do not understand why. All involved numbers are 8bit, so shouldn't the product also create an 8bit number?

I tested this with GCC on Ubuntu, and also with avr-gcc for an 8bit AVR.

Is this the "correct" behaviour, as intended by the C standard? If it is, where can I read about this?

I'm definitely wanting the last lines behavior, but I'm unsure if I can rely on it, or if it's an artifact of some sort.

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

How do you manage and store your Utility functions/classes and snippets you collected over years?

Learn Programming - Tue, 06/19/2018 - 07:10

Do you just copy & paste or store in git repo and if so. Do you have one repo for all or separate repo.

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

Pages