Programming

Need explanation for a regex that checks if a string starts and ends with the same vowel

Learn Programming - 2 hours 46 min ago

Hello reddit! I need some help regarding the following regex:

let re = /(^[aeiou]).*\1$/

I've read the regex documentation on mdn, fed the regex to https://regex101.com/ and read the explanation on it. Yet I still can't wrap my head around what .* does in the expression. Any explanation or clarification is greatly appreciated! Thank you!

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

Writing algorithms for beginner

Learn Programming - 2 hours 53 min ago

Hello guys i was watching a video on youtube about thinking like a programmer and they say that writing algorithm makes programming alot easy and i want to learn to write algorithms and is there a book or way i should learn ???

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

[100% Off] Build A Complete CMS App Using Angular 5

Learn Programming - 3 hours 39 min ago

Hello everyone,

Dive right into Angular 5 fundamentals with this course that starts at the very beginning, and is a great resource for anyone – whether they are familiar with Angular (other versions) or not. With Angular continuously gaining ground as a popular front-end framework, it is becoming an essential skill to have for developers around the world.

What you will learn in this course:

  • Introduction to Angular 5 and its documentation
  • Going over crucial commands such as components, directives, pipes, services, classes, guards, interfaces, enums, etc.
  • Go over the Angular 5 documentation including forms, validation, routing & navigation, etc.
  • AngularFire Tool component

    All of this and so much more is packed in this amazing course. So, what are you waiting for? Enroll now! -

http://www.onlinecoursesupdate.com/2018/09/eduonix-build-complete-cms-app-using.html

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

Called function counted up the iterator of the calling function as well (same name) is this normal? Happened in google script

