• Breaking News

    Thursday, April 18, 2019

    Career Change: I Did it For the Money learn programming

    Career Change: I Did it For the Money learn programming


    Career Change: I Did it For the Money

    Posted: 17 Apr 2019 08:36 AM PDT

    tl;dr: business major working in healthcare now has masters in CS working as a developer. Took me 7 years.

    Background

    I came to /r/learnprogramming in 2012, some time after I got out of college with my BA in business. After months of unsuccessful job searching, I found my degree didn't actually teach me any hard skills. It definitely didn't bring recruiters banging on my door offering $100,000/yr jobs like I had been led to believe my whole life. It did make me feel like I not only wasted 4 years of my life but also took on $40k worth of pointless debt. I just felt that there was something wrong when I was jumping all over the chance to make $15/hr in a HCOL city at 22.

    I was/am an avid redditor and at the time I kept reading about programmers making gobs of money. Seeing posts about people learning how to program in only a few months gave me hope that I too could learn just as fast and cash in on the sweet, sweet dev money.

    I was wrong. So, so wrong. People suggested Codecademy so I tried that. The javascript course at the time seemed so basic that I was able to get through it but I didn't even feel like I learned anything. People on here were saying python was one of the easier languages so I tried that. As soon as I saw weird things like "__init__" and people describing it as a "blueprint" (I still hate this description) I was lost. That was when I decided I wasn't good at teaching myself (yet) and needed more structure. I enrolled in an Intro to Java course at a local community college near the end of 2012 or beginner of 2013.

    I graduated a couple of weeks ago with my MS in Computer Science and am currently a Software Engineer at a great company, earning a solid salary just like I'd been dreaming of so many years ago.

    I always enjoy reading career change posts and so I wanted to share some of my experiences/thoughts in case it helps anyone else going through the same thing.

    On Getting Jobs Quick

    I see quite a few posts on here and other subreddits talking about how he or she learned to program in a few months and were just hired as a full-time dev. Initially, those stories discouraged me and made me feel dumb. I was learning but there was no way I felt ready for job after only a semester or two of intro to programming courses. Now days, I read them and understand that they're extreme outliers.

    I wholeheartedly believe there is no way to become an expert developer in three months unless you're some kind of genius. There's just so much to learn and a lot of it comes from experience, even if you are genius, I still would be hard pressed to believe you'd be making meaningful, solid code contributions right away.

    If those types of posts discourage you, I would say to not worry about it. People learn differently and at different speeds. It took me 7 years before I became a full-time dev but you know what? I'm able to go into work every day and feel confident in my decisions because of all that time and work I put into educating myself. It doesn't hurt my ego to say that I do need some structure when learning new concepts or that I take a bit more time to learn things than others. Eventually, I'll get there if I put in the work and so will you if you do the same.

    Education

    This took the most time for me. Coming from a business degree, there were a lot of prerequisites I needed to complete before I'd be considered for most computer science programs. Courses such as multiple semesters of programming, data structures, algorithms, calculus and also the GRE were all needed. I was taking anywhere between 8-12 units a semester but it still took me a couple of years since I was also working a full time job. By the time I decided to apply, I still didn't have all the prereqs needed for a lot of programs, it was sad.

    When it came to Second Bachelor's vs Master's, I decided on the Master's. This was mainly due to the fact that Second Bachelor programs are rare in my area (I wasn't able to find any credible, online ones), financial aid is severely limited (which I needed), and the one program I did find had extremely strict prerequisite requirements that would take 3 years for me to complete before I could get into their 2 year second bachelors programs. With the Master's programs I found, there were a lot of credible ones that had online and in person available (Colorado State, Georgia Tech, DePaul, and more), financial aid was easily available, and I had read that bachelor's + master's looks better than two bachelor's on a resume.

    The program I chose was 100% online but also allowed you to go to class in person. This was perfect since I was working full-time and the quality of the courses were good for the most part. My degree is the exact same as the ones that "normal" students get so definitely consider online if you haven't.

    Advice before applying to colleges if you do: Look at their actual requirements before you take any prereqs. Some programs may not require any prereqs so you may not need to spend time on knocking out prereqs.

    The program I chose didn't require a lot of the prereqs I took because they make students take foundation courses before you start the actual program. If I had done research before had, I probably could have gotten in earlier than I did. However, a lot of my prereqs did end up transferring so I was at least able to save some money.

    Education was by far one of the most difficult parts about my journey. There were quite a few all nighters and I was constantly studying not just course material but other sources for different self imposed projects.

    Experience

    Experience is king now days. As soon as I was accepted into the Master's program, I immediately started looking into internships. At this time I had made multiple job hops and making almost $70k in an unrelated industry so I'd likely be taking a dock in pay. After reading multiple threads on MSCS new grads unable to find a job since they had an advanced degree but no experience, I figured less pay would be worth it.

    I had a hard time finding internships, although I only applied to maybe 10-15. I got one callback and I felt like I completely bombed the phone interview. I remember tripping up the difference between an object and a class...ugh. After giving up, I got a call three weeks later saying they were impressed and wanted to me to come onboard for the summer!

    The internship experience was amazing. Not only was I able to get a taste of developer life but the team was incredibly smart and helpful. I learned so much more than I did learning on my own and even in school (version control, frameworks, etc).

    Another benefit was being able to secure temporary status after the internship was over. They told me they'd be unable to offer full time employment until my degree was finished but they could just keep me on as a temp until then. If you find yourself in a similar situation where you need to work, I highly suggest asking for this type of arrangement.

    Eventually they brought me on full time as they said and now I also have a couple years of developer experience on top of my Master's degree (this also helped a lot when it came to negotiating)

    Bottom line is the world won't end if you don't get an internship before you graduate but you really should try your best to get one.

    Doing it For the Money

    People are always parroting that you won't go anywhere if you only do this for the money. I sort of disagree with this statement.

    The money was, and still is, my primary reason to work as a developer. However, it did eventually turn into a hobby and something I truly enjoy doing. If programming makes you miserable then you should consider that it may not be the job for you. There are a lot of different computer related jobs that don't require coding experience which may be of interest but you shouldn't be dreading going into work everyday.

    The problem with my business degree was that it gave me a lot of broad knowledge and soft skills. When I got out of school, I didn't even know what jobs to look for (let's face it, there are no high paying "business man" jobs that only require "general business knowledge" or "talking to people" skills on job boards). While sort skills are incredibly important in and outside of workplace, my advice is to pick up a hard, in demand skill (programming, nursing, plumbing, car fixing, etc) and pursue it relentlessly. These not only will make you way more marketable but even if you don't like it, it's something to fallback on while you pursue other passions.

    Final Thoughts

    I feel like it took me a lot longer than most people to make this career change. So don't look at my 7 years as if it's the norm but don't think that going from zero to developer in 3 months is either.

    If I could go back to when I first started college, I would have done more research on which careers would be in demand/pay the most and decided on major accordingly.

    Try to get an internship, seriously.

    Thanks for reading. If you have any other questions about my experience feel free to ask!

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

    Looking for a group to learn Programming with from ground zero

    Posted: 17 Apr 2019 03:25 PM PDT

    Hey I'm Dill! 27 years old and looking to switch careers and become a software developer. Currently taking edXs CS50 class but I'm looking at a few free absolute-beginner courses to continue with afterwards. It'd be great to have a group to learn with and motivate each other along the way. I'm primarily interested in Back End but I've heard that it may be easier to start out and obtain a first job with Front End. Below is a list of a few courses I've found on this sub. Send a DM if you're interested in taking the leap with me!

    Odin Project is free and covers Web Development basics, HTML, CSS, Ruby, RoR and JavaScript. - https://www.theodinproject.com/home

    Microsoft's Entry Level Developer Program is also free (non cert version) and looks pretty comprehensive for software development. You start with Python and move to JS then Java. - https://www.edx.org/microsoft-professional-program-entry-level-software-development

    You learn HTML, CSS, and and JavaScript just like the Odin Project. Seems to be a highly rated and recommended course here on r/learnprogramming for Web Dev. Only $10.99. -https://www.udemy.com/the-web-developer-bootcamp/

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

    We have to create a website that uses php and MySQL, I am almost clueless how to proceed

    Posted: 17 Apr 2019 04:59 AM PDT

    For our school project, we need to make a teacher evaluation website using php and MySQL. We can do the HTML website, but I do not know what's the next thing to do.

    I tried to install MySQL, and I i think I did it properly. However, I encountered an error related to Ms visual c++. I can't install it properly as it gets stuck on windows81_x64 .

    I tried to install php, I have no idea if I did it correctly. I downloaded a zip file and then extracted it to c:/php but apparently I have to do some other things like download a dll that doesn't exist in the website they linked me to.

    And is Apache necessary? From my understanding, MySQL is the database but I do not know what the real purpose for php and Apache. Our website doesn't need to be saved on the internet/web as far as I know. I just saw that Apache seems to be always related to php.

    I just really need help please, thank you.

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

    Are there any good Phyton tutorials for beginner?

    Posted: 17 Apr 2019 06:08 AM PDT

    I do not know anything about coding, but I would like to learn as a new hobby. Does anybody know any good tutorial? Any help will be greatly appreciated. Thank you.

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

    Tips for learning programming through boot camp.

    Posted: 17 Apr 2019 10:06 PM PDT

    I am going to attend a boot camp for data structures and algorithms in java. To make most out of that 2-3 month long course what should I do before during and after the classes?

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

    [Java] Why is Student obj = new Math() instead of Math obj = new Math() assuming Math class extends Student class.

    Posted: 17 Apr 2019 06:21 PM PDT

    When to use the former and the latter?

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

    Looking for resources to learn about hosting a website that can only be accessed from my own wifi network and about sending files to and from the website.

    Posted: 17 Apr 2019 05:59 PM PDT

    I'm new to anything web related so I want to make a website that can only be accessed from my wifi network because I don't really know anything about security so I don't wanna leave myself open to attacks. I'd like to be able to send files to the website and have them be stored there and I'd like to be able to download files from it that I've sent. Also, I'd like to do as much from scratch as I can so if there's resources that skip a lot of the process by downloading a tool I would like to avoid that. If it helps with recommending resources I have written code in C for a year for college now but I'd prefer to use java or something other than C for this project if that is possible.

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

    What programming language should i pick up as an Industrial Designer (Product Design)

    Posted: 17 Apr 2019 07:36 PM PDT

    I am currently working as an Industrial Designer working on product development projects, and i am thinking of picking up a coding language that could help me with some of the projects.

    I am hoping to learn a programming language to develop a mobile phone app that could control a product through wifi or bluetooth. Perhaps something that would work with a Raspberry Pi or an Arduino kit for prototyping purposes? Any help appreciated, thanks in advance!

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

    Python class/import confusion

    Posted: 17 Apr 2019 05:10 PM PDT

    I rarely ask questions (bad habit I know), most of the time with enough googling and breaking
    things I manage to figure things out.
    I'm learning c and this has made me view python in a new light and has me looking at things under the hood,

    So I was looking at the source code for the random.py module in the standard library.
    Ive used random.randint, and random.choice etc
    a lot over the years and figured they were just regular functions.
    After messing around I saw they were methods bound to the Random class.
    Cool.
    but I thought with, randint for example being a method I'd have do some initialization. As in:

    obj = random.Random() ran_int = obj.randint(1,10)
    I'm sure I'm missing something obvious
    Anyone care to help break this down?

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

    I wrote my first Ruby gem and it was pretty awesome!

    Posted: 17 Apr 2019 10:52 PM PDT

    So full disclosure, it was actually an assigned project for a bootcamp that I am doing but I got to design it from the ground up (that is to say it was not a 'pre-canned' project). The rules were to make a command line interface for a website scraping application using OOP design patterns in Ruby. So I ended up scraping www.asciiart.eu (which is a pretty awesome website if you were around for the 'early days' of the internet).

    Ultimately I am stoked for the final product, but I have to admit that I probably could have structured the application better. This was the first time I have designed my own OO program, and I was constantly second guessing what was the right or the wrong way to do something. Doubly so when it came to architecture of the objects. I would love to share the gem but I think it is against the sub's rules. If you are interested in seeing my application PM me and I'll share it with you.

    As a data analyst, I spend more than half my time writing code but typically it is very procedural. Creating an object oriented application is very different way of thinking about performing tasks and solving problems. Writing a OO application was really challenging but also super fascinating and rewarding. For all you guys out there who are starting to get comfortable with the basics of programming, I highly recommend that you make learning about object oriented programming a priority. It is super powerful, but takes a long time to wrap your mind around.

    Good luck!

     ,'``.._ ,'``. :,--._:)\,:,._,.: All Glory to :`--,'' :`...';\ the HYPNO TOAD! `,' `---' `. / : / \ ,' :\.___,-. `...,---'``````-..._ |: \ ( ) ;: ) \ _,-. `. ( // `' \ : `.// ) ) , ; ,-|`. _,'/ ) ) ,' ,' ( :`.`-..____..=:.-': . _,' ,' `,'\ ``--....-)=' `._, \ ,') _ '``._ _.-/ _ `. (_) / )' ; / \ \`-.' `--( `-:`. `' ___..' _,-' |/ `.) `-. `.`.``-----``--, .' |/`.\`' ,','); SSt ` (/ (/ 
    submitted by /u/Allenfp_
    [link] [comments]

    Web Scraping with Beautiful Soup & Python - A Beginner's Project

    Posted: 17 Apr 2019 11:32 AM PDT

    Hi guys, a week or two ago I made a post about web scraping as a great first step to learning to code and specifically to learn python. You can really be off the ground making something of practical utility with very little time invested.

    Although the last example was great I wanted to show everyone how to make a project that can actually be useful in someway using some of this information. I personally find that the best way to learn is by doing something that I can find some practical usefulness in.

    So, this time around I wanted to show you guys a truly practical intro project that you can get started on and something similar to what I have been paid for in the past. Now this project is a simplified version of what I made because I can't give away proprietary code for clients for free. That said, it should get you going down the road to building something that can be very practical.

    Video Tutorial Link - https://www.youtube.com/watch?v=-31Or1HSmyo

    Our Project:

    This project is going to show you guys how you can very quickly and simply create a tool that will monitor a Shopify website by accessing the hidden API, and then (in part 2) automatically purchase any good (including rare limited release goods) from the store as soon as they are available.

    The first video will use the hidden API plus requests and beautiful soup with python to get information and monitor for goods. The second video will show you how you can make a purchase automatically with basic web automation using python and selenium.

    Why This Matters:

    There is a large market for rare collectible shoes that is currently booming. Me and my partner have been contracted multiple times to build systems similar (but slightly more complex) than this in the past and paid good money for it.

    If you can start with the basic example that we show here, you may be able to get more contracting type work with python, start a small buy and resell business or just learn some practical points of a project.

    Whatever you choose to do with the information is up to you!

    I really hope you all love the content as always, part 2 should be up and posted within the next day or two. So if you like our content it would mean a lot to us if you were to subscribe to our channel :)

    Also feel free to let us know what you think about the series in the comments below. Did you get stuck and need help getting unstuck? Feel free to ask and we will do our best to answer!

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

    Help Me :( making a new Language

    Posted: 17 Apr 2019 04:40 PM PDT

    Hi guys!

    I'm taking a Languages and Compilers class and I have to create and compile a new language for my final project.

    Just wanted to survey some people from the sub to see what u do and don't like in some commonly used languages.

    If anyone has any language ideas as well, I'd love to hear about those too!!

    Thank you!!!

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

    What is the best way to turn articles into HTML?

    Posted: 17 Apr 2019 09:58 PM PDT

    I'm trying to build a website from scratch using plain HTML, CSS, and JavaScript.

    It's just a personal website, and I want to regularly post some articles or photos.

    Currently I'd like to dynamically generate a list of articles using JS.

    The structure should be something like this:

    |__ index.html |__ index.js |__ articles |__ article1.txt |__ article2.txt |__ ... 

    The main idea is to transform those files in article directory into something I can use in index.js or index.html . They don't even have to be a .txt .

    In each article (e.g. article1.txt), I'd like to store data including the content, date, title, ... etc.

    I've tried hard code some strings in those articles. Those files were named article1.js, article2.js and so on.

    And they have something like this:

    var str = "This is the content of this article."; export default str; 

    And import them in index.js .

    But this feels sooooo weird to do. If I want to add a new article, I need to code those things every single time.

    So maybe let them stay as .txt files?

    But is using JavaScript to load files a bad idea? Or is JavaScript designed to do so?

    Because when I google it, I find things like AJAX, which I don't quite understand.

    It's not as easy as I can do load files in Python or C. (What is the key difference between these languages and JS?)

    I know there's a thing called JSON files for storing data, but I'm also not sure what it is for.

    I guess I'm not seeing the big picture.

    If I can't use JavaScript to turn them into HTML or whatever useful, what is the proper way to do so?

    Thank you for answering in advance.

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

    Finding sum question

    Posted: 17 Apr 2019 09:51 PM PDT

    Given an array of integers, return indices of the two numbers such that they add up to a specific target.

    I did the naive O(n2) approach and was looking at other solutions, one that involved using a (hash)map. It makes sense now, since it only costs O(n) to put all the numbers in that map, and I don't remember the lookup speed, but I remember it being fast.

    I don't get this part though:

    public int[] twoSum(int[] nums, int target) { ... for (int i = 0; i < nums.length; i++) { int complement = target - nums[i]; if (map.containsKey(complement) && map.get(complement) != i) { <<< this part /* found it */ } } 

    I get the compliment - element part, but why is the second conditionmap.get(complement) != i? What happens if the second number happens to be the current iteration??

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

    Hard time learning C

    Posted: 17 Apr 2019 09:33 PM PDT

    I'm a 26 year old guy, just had my first semester as an engineering physics undergrad. Among my core classes, which I'm doing well in, I'm taking a 'programming for engineers' elective where i'm learning the C language. Long story short, the professor offered me an 'incomplete' this semester because I was struggling all the way through and I really want to become proficient in programming C this summer.

    Here's what I've been having trouble with, the class is structured and mainly graded on 10 submitted programs and 3 written exams. When I'm trying to write a program, I will get stuck on one part until I go to his office hours and he helps me through, I wouldn't be able to figure it out myself. I could've studied more/better for my first exam, and I aced the arrays portion of my second exam, but screwed up the 'functions' part because I focused on studying arrays. I wont be taking the final because of the 'incomplete' so I can really start from the beginning and master these concepts.

    It sucks because this is something I want to learn for personal and professional use. I want to be good at it. My professor says it just 'clicks' sometimes and that i need to use my analytical mind instead of trying to reverse engineer learn or trial and error learn it (which i guess i do). I plan to take study skills tutoring since I havent been to school in a few years. And just spend more time studying the material this summer. Half ranting, half asking for anyones opinion or similar experiences?

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

    My method for reversing a word isn't working.

    Posted: 17 Apr 2019 09:27 PM PDT

    I'm doing a tutorial and they asked me to reverse a word. Now they're asking the same thing but in a method but for some reason it won't work.

    package problem56_reversestring; import java.util.Scanner; public class Problem56_ReverseString { public static void main(String[] args) { reverse("Hello"); } public static void reverse(String word);{ int nameLength = word.length()-1; int namevar = -1; while(namevar<nameLength){ System.out.print(word.charAt(nameLength)); nameLength--; } System.out.println(); } } 

    Thanks

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

    I started a series on more advanced SASS/CSS topics, and cover things I wish I learned when I started out. This is the first post in the series, about mixins. Hope it can help somebody!

    Posted: 17 Apr 2019 09:27 PM PDT

    I've spend thousands of hours learning how to organize and create logical and reusable CSS code. I know this is a topic lots of beginners struggle with, and I still struggle with in some capacity. We have well established tools to help us with this, so it's great to learn them in more depth!

    *To sum it up:* you can use mixins to outsource similar chunks of logic into reusable 'functions'. You may know this already, but there are ways you can use them to greatly reduce code. 3 examples I cover(with some example code) are spacing, mixins, and common alignment classes.

    Here's the post on my blog, hopefully it can help:
    https://bparkerproductions.com/getting-sassy-3-useful-ways-to-use-sass-mixins/

    Taking any feedback and suggestions for more content, thanks!

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

    What is the best language for simple physics simulations?

    Posted: 17 Apr 2019 09:26 PM PDT

    Hi! I'm a physics teacher trying to use simulations as a way to improve my classes. I only know basic programming stuff from messing around with python in the past. I'd like to hear your advice on which programming languages are more suitable for basic physics simulations. We're talking about something good enough to help my students understand a concept, I don't really care about efficiency and fast number crunching, although having both would be really nice. It's meant for just classical physics, not computationally intensive stuff like quantum mechanics or general relativity. I would also like to eventually make some 3D simulations.

    What languages do you recommend?

    Thanks in advance and sorry for my English!

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

    change all highlighted text quickly

    Posted: 17 Apr 2019 08:46 PM PDT

    Hi what i need help in isnt programing but its kinda related im looking for a easy way to change alot of spefific numbers all at once without manually deleteing and typing one in over and over heres my example

    0,0;0,1;0,2;0,3;0,4;0,5;0,6;0,7;0,8;0,9;0,10;0,-1;0,-2;0,-3;0,-4;0,-5;0,-6;0,-7;0,-8;0,-9;0,-10;

    I want to change all these bold numbers into 1s and then change it into 2's so each time i can paste it each time into a coded thing for a web game

    is there any tool i can use maybe on word or a website i could do this with without downloading anything thank you

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

    [PYTHON] What is the difference in these two lines?

    Posted: 17 Apr 2019 08:42 PM PDT

    They give the same result but im not familiar with the syntax "x for x...."

    y= input('give a number: ')

    y=x for x in input("Gives me a number:")

    Please and thnx

    submitted by /u/AKitsune-47
    [link] [comments]

    Can somebody show me how to use require(); method client side without using define method also?

    Posted: 17 Apr 2019 08:22 PM PDT

    So I am making a server with socket.io, client index, server.js among other files. Up until a certain point, I referenced all my sources in html with a <script> tag, but I learned that was not good if I had the define method in any source files. Now I have a script tag that references index, but index uses require to reference all the other files. But I get this error that wants me to use ([]), and then doing that, I get "server responded with a status of 404 not found", which, to my understanding, means my sources did not load. I saw that I was actually getting a URL of(this is one example) http:\\localhost:3000\js\require.js(backslashes might not be right but hey). Of course, I wanted to reference a local file, not a file on the server. I know that different forms of require handle the input path differently; I just put down the name of my file, and that didn't work. I could use __dirname to remove http://localhost:3000, but even then, I can't use C:Users//ect due to security reasons. Can somebody please show me how to do this properly?

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

    Help understanding why socket read/write works over localhost and not over remote connection?

    Posted: 17 Apr 2019 08:19 PM PDT

    For some reason, this code works perfectly fine on my local host configuration below. In addition, it WAS working fine until very recently via running the server code on AWS and the client code locally.

    I have the following bit of code:

    package main import ( "bufio" "fmt" "net" "reflect" "strings" "time" "github.com/bradfitz/gomemcache/memcache" ) // only needed below for sample processing func main() { var uniqueKey string = "OldK" var uniqueValue string = "OldV" fmt.Println("Launching server...") // listen on all interfaces ln, _ := net.Listen("tcp", ":8081") // accept connection on port conn, _ := ln.Accept() // Make a message so the client knows a connection was made promptMessage := "Connected" conn.Write([]byte(promptMessage + "\n")) // run loop forever (or until ctrl-c) for i := 0; i < 2; i++ { fmt.Println("Hitting loop") //prompt for either key or value if i == 0 { promptForKey := "Enter Key" conn.Write([]byte(promptForKey + "\n")) // will listen for message to process ending in newline (\n) message, _ := bufio.NewReader(conn).ReadString('\n') // output message received fmt.Print("Key Received:", string(message)) // sample process for string received message = strings.TrimSpace(message) uniqueKey = message fmt.Print("Key is:", string(uniqueKey)) } if i == 1 { promptForValue := "Enter Value" conn.Write([]byte(promptForValue + "\n")) // will listen for message to process ending in newline (\n) message, _ := bufio.NewReader(conn).ReadString('\n') // output message received fmt.Print("Value Received:", string(message)) // sample process for string received uniqueValue = message fmt.Print("Value is: ", string(uniqueValue)) } } fmt.Print("\n Attempting to connect to memcached client...") //fmt.Print(uniqueKey + uniqueValue) memcached("127.0.0.1:11211", uniqueKey, uniqueValue) } //end main func memcached(ip string, key string, value string) { mc := memcache.New(ip) mc.Timeout = time.Second * 5 // Increase the client's timeout to 5 seconds fmt.Print("Key Check: ") fmt.Println(key) fmt.Println("Value Check: ") fmt.Println(value) mc.Set(&memcache.Item{Key: key, Value: []byte(value)}) time.Sleep(3 * time.Second) // It's important to note here that `range` iterates in a *random* order fmt.Println("\n ** reading back ** ") fmt.Println("Second key check: ") fmt.Println(reflect.TypeOf(key)) key = strings.TrimSpace(key) k, err := mc.Get(key) if err != nil { fmt.Print(err) return } fmt.Printf("-- %s", k.Value) } 

    Which is just a basic TCP server in golang. The corresponding client code:

    package main import ( "bufio" "fmt" "net" "os" ) func main() { // connect to this socket conn, _ := net.Dial("tcp", "127.0.0.1:8081") promptMessage, _ := bufio.NewReader(conn).ReadString('\n') fmt.Print(promptMessage) for i := 0; i < 2; i++ { if i == 0 { promptMessage, _ := bufio.NewReader(conn).ReadString('\n') fmt.Print(promptMessage) // read in input from stdin reader := bufio.NewReader(os.Stdin) fmt.Print("Key to send: ") text, _ := reader.ReadString('\n') // send to socket fmt.Fprintf(conn, text+"\n") } if i == 1 { promptMessage, _ := bufio.NewReader(conn).ReadString('\n') fmt.Print(promptMessage) // read in input from stdin reader := bufio.NewReader(os.Stdin) fmt.Print("Value to send: ") text, _ := reader.ReadString('\n') // send to socket fmt.Fprintf(conn, text+"\n") // listen for reply //message, _ := bufio.NewReader(conn).ReadString('\n') //fmt.Print("Message from server: " + message) } } } 

    Now, when I run the above via AWS, it hangs before I am prompted to enter a key. Additionally, if I decide to CTRL+C out of the server, I'm prompted for the key after the connection is close :(

    I thought that last bit of information might mean I wasn't passing a new line character to let the reader know that I was done, but I've double checked this and no longer think that is the cause of the hang. I am really truly lost here, please please please please help me.

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

    what does this mean exactly please?

    Posted: 17 Apr 2019 04:31 PM PDT

    float mat[8][8];

    fscanf(stdin,"%f",mat[2]);

    how come it can access the adress of mat[2] if there's two dimensions ? thanks for your help

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

    Artistic programmers why did you choose your job?

    Posted: 17 Apr 2019 04:19 PM PDT

    TLDR: As a programmer who likes to be more artistic why did you choose the job your currently at?

    I'm currently in my second year of my computer science degree and I'm trying to figure out what path to take. I know I have more of an artistic eye for things and was wondering what positions other than Front End Developer are good ideas for artistic programmers and why did you choose that position.

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

    No comments:

    Post a Comment