Programming

sort of experienced web dev here, need some networking advice

Learn Programming - 12 min 25 sec ago

Hey there,

been a web developer for about 8 years and I just changed my job. This new project is very technical, on the cloud and relies heavily on networking knoledge. e.g. virtual networks, SDN, packet filtering, different network topologies, TCP/UDP, sockets, GRE tunneling and other protocols, etc. I feel like I need some books to help me, because even though I think my programming is ok, I don t have the networking know how for this. do you guys have any book recommandations in this direction?

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

C++ Youtube Channels like SentDex

Learn Programming - 13 min 12 sec 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 watched SentDex's series "Python Plays GTA V", where he coded a neural net that could self drive a car, and I found it extremely interesting. So I'm looking for similar series to watch in my spare time. Thanks!

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

How do I read a sentence a one character at a time?

Learn Programming - 49 min 11 sec ago

I need to write a program the reads what's entered and output the number of vowels, this is what the assignment says:

"Write a program that prompts the user to input a sequence of characters and outputs the number of vowels.

(Use the function isVowel written in Programming Exercise 2.)"

This is the input and output:

I1: The dog is fast.

O1: 4 vowels in this sentence

I2: Euouae is the longest English word consisting of all vowels.

O2: 20 vowels in this sentence.

I already did a bunch of code, the problem is that I'm not sure if this is the correct way to read a sentence one character at a time. I used cin.get(ch); because that's what I saw online (not sure if CPLUSPLUS, or stack overflow). I don't get any error messages but when I run it I think the while loop goes into an infinite loop after I enter the sentence.

When the assignment runs the program outputs this:

O1:

Input a sequence of characters: 32771 vowels in this sentence.

O2:

Input a sequence of characters: 32784 vowels in this sentence.

Also, the part that says to use isVowel is where I wasn't sure if I should use a switch and case or an if statement

PS: if you see anything else off about the code just let me know.

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

Why does this html file shows blank?

Learn Programming - 52 min 10 sec ago

This is my very first time using Javascript/html so it might be something extremely basic that I just don't understand.

I'm trying to reproduce the code written here (index.html). I downloaded the files from github, and I'm trying to run them. The problem is, when I execute the html in Chrome, the page that is opened is completely blank.

Why?

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

What are your best methods of learning code?

Learn Programming - 56 min 4 sec ago

if you could go back in time and could give yourself some advice when it comes to learning code? what would it be ?

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

Creating S3 utils file to be used in routes | Node.js

Learn Programming - 1 hour 6 min ago

I am trying to create a utils file in Node.js that will handle some basic AWS S3 operations. I have laid out my code below and the errors I am getting don't exactly exist so much as the code just doesn't work. I do get one error though about the upload function not being a function.

Whole Utils file

// Packages

var aws = require("aws-sdk"),

multer = require("multer"),

multerS3 = require('multer-s3');

// Config

var config = require('../config/config');

// AWS config

aws.config.update({

secretAccessKey: config.aws_s3.secretAccessKey,

accessKeyId: config.aws_s3.accessKeyId,

region: config.aws_s3.region,

sslEnabled: true

});

var s3 = new aws.S3();

var logoBucket = new aws.S3( { params: {Bucket: config.aws_s3.logoBucket} } )

// Exported functions

exports.uploadFile = (req, res, next) => {

var upload = multer({

storage: multerS3({

s3: s3,

bucket: config.aws_s3.logoBucket,

key: function (req, file, cb) {

cb(null, Date.now().toString());

}

})

});

next();

};