Learn Programming - 3 hours 46 min ago
function myFunction1() { var newArray = sheet.getData var a = newArray.length //2 for(i = 0; i < 2; ++i){ newArray.push(0); } return newArray } function myFunction2 { for (i = 0; i < 2; ++i) { console.log(i) //0 for (j = 0; j<2; j++) var someVariable = myFunction1() { }

What happens is that the nested loop is executed correctly. However the first loop in myFunction2 exists prematurely because the variable i is counted up by the for loop in the called function (myFunction1) as well. If I change the variable from i to k in the for loop for the called function (myFunction1) the problem is fixed and the loops in myFunction2 execute correctly. How does that happen, shouldn't the called function operate with its own copy of i ? I is not being returned. All that is being returned is an array.

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

C++/Java YouTube tutorials that teach using projects

Learn Programming - 4 hours 33 min ago

Hi,

I'm looking for recommendations for YouTube playlists where a person completes a programming project and finishes it all on YouTube.

I like watching other people code and seeing possible stumbling blocks and how they solve it. Also I learn more by seeing a high level project and watching people break it down and code it bit by bit.

Examples:

- coding a torrent client (teaches internet protocols),

- games (teaches data structures & a ton of other stuff)

- virtual election booth/bank system (teaches security)

I also recently watched "Python Plays GTA V", where a person coded a neural net that could self drive a car, and I found it extremely interesting. So I'm looking for more series to watch in my spare time. Thanks!

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

"How to Begin Thinking like a Programmer" by Andy Harris

Learn Programming - 4 hours 53 min ago

This is a must watch for All beginners no matter what language you are learning

https://youtu.be/YWwBhjQN-Qw

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

Just starting to learn programming, it is so hard, am I just dumb?

Learn Programming - 4 hours 53 min ago

I am just starting to program. I installed eclipse and it was a pain in the ass to install Java. I have tried to install python and get it running on eclipse, but it is so hard and I keep running into problems. I go to look up a solution, but then when trying to go through the solution, I get another problem and that keeps going in circles. So I eventually gave up on trying to install python so I am trying to learn Java instead.

.

There are other issues with trying to install other add settings so I just left them and try to get started

.

When I try and to "run" I get this error message:

"An internal error occurred during: "Compute launch button tooltip".

org/python/pydev/navigator/elements/IWrappedResource"

.

And there are 0 solutions pertaining to my problem on the internet. If you search that error on the internet, there are only 6 results...

.

It all so hard and I feel so dumb. It took me a week to install eclipse and Java, I still cannot install python, and I am always getting error messages that I can never solve. I am currently a physics major, and I need to be able to program because there are not many job prospects after graduating without being able to program. This is really all stressing me out and making me sad and depressed.

.

If I cannot even install python and am already having trouble with doing the basics, am I too dumb and should just not pursue learning to program? Can someone actually be "too dumb" to program?

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

Should I learn Fortran?

Learn Programming - 5 hours 29 min ago

Hey y'all. Physics major here, planning to pursue a PhD after I finish my bachelor's this year.

I've become well-acquainted with Python and MATLAB (and AutoHotkey to a small extent). I asked my professor if I should try to learn Java as well—I was under the impression that Java was common in STEM environments. But he told me that it would be more practical in our line of work for me to learn Fortran. He said that it's one of the most common languages used in STEM today.

Can I get a verification from anyone on this? Is it worth it to devote my free time this semester to learning Fortran instead of, say, Java or C?

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

Why filter2D in OpenCV gives different results than imfilter in Matlab?

Learn Programming - 5 hours 33 min ago

I have an original image: https://imgur.com/a/m9ZRikY

I then read it, create a PSF, and blur it in Matlab:

lenawords1=imread('lenawords.bmp'); sigma=6; PSFgauss=fspecial('gaussian', 8*sigma+1, sigma); PSFgauss1 = PSFgauss/max(PSFgauss(:)); PSFgauss2 = PSFgauss1/sum(PSFgauss1(:)); lenablur1=imfilter(lenawords1, PSFgauss, 'conv'); lenablurgray1=mat2gray(lenablur1); imwrite(lenablurgray1, 'lenablur.bmp'); imwrite(PSFgauss1, 'PSFgauss.bmp');

I then applied a few mathematical operations:

ratioA = imfilter(lenablurgray1, PSFgauss2, PSF, 'replicate'); ratioB = lenablurgray1./ratioA; ratio = imfilter(ratioB, PSFgauss2, 'same'); disp(ratio(91:93, 71:75)) 1.0641 1.0808 1.0935 1.1027 1.1091 1.0961 1.1128 1.1254 1.1343 1.1403 1.1206 1.1371 1.1493 1.1577 1.1631

I then tried to apply the same mathematical operations in OpenCV. I checked the results for ratioA, and ratioB, and noticed they were the same or very close to the variables with the same names in Matlab. However, the result differs for ratio:

Mat img = imread("lenablur.bmp"); cvtColor(img, img, cv::COLOR_BGR2GRAY); img.convertTo(img, CV_64F); cv::Scalar s=255; divide(img, s, img); cv::Mat kernel = imread("PSFgauss.bmp"); cvtColor(kernel, kernel, cv::COLOR_BGR2GRAY); kernel.convertTo(kernel, CV_64F); cv::Scalar kernelsum = cv::sum(kernel); divide(kernel, kernelsum, kernel); Mat ratio; Mat ratioA; Mat ratioB; filter2D(deconv, ratioA, deconv.depth(), psf, Point(-1, -1), 0, BORDER_REFLECT); divide(observed, ratioA, ratioB); filter2D(ratioB, ratio, ratio.depth(), psf, Point(-1, -1), 0, BORDER_REFLECT); for (int r = 90; r < 93; r++) { for (int c = 70; c < 75; c++) { cout << ratio.at<double>(r, c) << " "; } cout << endl; }

the result for ratio is:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

I suspect the values for ratio in OpenCV could also match the values for ratio in Matlab, but were rounded down somehow to int values instead of remaining double. Why did this happen, especially since the values for ratioA and ratioB were not rounded down in OpenCV?

submitted by /u/74throwaway
[link] [comments]

Pages