• Breaking News

    Saturday, August 11, 2018

    How I taught myself to program; How I would do it again today learn programming

    How I taught myself to program; How I would do it again today learn programming


    How I taught myself to program; How I would do it again today

    Posted: 11 Aug 2018 01:37 PM PDT

    There was a post here maybe around a week ago that basically asked the question, "If you had to learn to program all over again, how would you do it?" I didn't get a chance to respond to it then, and I can't find it now. I still wanted to write up my answer to that question, so here it is! Hopefully some of you guys find this interesting or useful. Sorry it's long. I think I waxed nostalgic.

    tl;dr: If I had to learn to program all over again:

    1. I would figure out what I wanted to make. I wouldn't think about how hard it was, how much I would have to learn, or how long it would take.
    2. I would figure out what technology I could use to build my project. I wouldn't worry about making sure I found the best technology for the job. I can learn the best one later on a different project after I have more experience.
    3. I would start working on it. I would find other projects built with that technology and start tinkering with them. I would apply what I learned to my own project. I would never get anxious and worry about the current state of the program, either regarding quality or completion level.

    About Me

    I'll start by telling you a little about myself. If you don't care, please skip this section. I don't want to bore you.

    I'm currently a full-time software developer at an electrical supply company. I primarily work on the company's Web sites, but also do a lot of work with our ordering system and writing code to communicate with third-party API's for things like shipping estimates and vendor stock availability. I've also had to migrate 30+ year-old legacy code from a BASIC-like language into VB.NET. This was slow, painful, and made me want to die. (I kid. Mostly.) Most of my time is spent writing back-end code, but lately I've been able to write more client-side code.

    Before my current job, most of my career was as a freelance Web developer. I also did a short stint (about a year) at a Web design company. I left and went back to freelancing, because my work at that employer offered little opportunity to become a better developer. I also wanted more control over the quality of my work.

    I like C#, but don't get to use it at work. I also really like where JavaScript has been going the last few years, and it might be my favorite language right now.

    I went to college for Computer Science starting in 2004, but dropped out after three semesters because I was already working and didn't feel like I had learned anything from my computer science classes. At the time, it seemed like college was just costing me a lot of time and money that I could better use elsewhere. This does not mean I think you should or should not go to college. You have to make that decision yourself.

    How I learned to program

    I started learning to program probably around 1994 when I got access to a computer that had two games on it called Nibbles and Gorilla. These were both QBasic games. QBasic was essentially an IDE and interpreter. This basically meant I was able to open up the code for these games, change it, and run it to see the changes. It literally meant that I broke both of these games and had to read through the remaining code and the limited Help section of the IDE to try to figure out how to fix them. I really wasn't all that interested in making changes to those two games, but was definitely interested in making some new games to play.

    Over the next years, I eventually made a few small test programs that did things like printing text to the screen, making beeps of different pitches that were supposed to sound vaguely like music, and drawing squares on the screen. Besides these, the first "full" program I think I ever made was basically a choose-your-own-adventure style text game. I don't remember the specifics, but you were in a spaceship. One of the choices you made was whether to make a journey using shields, a cloak, or neither. If you didn't use the cloak, you died.

    The next language I learned was TI-BASIC, which is the programming language on TI graphing calculators. My parents bought me a TI-89, which came with a huge manual (made of dead trees, not bits). The manual had the documentation for TI-BASIC, and was really the first programming book I ever owned. I spent a lot time making games on my calculator instead of paying attention in class. I made a text-based RPG called Duel, and then made a sequel/remake called Duel 2. This was the first time I did a major rewrite of a program.

    Around the same time I was making games on my calculator, I also started learning HTML, CSS, and JavaScript. Before I go on, I should tell you that this was around 2000-2001. StackOverflow and YouTube didn't exist. Firefox and Chrome didn't exist. If there were any good IDE's for these languages, I didn't know about them. Internet Explorer didn't have a console or inspector, so debugging HTML and JavaScript consisted of a lot of trial, error, and alert("It hit the else. Why did it do that?!").

    I learned front-end Web dev by viewing the source of existing Web sites, reading the code to see what it did, then making and editing local files to play around. I don't know if there were good online resources at the time for learning these languages, but I didn't know about any. Eventually, I managed to get a book about DHTML (again made of dead trees), which helped a lot. I quickly realized that being limited to these languages ruled out any possibility of data persistence, so I learned how to install Apache and PHP on my home computer. PHP actually had a lot of online documentation, so learning it was a joy.

    With a very basic understanding of Web languages, I set out on my first public project. I started working on a browser MUD, which is essentially a text-based MMORPG. This was a huge project, so why did I decide to work on it?

    1. I was already playing some MUDs online, but none of them were exactly what I wanted to play.
    2. I had friends who played MUDs, and I knew they would be interested in trying mine.
    3. Since it would be an online browser-based game and I would first be releasing it to friends, I wouldn't have to worry about getting enough done to warrant a public release.
    4. The nature of the game meant that anyone who played it wasn't excluded from playing other MUDs at the same time. Just have two browser windows open (tabs didn't exist) and switch back and forth. This meant that even if the game wasn't particularly compelling yet, my friends could still play it and not stop playing their other games.

    When I first released what would essentially be considered an early alpha, I hosted it off my home computer on dial-up. Every day after school, I would get on AIM (AOL Instant Messenger) and tell everyone what my IP was today so they could connect and start playing (don't do this). All the players were stuck in one building for a while, because nothing else existed in the game.

    This game ran for eight years before I finally shut it down. During this time, I:

    1. Learned how write a registration and login system.
    2. Learned how to write a chat system with private messages, different channels, and different in-game ranges (say vs. shout).
    3. Created in-game mail and bulletin board systems.
    4. Learned how to persistently store characters, rooms, items, NPC's, and lots of other data in tokenized files.
    5. Migrated everything from my home computer to a shared server (and then again to a different shared server).
    6. Migrated all the data from flat files to a MySQL database. Oh, and learned how to create, manage, and use a MySQL database.
    7. Figured out how to make it possible for notifications to appear without the user needing to resubmit the page. (AJAX technically existed, but no one really knew about it until Gmail launched in 2004. I devised a hack using a hidden frame that periodically refreshed and was capable of making updates to its parent.)
    8. Created in-game tools for editing and creating characters and rooms so that other people could start contributing to the game. (Which also led to creating admin roles with different levels of access.)
    9. Created a simple scripting language and parser so that other admins could start programming behavior for rooms and characters.
    10. Lots of other things. (Currency, players learning new abilities, guilds...)

    Here's what I didn't do: Run into a problem I wasn't eventually able to find a solution for. I'm not saying that to try to pretend I'm some genius developer. You have to remember that there's no time limit on any of this. You can work on a problem as long as it takes. You can take a break for hours, days, or months, and come back to it later. You don't fail to solve the problem until you give up and don't try any more.

    How I would learn today

    I would pick something I wanted to make and figure out how to start working on it. I wouldn't worry about how complicated or hard it seemed, because I have the rest of my life to work on it. The program isn't the end goal. Learning is what matters.

    I would find other people's projects, run them locally, then make code changes to see how they change the behavior of the program. The specifics of the projects don't matter as long as they're made with the same technology I'm trying to learn. The program isn't the end goal. Learning is what matters.

    I would make my program for myself without worrying if anyone would ever really want to use it, because the program isn't the end goal. Learning is what matters.

    I would hurry it to the point where I can at least use it, even if it doesn't do much and the UI is bad. Then I would improve and expand on it from there. I would add new features, and I would improve old features. I would never harshly judge myself if the current state of the software doesn't live up to my standards, because the program isn't the end goal. Learning is what matters.

    I would work on whichever pieces of the program I wanted to in whichever order I wanted to. If I got halfway through a feature and didn't want to work on it any more, I would work on something else. The program isn't the end goal. Learning is what matters.

    I would show it to people who seemed like they could be interested. I would let them use it. I would listen to their feedback without ego. I would try not to be defensive and only defend my decisions in order to start a conversation about alternatives. Even if I disagreed with their feedback, I would try to implement their suggestions and try it myself. I would let them try the new version made with their feedback. Building a change and then throwing it away isn't a waste, because the program isn't the end goal. Learning is what matters.

    If I got bored with my program, I would stop working on it. If I became interested and came back, great. If I permanently moved on to something else, also great. Boredom means there's nothing left to learn from that program, and the program isn't the end goal. Learning is what matters.

    Hopefully this helps someone.

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

    Discouraged: Dealing With Obstacles While Learning To Program

    Posted: 11 Aug 2018 10:30 PM PDT

    I'm hoping this post catches someone who is having a bad day or has had a string of bad days recently in learning to program. If it helps shift your mindset in a more positive direction, then it did its job!

    More specifically, I want to talk about obstacles that halt your progress, and how you can use them to reshape your mental landscape over time rather than getting discouraged or seeing them as failures. This is coming from a place of reflection as I look back on some of the things that happened to me during my time with programming and Computer Science over the last 5-6 years. I think this might be especially helpful for people who are learning to program on the side with some goal or set of goals you are trying to accomplish.

    I'll share something I personally went through and what it taught me about dealing with burn out and discouragement.

    Significant Personal Obstacle

    There was one obstacle in particular that I remember because it really hit me hard and lingered for a while.

    This was back in 2015. I had taught myself C++, learned a lot about OpenGL, tried some things with Unreal Engine just to see what it was like, and finally felt like I was almost at the point where I could build my first 3D game from scratch. It was an extremely exciting feeling knowing there was just one last thing to overcome.

    Unfortunately, that thing was math. It was always the hardest thing for me to deal with, but for anyone who has worked with 3D games (especially without an existing engine), you'll know that there is a fair amount of algebra/trig/linear algebra involved. You can get by with just Dr. Google and copy+paste for a long time, but eventually the elephant is just too big.

    The summer rolled around that year and I bought a book written specifically for programmers looking to learn 3D math. I had 3 months, and I decided I would try and dedicate it to actually learning all the math I would need at a deep level. I bought a notebook to take notes and workout example problems, and I started going through the book as soon as it got to my house.

    I remember it was extremely hard. There were times where I would reread the same section, multiple times, and over multiple days and still not get it. There would be days where I would try and push through a particularly rough topic, get a bad headache and have to try again later.

    After around 2 months of this I gave up. The book was a little more than halfway done, but I was done. D-O-N-E. It wasn't fun anymore and I just didn't feel like I was understanding enough of it to actually make use of it. I just couldn't muster up anymore drive.

    Needless to say, my first 3D game from scratch didn't happen in 2015. That 2 month blitz took more out of me than I realized, and it actually took a lot of my interest in programming with it.

    Rebound

    I left that math book on the shelf for quite a while as I shifted my focus to other things, mostly school related. I went on to take more math classes in school, but I never actually put much more energy into really understanding the math behind 3D games, especially some of the weirder math. In my mind, I had left that all behind. I had quit. I liked it, but it didn't like me.

    Then, some time later, I started to feel a growing interest in returning to that book and giving it another try. I let this feeling stir for a long time just to see if it was a phase, but it only got more pronounced. Did I really want to relive that frustration again? Really?

    But it just wouldn't let up. If I ever wanted to accomplish my personal goal to build a 3D game from the ground up, I would need to understand the math.

    Finally I gave in, bought a new notebook, and restarted the book from page 1. To my surprise, I found that I had retained more than I thought, and the stuff I really didn't get was coming to me much more easily.

    Pretty soon, I was one page further than I had gotten before. Then a chapter further, and then the book had given me most of what I needed with just a little bit left to go (maybe sections of a couple chapters). And I felt like I was really getting it this time around. Something in me had changed - my mental capacity had increased during my time away.

    Conclusion

    From this experience and other experiences over the last few years, I learned that there are a lot of responses you can have in the face of obstacles, especially ones that really knock you down. You can seek out other resources to give you the edge you need to get past your confusion. You can paint the problem in a different light to see if it makes more sense, or if it starts to look like something you've encountered before.

    Most importantly, you can choose to step away - and I think this is the healthiest mindset to have. Rather than saying "Oh, I gave up on that" or "I quit that, it was too hard for me" or "This just isn't for me even though I'm interested in it", just look at it as you temporarily taking a break from it. During your time away you can try other things, gain new knowledge, and give your mind time to properly rest and expand. Hopefully when you come back you find that the problem you were having before looks a lot more doable now. Maybe you just weren't ready to face it before, but now you have the necessary skills to overcome it.

    And what if it still seems to hard? Give it your best, and if you have to, step away a second or third time. Just imagine that you're simply going off to see new things, acquire new skills, bump into new ideas, and that all of these things are expanding the limits of your mind. At no point should imagine that you're surrendering to all the difficulty.

    Finally, don't feel bad. This happens to everyone. It could be during a personal project, or it could even be a class that just really doesn't go well and you have to retake later on. The important thing is that you imagine yourself stepping away, only to come back better prepared than before to reach your goal. All of this equates to time - with some requiring more or less than others - and you need to be patient with yourself. You'll get it eventually.

    Good luck!

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

    Would anyone be interested in learning how to build a database?

    Posted: 11 Aug 2018 08:41 AM PDT

    I've been helping my friend learn some programming and database concepts by building a toy database from scratch, layer by layer.

    It occurred to me that the community might be interested in such a project. Basically I would provide each database component's source code along with commentary (maybe blog posts) and exercises for the reader.

    For example, the layers involved could contain:

    • I/O primitives for interacting with the filesystem
    • Key-Value store with crash-recovery log
      • Note: End goal is not a key-value store, but most databases are built on top of a KV store
    • Transaction support
    • Table / column abstraction built on the KV store
    • Indexes
    • Some kind of query system
    • Client connection support with a client library

    If this sounds like something you'd be interested in, I just need to know which language(s) I should use. I created a short survey where you can rank the languages you'd prefer: https://docs.google.com/forms/d/e/1FAIpQLSdeNWqSIN-VF284H2E1-npXKVaeMpCLVimSl5Pz87CHc-JLuw/viewform?usp=sf_link

    Thank you.

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

    Novice Java programmer: Can someone help me understand different types of time complexity notations?

    Posted: 11 Aug 2018 09:15 PM PDT

    So basically can someone help me to understand the difference between, Big-O, Big-Theta, Big-Omega, little o, little theta, little omgega, and any other notations in programming? But in an easy and simple way to understand without using really big terms and goofy notation? Like for example, I see a lot of people explaining it by using the term upper bound, tight bound, lower bound etc and I have no idea what that means that or they pull out some goofy math notation I have yet to understand yet. So please explain this to someone as if you were explaining it a person who is 5 years old who doesn't have much knowledge on the world yet.

    Also I don't understand time complexity totally yet either so try to explain this while also leaving a short explanation of the paragraph i just typed.

    I am sorry if this is a really long question as well. I am really doing my best..

    ADD: I would also like to say that I don't usually understand things by learning the meaning of the term then applying it to the concept..... I have a very weird way of understanding things that doesn't rely on weird vocabulary but relies on it just clicking somehow......so please only help if you are super patient or just don't help at all since many people on here seem to be a bit rude even though they came here to help voluntarly to begin with, I can't understand why you would want to help someone but be rude and impatient in the process. Anyway help me if you can.

    Please try not to use computer science terminology in your explanation, instead of explaining everything using those terms or by defining those terms and then explaining it,.......try to use more simple vocab, for example use worse case instead of upper bound.

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

    Is learning to code a good time investment? x-post from /r/technology

    Posted: 11 Aug 2018 08:27 PM PDT

    I'm currently taking a year off of school living out of states with my family due to personal issues and have free time. I'm applying to jobs for extra cash but I'd rather use my time to help advance any more possibilities in the future. Currently, a business major and don't know how correlated they are but is learning python or javascript for a whole year worth my time? Was thinking of adding more skills to my resume when I graduate. Or would I rather spend my time on something else? Honestly still lost on what my career will turn out to be. 21 here. Sorry for the vague question. Any other things I could do or learn for a better well-rounded skill-set?

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

    How do I go about finding a professional mentor?

    Posted: 11 Aug 2018 08:15 PM PDT

    Recently changed majors to software development. Haven't tried writing code since the mid 90s when I was in grade school and started teaching myself BASIC. After I discovered the guitar all bets were off, but I've always regretted not following through. So here I am. Practically a newb. I'd really appreciate advice on how to connect with an experienced person in my desired field who could help point me in the right direction and avoid pitfalls and so on. If I find one here, amazing! The internet has come through for me, but if I only get some good advice, I'll count it as a success. Thanks in advance!

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

    [android] Hello I need help with concentration, excitation and with keeping it alive

    Posted: 11 Aug 2018 10:47 PM PDT

    Help me, I lose interest too often. How do you guys deal with lose-of-interest in a project. I have started tons of projects and I never finish them. Halfways, I get a new idea, and current project becomes history.

    I have .txt files of ideas and ideas everywhere on my PC. Pieces of papers in my kit and pockets. Notes on Google Keep. Todos in projects.

    But I fail. Please, I feel like my life is worthless.

    Edit: tons = 43, sorry

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

    Viability of learning in Mobile?

    Posted: 11 Aug 2018 06:51 PM PDT

    I have 12 hours at work to do whatever I want, as long as it's on a cell phone and not a laptop. I'm tired of watching Netflix, and have read enough books to take a break.

    Is it feasible to learn Java/Android dev on a mobile device? I literally can put 48-60 hours a week into learning this and would hope it's possible.

    Any suggested course of study?

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

    Is it worth taking a class on a programming language or should I just self-teach?

    Posted: 11 Aug 2018 03:27 PM PDT

    I have 0 experience on comp sci and programming at all so I may be getting ahead of myself, but is it worth taking any sort class for this? More specifically, classes from a community college or something similar.

    Like would most employers care if you took a class and passed or that you may learn more from a class rather than self taught?

    What classes should I take first if I should take programming classes?

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

    Custom Document Managamnet System Tutorial #1 (The Big Picture)

    Posted: 11 Aug 2018 08:19 PM PDT

    Hey guys the feedback has been amazing. I just finished recording the first video for the series. The series will be picking up very quickly so hopefully this video is informative and you learn something new! I will do my best to explain everything as clearly as possible. If you have questions feel free to dm me email me; I am happy to help in anyway possible. Again thanks for the support this is unreal!

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

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

    Way to create desktop shortcuts for Windows settings?

    Posted: 11 Aug 2018 05:38 PM PDT

    I'm simply trying to find a way to create a shortcut to toggle "Mono" audio off and on (and vice versa) from the Windows settings. I've read about ways to create desktop shortcuts for Windows settings categories, like in this link, but haven't figured out a way to specifically target and toggle the Mono off/on button.

    Any and all ideas would be awesome. I eventually want to figure out a way to select and alter a variety of Windows settings. Have a great day/night.

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

    Personal Budgeting Web app - choosing a library?

    Posted: 11 Aug 2018 07:37 PM PDT

    Hi sorry if this is dumb question but Ive been coding in vanilla javascript really and a novice. I have decided to build a personal budgeting web app to build my skills w/o relying on copying a video tutorial. The idea of the app is that you would calculate all your weekly expenses and at the top the user can click an arrow that would bring them to a new page showing where the user can calculate a new week of expenses (changing the dates therefore the data would change for that week and it should also store that data if the user would want to revisit last week's budget data). My question is should I be able to code this in vanilla javascript or should I be using a library or framework like angular or react.js or a different language even

    I've done most of the calculations portion of the code in javascript and created the html and css for it I am just unsure on how to change to a new page of a new week of expenses.

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

    API Hell. How do I begin with this?

    Posted: 11 Aug 2018 05:24 PM PDT

    http://pyqt.sourceforge.net/Docs/PyQt5/

    I want to make a simple window with a button to press. Must I read through hundreds of pages to figure this out? How do software engineers deal with this on a daily basis?

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

    Syntax in javascript

    Posted: 11 Aug 2018 07:22 PM PDT

    Alright so quick question - how do I know what's the proper way (if there is a proper way - as in - good habits) to write code in javascript? It's a real mess I think. You can write:

    let potatoes = 10;

    if(potatoes <= 11) {

    console.log("Need more potatoes");

    }

    else{

    console.log("Potatoes are plentiful");

    }

    however you can also write:

    potatoes <= 11 ? console.log("Need more potatoes") : console.log("Potatoes are plentiful");

    I'm not sure if there'll be more cases like this - but I am quite sure that there are.

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

    Where can I get HTML/CSS help from the professionals quickly?

    Posted: 11 Aug 2018 10:40 PM PDT

    I am working on creating a beautiful website from a template that I have created using Photoshop. Right now, I am involved with static web page development using HTML5, CSS3 and Bootstrap. As I am a beginner, I often face some issues. In most of the cases, I get solution from Stack Overflow. However, there are times when I get frustrated with the lack of effective solutions, along with no response. As a result, it is taking a lot more time for me to finish the project. Right now, I have been stuck on a navigation problem for two weeks. I have been locked out. There is no way to proceed. The developers on Stack Overflow cannot provide me with an effective solution. Now, what should I do to solve this issue? Where can I get HTML/CSS help from the professionals quickly? Should I connect the professionals on LinkedIn? Is there any awesome way of getting there help online? I am asking this question, as I am frustrated with the lack of help and pace of my project.

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

    ASP.NET Core Business Application Development or WordPress Plugin Development - Which one should I learn?

    Posted: 11 Aug 2018 10:26 PM PDT

    I am a passionate programming learner. I have a good knowledge about C#, basics of ASP.NET Core 2 and PHP. I would love to apply my C# and ASP.NET Core 2 to build a real life business application. I have also planned to watch a Lynda video tutorial for the specific purpose and implement the acquired knowledge in a practical project. In the meantime, one of my friends is suggesting me to go for WordPress plugin development. He is earning around US $2500 per month from a plugin, which he has published on Code Canyon. So, it's definitely a good advice. Now, what should I do? Should I go for ASP.NET Core Business Application Development or WordPress Plugin Development? Or should I start building the business application with ASP.NET Core 2 while investing some money to get an awesome WordPress plugin created and publish it on Code Canyon? Is there any online market place of ASP.NET Core 2 application from where I can generate income? To be honest, I am more interested in ASP.NET Core 2, as it is more advanced and relatively more difficult to learn. I love to learn difficult things, as it enables me to stay ahead in the game of competition. ;)

    Looking forward to getting your honest advice.

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

    Questions about a video chat app

    Posted: 11 Aug 2018 10:13 PM PDT

    Hi,

    I'm making a video chat app. I've several questions:

    1. Where do I store the currently active users and rooms? Do I need to use a DB for this?

    2. I plan on using Node as the backend. I assume User 1 will send video stream data to the backend which will forward it to User 2. Do I also need to save this data somewhere since I've no idea how to pipe a post request (User1 data) to a get request (forwarding it to user2)

    3. reserved for future questions lol

    Thanks in advance

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

    Which database should I use for entry saves?

    Posted: 11 Aug 2018 10:13 PM PDT

    I trying to recreate a desktop program similar to the app Daylio and I'm wondering if I should use a database for it or if there is any other way to save the entries for easy lookup and edit functionality.

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

    Android-Calling two different methods in a while loop in a ClickListener

    Posted: 11 Aug 2018 05:39 PM PDT

    Hello everyone, i'm new on Java and Android programming and trying to make a simple flashlight app.I want it to turn on and turn off how many times user inputs in EditText and change buttonImage at the same time.But it runs only the last code in the while loop.How can i call setImageResource after turnOnFlash and turnOffFlash methods ? I hope i could express myself.

    onOffButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int i = 0; while(i < time()) { i++; turnOnFlash(); onOffButton.setImageResource(R.drawable.on); try { //sleep 0.50 seconds TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } turnOffFlash(); onOffButton.setImageResource(R.drawable.off); try { //sleep 0.50 seconds TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } } }); public void turnOnFlash(){ try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { cameraManager.setTorchMode("0", true); } }catch (Exception e){ e.printStackTrace(); } } public void turnOffFlash(){ try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { cameraManager.setTorchMode("0", false); } }catch (Exception e){ e.printStackTrace(); } } public int time(){ return Integer.parseInt(flashCount.getText().toString()); } 
    submitted by /u/curlygecko
    [link] [comments]

    pointer to double for functions Min/ Max, how to do it correctly? c++

    Posted: 11 Aug 2018 09:25 PM PDT

    //Both functions (ComputeMaximum and ComputeMinimum must have a declared return type of "pointer to double" and I am not sure how to do that, need help.

    #include <iostream>

    using namespace std;

    double ComputeMaximum(const double *Value1, const double *Value2);

    double ComputeMinimum(const double *Value1, const double *Value2);

    //this program call functions ComputeMinimum & ComputeMaximum to provide Max & Min values of two numbers

    //These functions passed numbers by reference

    int main()

    {

    double num1,num2;

    double maximum, minimum;

    cout <<"Enter two decimal numbers: ";

    cin >> num1 >> num2 ;

    minimum = ComputeMinimum(&num1, &num2);

    maximum = ComputeMaximum(&num1, &num2);

    cout <<"ComputeMinimum (" << "&" << num1<< ","<< "&" << num2 <<") returned "<< minimum<<"\n";

    cout <<"ComputeMaximum (" << "&" << num1<< ","<< "&" << num2 <<") returned "<< maximum;

    return 0;

    }

    double ComputeMaximum(const double *x, const double *y)

    {

    return *((x < y) ? y : x);

    }

    double ComputeMinimum(const double *x, const double *y)

    {

    return *((x > y) ? y : x);

    }

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

    Why does this code never output anything??? [Python2]

    Posted: 11 Aug 2018 09:21 PM PDT

    https://imgur.com/JNNGmL0

    Why does this code never output anything???

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

    Need an idea

    Posted: 11 Aug 2018 09:05 PM PDT

    I need to keep my programming skills sharp, and I'm a bit rusty with Java. Any ideas for a project I could do to refresh?

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

    Stuck with python calendar project

    Posted: 11 Aug 2018 08:10 PM PDT

    At the bottom of the code I keep getting "SyntaxError: 'continue' not properly in loop". I'm not sure what's going on? It's in an appropriate while loop? I think all of the indentation is correct?

    Any ideas?

    Thanks!

     while True: user_choice = raw_input("Enter A to add, U to update, V to view, D to delete, or X to exit: ") user_choice = user_choice.upper() if user_choice == "V": if len(calendar.keys()) == 0: print "Your calendar is empty." else: print calendar elif user_choice == "U": date = raw_input("What date? ") update = raw_input("Enter the update: ") calendar[date] = update print "Updating..." sleep(1) print "Update successful!" print calendar elif user_choice == "A": event = raw_input("Enter event: ") date = raw_input("Enter date (MM/DD/YYYY): ") if (len(date) > 10 or int(date[6:]) < int(strftime("%Y"))): print "Invalid date!" try_again = raw_input("Try again? Y for yes, N for no: ") try_again = try_again.upper() if try_again == "Y": continue else: start = False 
    submitted by /u/imntesta
    [link] [comments]

    Would the following projects look good on a new grad’s resume?

    Posted: 11 Aug 2018 04:09 PM PDT

    1. I own lots of "fancy" socks with all kinds of silly designs. The idea is a website that will show a random subset of my socks every day and allow people to vote on which pair I wear that day.

    2. A todo list program for Windows (WPF) and a corresponding iOS app, both sync together using a REST API.

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

    No comments:

    Post a Comment