exports.retrieveFile = () => {

var urlParams = {Bucket: config.aws_s3.logoBucket, Key: '1537581218707'};

logoBucket.getSignedUrl('getObject', urlParams, function(err, url){

`});`

};

How I require them in my routes file

// Utils

var uploadFile = require("../utils/s3Files").uploadFile,

retrieveFile = require("../utils/s3Files").retrieveFile;

Example route using the uploadFile util

// POST COMPANY LOGO

app.post('/company/logo',

isAuthenticated,

isCompany,

uploadFile.array('file', 1),

(req, res) => {

});

Error to match the route

TypeError: uploadFile.array is not a function

Can anyone take a look at what I have and tell me why the utils/functions don't seem to work? They all work fine if directly in the routes file. I know the code needs to be changed so that they export and take in parameters but I am unsure how to do this when exporting each function alone. I just know how to do it with one per file and I rather keep it cleaner than doing that.

Sorry for being a newbie at this, trying to write more DRY code compared to previously. If no one can help guess I will go with non-DRY code since I have been at this for a few days now.

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

Why am I still getting output to stdout?

Learn Programming - 1 hour 7 min ago

I can't really understand why output of commands is still output both to STDOUT and file. Any ideas?

if (pid == 0) { int fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600); //Replace standard output with the file descriptor dup2(fd, STDOUT_FILENO); close(fd); int err = execvp(tokens[0], tokens); if (err == -1) { perror(strerror(errno)); exit(EXIT_FAILURE); } } else { wait(NULL); } submitted by /u/sitilge
[link] [comments]

The Python Paradox

Programming - 1 hour 53 min ago
Categories: Programming

[Java] What should I be thinking about when coding to achieve the fastest (or I guess lowest) run time?

Learn Programming - 1 hour 53 min ago

I joined this club that hosts contests on kattis and it's been fun but I noticed that whenever I solve a problem, I seem to always have an extremely higher "time" for each solution. I'm sure it's related to run time (correct me if I am wrong please) but I don't know what is considered faster when coding my solution.

For example, I had to take a string input that contained two ints and print the int that was greater of the two numbers' reversed values (135 input meant comparing as 531). At first, I thought about comparing each charAt from ends until one digit was greater or to use parseInts or something but then I remembered StringBuilder has a reverse method so I used a StringBuilder object. My code was right but the times other people were getting were in the 30s and 40s while mine was ~100.

I'm in my second year of CS and all my courses up to the beginning of this semester were more worried about getting the programs to be correct, no matter what solution you use. My courses are just now going into the finer details of the more optimized routes but we just started.

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

Help with contains method of HashSet in java

Learn Programming - 2 hours 14 min ago

I am implementing several solvers (BFS and A*) for n-puzzle. I am using HashSet for maintaining the closed list as the contains method has O(1) time.

My HashSet is a set of HashMaps (integer to integer), so I want to see if the HashSet contains the specified map. If HashSet's name is set and the HashMap's name is map, is it enough to write:

set.contains(map);

to check if both the keys and the values of map match with any of the keys and values of maps in the set?

Edit: If not, what way could be the fastest to check the values of map against a list of maps?

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

Android apps that help facilitate learning?

Learn Programming - 2 hours 15 min ago

I want to preface this by saying that I'm already learning at my computer. I'm learning web dev via a combo of Colt Steele's Udemy bootcamp and FreeCodeCamp. I'm getting in at least a couple hours a day, 5 days a week.

However, I'm not home most weekends. I'm afraid that, if I don't at least do a little bit of study on the weekends, I'll regress a bit whenever I get back to learning on Mondays. So, I'm looking for apps that can help me reinforce my learning while I'm not home.

I've already played games like Human Resource Machine and Algotica Iterations to death, so I have a lot of the fundamental concepts of coding down. I'd like something a bit more meatier. I don't care if it's not even focusing on web dev. I've toyed with Java, Kotlin, and Python as well.

I've done a bit of googling and I've found similar threads, but those are usually a couple years old, and some apps have gone down in aquality or require payments/have more ads. I'm also aware of the Udemy app, but I'd rather be at my computer for making progress on a Udemy course.

Thank you!

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

Using a language with limited regex functionality (like C or similar), what is the proper way to implement a "global string substitute" (like `s/regex/replacement string/g` in sed, Perl, vim etc.)?

Learn Programming - 2 hours 15 min ago

In sed/vim/perl, you can substitute all occurrences of a match with something like

s/old/new/g

or in Ruby, the equivalent:

string.gsub(/old/, 'new')

The obvious way to do it in C is a recursive/loop approach where you find the match location, replace, move the pointer, repeat:

I'm using ruby/python style pseudocode for brevity

new_string = blank_buffer match = regex_match(old_string, regex) if match new_string = match.pre + replacement_string // Update match pointers at start of loop // (it only scans each character once) while (match = regex_match(match.post, regex)) new_string += match.pre + replacement_string // concatenate remaining string after no more matches found new_string += match.post else // if no match found, just copy old_string new_string = copy(old_string)

This works fine for simple substitutions. The problems is this: when you use anchors indicating the start of a string or word like /^string/ or /\<string/, it can give false-positive matches when scanning the remaining, unscanned portion of the string; the remaining post_match pointer is treated as a new string, so it's always the start of the string and/or word.

The only solutions I have thought of are inelegant and ugly.

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

At a cross road between what programming path to take: iOS or Web Development

Learn Programming - 2 hours 41 min ago

So I've been toying around with programming for the last few months now, I have doing a little bit of HTML, CSS, and Swift/XCode.

I have really started to enjoy iOS development quite a bit, I like the feeling of creating apps because I always have the whackiest apps I want to create, it's a sense of pride. I recently made a very basic dice game and I was so happy.

I have no CS degree or education but I am taking online courses. I'm also considering doing a bootcamp. I've heard there are better job prospects for Web Dev compared to iOS and that spooks me a little bit considering I'll be dropping so much money.

I was wondering what this communities input on this is?

Also about a bootcamp. Now I know that I can learn EVERYTHING online for significantly cheaper or for free. But I've been looking into bootcamps and they seem good in terms of these things:

i) they have a structured syllabus with qualified instructors, if I ever get stuck on something I have someone to help me out instead of the feeling of frustration

ii) I can work with other people at roughly the same skill set as me

iii) (most importantly) the career services, they have connections with startups that at times look to hire students and also have services that help you find jobs post-grad. Basically I have direct access to a network.

Although it's expensive, I'm thinking of it as an investment in myself and my future career, much like my university education was at 4 times the price. Overall, this program doesn't start until january, so I still have until then to decide so I'm not rushed to spend the money.

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

Is it normal to give non-technical employees DB admin privileges?

Learn Programming - 2 hours 43 min ago

New dev here. I was talking to someone at a party last night who overheard I was coming out of a code program and corrected me in my pronunciation of “SQL.” They told me they were a project manager but didn’t have a technical background themselves.

They said they had to “fix the databases” regularly because the devs were incompetent at their job and they had to do a lot of work with SQL. I was kinda surprised and asked if they used a some sort of DBMS and they said they didn’t. I asked if they had any coding background using an ORM or something and they said they “just wrote the SQL”. While it is certainly possible, I was kinda surprised they had that kind of access and ability without any technical background. A lot of stuff didn’t make sense but I’m new to this field so I didn’t push the issue.

Is it common for someone in a non-technical role to be doing this kind of work with these kinds of privileges?

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

Anyone know how to use NumericUpDown by reading the text file?

Learn Programming - 2 hours 57 min ago

So basically , i have 1000++ records of shareholders list and i made a "Numericupdown" key to scroll it 1 by 1. But im struck on the code page .

Would be appreciate if someone can help !

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

Pages