• Breaking News

    Friday, October 19, 2018

    Handmade TCP/IP packets learn programming

    learn programming

    Handmade TCP/IP packets learn programming


    Handmade TCP/IP packets

    Posted: 19 Oct 2018 10:16 AM PDT

    Hi there,

    I recently wrote a tutorial series about how to manually create TCP/IP packets. Although it's not for complete beginners (you should have some general knowledge about networks), it is very beginner friendly.

    https://inc0x0.com/tcp-ip-packets-introduction/

    Content/chapters:

    1. Recap on network layers and protocols
    2. Analysis of a raw TCP/IP packet
    3. Manually create and send raw TCP/IP packets
    4. Creating a SYN port scanner

    Have fun!

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

    Just wanted to share with some of the people who are learning

    Posted: 19 Oct 2018 09:46 PM PDT

    Tonight someone came to me with a problem, they had performed a lab and the data they collected was given in raw format from some very old machine, the file was some kind of text file. I told the person than I could most likely write a script that can clean this up and i can return it to them in a useful form (csv). I got to work using Python 3, i quickly searched online (thats what coding is all about) i looked at numpy, and pandas, after 5 minutes of googleing and some background knowledge in programming i had finished what the person was looking for.

    Im sharing this story since i know many people here are looking to learn and often dont know where to turn. This is a great example of something small (not necessarily easy) that you can try to do. Come up with something small that is bothering you or your friends or family and try and write something that can help this person out. When looking for jobs these small projects can help out (maybe not this small) but as you get better your projects bigger and those will help you get better.

    If you are struggling through a problem now or stuck on some code, or simple need guidance feel free to reach out. I hope this post is helpful to even just one person.

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

    I'm really proud of this Web Effect I wrote today

    Posted: 19 Oct 2018 03:42 PM PDT

    I'm an aspiring Front-end web dev, and I've been learning for about 4 months now. Today, I wrote this in about 40 minutes! I feel like I've made tons of progress. I'm really proud, and I was wondering if anyone wanted to add advice on an easier way to get the same affect.

    HTML, JS, CSS https://jsfiddle.net/wLutvd51/1/

    edit: Man, I would love to see how other people would implement it. here is another way: http://jsfiddle.net/gFcA9/770/

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

    Coding Interview Anxiety

    Posted: 19 Oct 2018 10:20 PM PDT

    I know this is definitely not unique but I'm currently in my sophomore year of college, studying Computer Science. I have been applying for internships non-stop and now have been looking forward to hopefully passing the resume screening and moving on to an interview.

    However, I bought the Cracking the Coding interview book and the premium membership of leetcode and I can't do a single bit of it. It's all going completely over my head. The only bit of data structures I have learned is arrays.

    What do I do from here? I'm going to keep rereading and hope something sticks but I really want a better solution. I can't even do the easy problems on leetcode and now I feel even farther behind.

    How can I start from the bottom and work my way up to understanding even the easier problems? Thank you guys.

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

    Losing sleep over this MS interview question. Send help pls

    Posted: 19 Oct 2018 06:07 PM PDT

    So a buddy of mine got this question for an INTERNSHIP at microsoft and its absolutely killing us.

    This is supposed to have an O(n) solution. Here's the question:

    You're given an array of x and y coordinates representing trees (the whole Cartesian plane is a forest where you are standing at the origin) and you are also given an angle representing the field of view. Find the best direction to look into given your field of view to see the greatest number of trees at once. Assuming the trees have negligible width (so no tree blocks a tree behind it). Also, the Trees represented by the X and Y coordinates are not ordered in any specific way .

    So the best solution my friend and I could think of was 1) create an array of angles representing each tree (the angle from the tree to the origin) 2) sort the array (because the Trees were given in an arbitrary order) 3) walk through the array in a sliding window fashion (representing the field of view) to keep track of the maximum number of trees. This was N*logN because of the sort. My friend remembers the interviewer mentioning there exists an o(N) solution (but maybe he misspoke?).

    I've added a diagram hereto help explain the question. Remember, the field of view is arbitrary but a set number and we're looking to find the best direction to point the field of view in order to observe the most trees at once.

    Thanks and good luck.

    P.S. my buddy did not get the internship. pls press f

    EDIT: Thank you to /u/dig-up-stupid and /u/lightcloud5 for mentioning that bucket sort can run in O(N+K) which would bring our time complexity down to O(N) if the number of trees was greater than the number of significant figures in the tree angles

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

    Counting letter occurences in a string (C++)

    Posted: 19 Oct 2018 08:37 PM PDT

    Hello everyone! I am a fresh Computer Science major new to programming and I am having some time with a particular section of my homework. I have a programming assignment that prompts a user to input a string of up to 132 characters in length. The program then counts out the amount of uppercase letters, lowercase letters, and numbers from 0 to 9 in the string. The program would use a function to count the letters and another function would output the count. The counting output would look something like:

    a - 6

    b - 2

    c - 1

    d - 0

    I have set two single-dimensional arrays with a constant size of 132. One array takes in the input from the user while the other array is what counts the letters. I have no issue passing the input into the array using cin.getline, but I can not seem to get my code to count each individual letter in a string. I've used a setup with 3 for loops within one for loop, and within each nested for loop, setting an if statement within them. The if statement says if specific segments of the array are equal to the ASCII values for uppercase, lowercase, or numbers, the counter should increment for each time a specific letter shows up.

    Here's what my code looks like at the moment (note it only includes my attempted loop for counting lowercase letters, it also does not include anything for output yet, that part does not concern me):

    #include <iostream> using namespace std; void Counter(char c_input[], int l_count[], int &num_count); int main() { const int size = 132; char CharInput[size] = { 0 }; int LetterCount[size] = { 0 }; int number_counter = 0; cout << "Enter a string of up to 132 characters in length: "; cin.getline(CharInput, size); cout << "You entered: \n" << CharInput << endl; Counter(CharInput, LetterCount, number_counter); system("pause"); return 0; } void Counter(char c_input[], int l_count[], int &num_count) { for (int i = 0; i < sizeof(c_input); i++) { for (int j = 97; j < 123; j++) // loop that scans lowercase ASCII values { if (c_input[i] == 97 + j) // if array contains the ASCII value 97 + j num_count++; } } } 

    I really just want to understand how using ASCII values to find specific letters can count each time the letter shows up. If anyone could provide some suggestions as to how I should be setting up these loops, please let me know. Thank you all for your time!

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

    for those currently attending bootcamps or bootcamp graduates - many say be prepared to study for 60-80 hours a week, whats the schedule break down like?

    Posted: 19 Oct 2018 10:57 PM PDT

    I'm curious how bootcamp students student 60-80hrs a week and what their schedule is like.

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

    Bootcamp vs CS Degree, at 27 years old

    Posted: 19 Oct 2018 06:48 AM PDT

    Hey guys, I've read the FAQ and I'm looking for some thoughts in regards to my situation.

    In 2010 I attended University of California, Santa Barbara as a computer science major. During that time the only actual computer science classes I took were Intro to Python, followed by a class that used C++. All the other classes were in calculus, physics, chemistry, and electives. That was in 2010-2011, I ended up leaving the school to join the military because I didn't want to go further in debt at such a young age.

    Since then, during the little free time I've had when not deployed, I have taken the CS50 course, numerous tracks through Treehouse, as well as a few tracks in Codecademy.

    Next year I will be getting out of the military and can either finish a CS degree, or go to a bootcamp in my area. The bootcamp is one of 5 bootcamps in the US that accepts the GI Bill. So I won't have to pay tuition, and I'll actually make $2100 a month to attend. I would be 27 with marketable skills, and have the ability to build connections while in the course.

    The other option is to finish the last 3 years of a computer science degree, however 3 years is a long time, and the degree itself doesn't seem as worth while at this point considering at that same point I would have 2 1/2 years of on the job experience, opposed to no experience and a degree. However, with the degree I would have a deeper understanding of the theory behind solving problems with computers, and that piece of paper definitely looks good.

    Which route would you go in this situation? I'm heavily leaning towards the 6 month bootcamp that focuses on HTML/CSS/JavaScript for the first 3 months, then dives into .NET and C# while working in an operational type environment during the final 3 months.

    I would like to work as a full stack developer and eventually transition to whatever's needed for the company I work for or the market. Any input you can provide would be much appreciated. Thank you!

    EDIT

    I am more than thankful for all of the replies! I appreciate your input.

    Bootcamp: Nashville Software School

    The college route: Nashville State Community College for one year, then to Vanderbilt for completion.

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

    Which problems to practice if you want to learn Dynamic Programming?

    Posted: 19 Oct 2018 05:50 PM PDT

    Hi,

    I'm preparing for interviews and I think I know how to do a good range of problems relation to data structures. However, one type of problem I cannot seem to solve is the dynamic programming one. I know the concept of DP, I know when I should probably use it, but I don't know anything else, like what my first step should be or anything else.

    From what my friend told me, most dynamic programming questions asked in interviews will be variations of maybe 10 or so problems (for example the Knapsack problem or Longest Increasing Subsequence problem). In your experience, which dynamic programming problems should I practice on so I cover the most ground on this topic for my interviews? The biggest reason I'm learning this is to help me with my interviews, and I know that most DP problems asked in interviews won't be too rough, but I think I should still practice some of the questions so I have it down.

    I've been told the only way to improve with DP is simply to practice. If I knew which problems to start with, that would be a great motivation for me to learn!

    Thanks all.

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

    List index out of range error(python)

    Posted: 19 Oct 2018 08:21 PM PDT

    My code-

    c=[ ] j=int(input ("enter number of inputs you want")) for i in range(1,j): c.append(int(input("enter value"))) if c[i]%5==0: print("number is divisible by 5") 

    Whenever I run this, I get error "list index out of range" Why I am getting this error?

    I was able to do the same program with the filter function...

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

    AI Chess

    Posted: 19 Oct 2018 11:40 PM PDT

    Hello Guys I am newbie in terms of learning AI, and I saw this site to create AI Universe

    https://medium.freecodecamp.org/how-to-build-an-ai-game-bot-using-openai-gym-and-universe-f2eb9bfbb40a

    Which led to experimental time and I followed the instructions and did it on lubuntu 16.04. I did everything and installed everything need and when the step import universe came up it says Import Error: No module named benchmarks

    Anybody can help me? Thanks

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

    Easily download courses from Lynda.com with a subscription

    Posted: 19 Oct 2018 11:34 PM PDT

    I love the high quality courses put out by Lynda.com and I've used them for a few years now. A Lynda.com subscription has also become easier to come by, especially since you can get it for free with most library cards.

    One thing I don't like is the lack of decent ability to download the videos and view them offline, even with a premium subscription. They do have apps on the various OS platforms but I find them quite lacking. As such, I figured out a way to download full paid-for courses with a handy little utility called youtube-dl.

    I created a Github Gist that goes through:

    • downloading and installing youtube-dl
    • passing your Lynda.com authentication details to youtube-dl to give you access to premium videos (without which, you will only be able to download free videos)
    • downloading your full course with one command
    • the command also organizes the course into structured folders by chapter and in the order which you should watch; rather than just throwing all the videos into one folder.

    This information is available freely but is all over the place, that's why I decided to compile it all into one Gist.

    You can get the Gist here: Download and Organize Lynda.com Courses with Authentication.

    If you have any edits or additions that could make the Gist better, do let me know in the comments below.

    PS: I am not affiliated in any way with Lynda.com

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

    [Java OOP] .. cannot be referenced from a static context

    Posted: 19 Oct 2018 07:45 PM PDT

    public class Egg { private int i; Yolk y = new Yolk(); // no problem class Yolk { public void setI(int value){ i = value;} } public static void main(String[] args){ Egg e = new Egg(); e.y.setI(5); System.out.println("i="+e.i); Yolk y = new Yolk(); // 'Egg.this' cannot be referenced from a static context } } 

    Why can I do Yolk y = new Yolk() in Egg without Yolk being static, but Yolk has to be static for me to make an instance of it in main? Isn't Yolk in Egg when I make it in main, thereby no problem? To make a Yolk in Egg in main(), with how it is currently, I'd need to do this:

     Egg egg = new Egg(); Egg.Yolk yolk = egg.new Yolk(); 

    But leaving it how it is, I'd need to be making class Yolk with the static modifier. Could someone explain this?

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

    CS50: Web Programming with Python and JavaScript - Opinions?

    Posted: 19 Oct 2018 08:25 AM PDT

    Is the course as good as the CS50 Intro?

    I just finished the CS50 Intro, should I go through this one or are there better alternatives?

    Also, any tips on how to go about this course? which sections to focus more on, etc.

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

    OpenGL (GLFW & GLAD) isn't loading windows correctly. [GCC Terminal] [VS Code] [Linux]

    Posted: 19 Oct 2018 11:21 PM PDT

    I'm compiling my code using GCC and a text editor but I'm really not used to it. Does anyone know how to get OpenGL to open up a window?

    I'm compiling my code into a .out file, using GLAD and GLFW, and I am including the libraries: -lGL, -lGLX, -lGLU, -lglfw, -lSDL2, -lSDL, -lX11, -lXxf86vm, -lXrandr, -lpthread, -lXi, -ldl, -lXinerama, -lXcursor. I'm also on an Arch based OS.

    (GLAD also won't initiate, which I suspect has to do with the window.)

    submitted by /u/Doctype_-
    [link] [comments]

    Is there a more elegant solution ?

    Posted: 19 Oct 2018 11:07 PM PDT

    So i have an array of enumerators, and i want the user to be able to insert values into the list via text input. So they way ive designediss as follows

    1. Take input
    2. Split input into an Array of Strings
    3. For loop through the new array of strings
    4. convert each String into an enum via ValueOf and insert into array of enums.

    I feel like there should be a more elegant soloution but i have no idea what it could be.

    this is the code

     String stringarr = in.nextLine(); String[] arr = stringarr.split(","); for (int i = 0; i<arr.length; i++) { i++; Components[i] = Component.valueOf(arr[i]); } 

    Thansk

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

    IDEs that have auto space formatting feature/shortcut? Netbeans has that for Java, but I forget the key combination

    Posted: 19 Oct 2018 05:04 PM PDT

    There's a feature in Netbeans (not sure about other languages as I only used Java) where your code is automatically spaced and indented neatly for you, just by pressing a certain combination (I think it was Ctrl + Alt + C? I don't have netbeans installed atm so I can't test it, and I can't seem to find it online, but I know for sure there was a feature like that)

    I'm looking for other IDEs with this feature. I have no problems with netbeans, but I'd like to try as many IDEs as possible just in case there's one out there that suits me more.

    As a side question, do you know of any IDEs with this feature that work well with Python? Since indentation is more important in Python than other languages, I'm not sure if it'd still work. If you know of any please let me know!

    Any recommendations at all are welcome and appreciated!

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

    [Python} Generating 10 elements column vectors

    Posted: 19 Oct 2018 04:57 PM PDT

    I want to generate all 10 elements column vector which's coefficients add up to 10. So far I have tried:

    comb = combinations(10*[0,1,2,3,4,5,6,7,8,9,10], 10)

    m=[]

    for i in list(comb):

    v = sum(int(k) for k in i)

    if v == 10:

     m.append(i) print(m) 

    but it's really slow

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

    Rearranging bits

    Posted: 19 Oct 2018 10:37 PM PDT

    If you have 3 number a,b,c, in how many ways could you rearrange the bits of a and b such that a+b =c

    For example, if a = 1, b=2, c=3

    Answer = 2

    (a=1, b=2 and a=2,b=1)

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

    Need help for dependency files.

    Posted: 19 Oct 2018 10:30 PM PDT

    I am trying to convert .py to .exe in python 3.6 using pyinstaller. And the conversion is taking place successfully and also working in my PC but as soon as I am transferring it to other PC , it is asking for .dll files.

    So can someone guide me as to how to make it work in other PC.

    Side note I am using tkinter to build frame. If that is important to know.

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

    I'm so confused, outside of web and app dev, what do software engineers do at a company

    Posted: 19 Oct 2018 06:30 PM PDT

    My exposure to Computer Science was primarily through app dev, building a product but what other types of software dev roles are there besides web and app dev within a company? Do they also build software for internal users like maybe those in marketing?

    I guess what I'm trying to get is that people say every company needs developers, but what would a developer at a non tech company JPM Chase do besides web and app dev.

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

    How does this heuristic function work? It is frustrating me so much I feel like crying.

    Posted: 19 Oct 2018 02:32 PM PDT

    Hello everyone. This is a code I found online on numerous websites that solves 8 puzzle games. In the middle of the code, there's a function called "heur" that returns a number to assist the heuristic search. What I don't get though is how does this "heur" function work when it does not take into account the goal??

    It does not read or compare to the goal (goal entered by user at time of execution) so how does it calculate it regardless of the goal?

    The code is quite long. So here is a link to it.

    This is the function confusing the f out of me: Please help ;-;

    int heur(int* block) { #ifdef H2 int to_return = 0; for(int i=0; i<9; i++) { to_return += abs((i/3) - (block[i]/3)); to_return += abs((i%3) - (block[i]%3)); } return to_return; #else int to_return = 0; for(int i=0; i<9; i++) { if (block[i] != i) to_return++; } return to_return; 
    

    No comments:

    Post a Comment