Problem with dynamic activity in android

Learn Programming - Fri, 03/16/2018 - 02:12

Im making a note taking app. When I click "New Note" it adds a new item to a ListView and then it begins a new activity where the user can type anything he wants. I want to save whatever was written within a note that is accessible from the ListView in the main activity.

My problem is - how do I check in my NoteActivity if it's a new note or an old one? You can't dynamically create activities, so I have to re-use the same activity for multiple notes. How do I go about doing that?

I thought about incrementing a count every time the activity fires. But what if a user enters an old note 5 times?

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

SQL: Can I create a table, and fill some columns with things from another column, in another table?

Learn Programming - Fri, 03/16/2018 - 01:55

I want to create a table with the dates that I have in another table, and create a days of the week column as well. Specifically I am dealing with PostgreSQL.

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

I want to learn some basic programming that'll look good on a resume, but I'm not a creator.

Learn Programming - Fri, 03/16/2018 - 01:36

I know absolutely nothing about programming. It interests me but I've never taken a solid interest into learning about it until I lost my job last week. I live in the Bay Area so I'm trying to build a general skill set involving programming so I can hope to get a decent job around here. The problem being is that I'm not the kind of person who is really interesting in taking charge and making something myself. I'm more of the person who would like to work with a team to help create something led by someone else. What's the best way to learn for someone like me?

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

Question About "If Statements" in C++

Learn Programming - Fri, 03/16/2018 - 01:36

Is there a way to make many if statements shorter. I have made a simple calculator that can use three digits and the code reads as followed

if (SecondChoice == 1 && (FirstChoice == 1)) result = value1 + value2 + value3; if (SecondChoice == 2 && (FirstChoice == 1)) result = value1 + value2 - value3; if (SecondChoice == 3 && (FirstChoice == 1)) result = value1 + value2 / value3; if (SecondChoice == 4 && (FirstChoice == 1)) result = value1 + value2 * value3; if (SecondChoice == 1 && (FirstChoice == 2)) result = value1 - value2 + value3; if (SecondChoice == 2 && (FirstChoice == 2)) result = value1 - value2 - value3; if (SecondChoice == 3 && (FirstChoice == 2)) result = value1 - value2 / value3; if (SecondChoice == 4 && (FirstChoice == 2)) result = value1 - value2 * value3; if (SecondChoice == 1 && (FirstChoice == 3)) result = value1 / value2 + value3; if (SecondChoice == 2 && (FirstChoice == 3)) result = value1 / value2 - value3; if (SecondChoice == 3 && (FirstChoice == 3)) result = value1 / value2 / value3; if (SecondChoice == 4 && (FirstChoice == 3)) result = value1 / value2 * value3; if (SecondChoice == 1 && (FirstChoice == 4)) result = value1 * value2 + value3; if (SecondChoice == 2 && (FirstChoice == 4)) result = value1 * value2 - value3; if (SecondChoice == 3 && (FirstChoice == 4)) result = value1 * value2 / value3; if (SecondChoice == 4 && (FirstChoice == 4)) result = value1 * value2 * value3;

So this basically is showing the choice for the symbol between the numbers (multiply, divide, etc.). So is there anyway i can shorten and simplify this?

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

Getchar() and Putchar() to read in two numbers

Learn Programming - Fri, 03/16/2018 - 01:33

I have an assignment where I have to create a basic calculator (in C) using getchar() and putchar() to read in two different numbers and an operator. I'm having trouble reading the numbers into separate integers to calculate. How exactly should I go about doing this?

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

Learn a 25k line codebase?

Learn Programming - Fri, 03/16/2018 - 01:19

Recently started for a company as the only backend developer, inheriting a 25k line codebase. Been working my ass off, to the tune of several all-nighters this week, trying to understand how it comes together. There are strict deadlines for feature implementation that are very fast approaching, and I don't want to slow down the frontend team.

How long should this process take? Any good advice?

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

MAMP not running mySql server

Learn Programming - Fri, 03/16/2018 - 00:56

So I running apache and mysql servers using MAMP, so that I can make a local server on my machine to work with api. This is all new to me. Anyways, when I looked into this on the wise and powerful internet it directed me to stack overflow, where they say to delete ib_logfileN.

I haven't tried this yet, but why does this work?

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

What should I start on?

Learn Programming - Fri, 03/16/2018 - 00:40

I've never coded once in my life. I want to learn how to make websites and eventually potentially mobile apps based on the websites.

Should I start out with JavaScript or HTML or something else? Also what are some of the best free courses for an absolute beginner on said coding language? I'm just learning about what I should learn right now, and have no real commitment to anything.

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

I'm struggling with this Java course...

Learn Programming - Fri, 03/16/2018 - 00:37

I'm currently taking an intro to programming course and the language is Java. Prior to this course, I have never done any coding in my life. So, I can actually understand some parts of the code, but whenever it is a written portion of the exam (writing code based on a problem given), I tend to do very poorly. Honestly, this may be the first course I failed in college, which will also drop my GPA. Despite this, I never will give up and I will likely be retaking the same course again. I was wondering if you have advice for me so I can succeed next time?

TLDR: Failed my first programming course, what can I do to succeed?

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

I am looking to build a "Multiblogging" site and I am not sure where to start. As a new programmer, can someone point me in the right direction?

Learn Programming - Fri, 03/16/2018 - 00:34

Hi /r/learnprogramming,

I am a fairly new developer (only about six-months in, I am 5 weeks away from graduating from my Web Development Boot Camp) and I am taking on my first big solo project. In my class, we covered: Javascript, Node, Express, MySQL, MongoDB, and are now working on React. So far, I've done fairly well on the homeworks, but now that I find myself looking at building my very own web application I feel a little lost/nervous.

For my final class project, at it's base level, I am looking to build a specialized tumblr clone. Are there any good frameworks, libraries, or online readings that I could look at to help get me started on this task?

Thanks all!

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

[x-post from /cscareerquestions] Difficulty having conversations with people about tech as a newbie

Learn Programming - Fri, 03/16/2018 - 00:25

I just finished a 3-month bootcamp about 2 months ago, but still feel very new to the tech. As I'm applying to jobs, I'm mostly studying algorithms, building small projects, but still find it pretty difficult to make meaningful conversation with people. At what point do you feel like you know enough about a framework/technology to develop an opinion on it? Sometimes people start talking to me about OAuth, web dev, frameworks, and while I know what those are I can't find the words to carry on the conversation. It becomes me nodding to whatever they're saying.

I try to read as many articles I can on Hackernews, medium, etc. but don't feel like they've been helping. I know this kind of knowledge comes with time, practice, working with techs, but does anyone have tips/advice on how to better myself to even be able to talk to other people in the field? Other resources for those who still feel more beginner? Do I need to just read more?

A good example is going to meetups, I don't know how much I can be able to network if I don't feel confident in what I'm saying. Feeling a little hopeless that I'll never get there.

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

Help with a project I am thinking of

Learn Programming - Fri, 03/16/2018 - 00:20

Hello. So I am not programmer at all. The only code I really know is HTML (yes I know that is not programming code). But I need a bit of some help with a project I am thinking of.

So I am a local Volunteer Firefighter in my county and I have a Beta Brite 1040-4402 LED sign. I wanted to try to make it to where when our specific fire department tones get sent out. A program decodes the Quik-Call II tones and somehow sends a text file (or a string of data) through a COM Port to the Beta Brite sign.

Now since I do not know how to code that is when I need some help. I need to know what would be the best option for me. If this post is not allowed please excuse me. I am new to this subreddit.

Thanks for viewing the post and hopefully one of you can help me with my project!

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

What language do I need to do this...

Learn Programming - Fri, 03/16/2018 - 00:19

My experience in web development has been mostly limited to Wordpress. I understand enough HTML and PHP to be able to manipulate themes and generally get them to function how I want within the context of what has already been created. I'm a "tweaker" not a coder, but I understand the fundamentals.

I have an idea for a website, but it will have to be created from scratch and I don't know what programming language I will need to learn to accomplish my goal. I think either PHP or Python can do it. Perhaps even Javascript. I'd like some insight on where I should focus my learning.

I basically need to have the user select two options from a searchable dropdown list, each representing a currency. An existing API I can query would give me the historical value of that currency priced in USD via a JSON output. I'd need to take the dataset from both currencies and divide them so as to create a value/ratio of one currency to another and then graph the results over a set time period. I already have this accomplished in Excel, but I have to manually import the data first. I'd like to present it in an online way to end users using constantly updated info provided by the api I'm querying.

I hope that makes sense. I know I have a learning curve in front of me. I'm not sure what language is the best way to accomplish this. Any advice would be appreciated. Cheers.

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

Simple way to update game score in jQuery

Learn Programming - Fri, 03/16/2018 - 00:18

So I'm working on a game for my programming class. Right now we are going through jQuery. I'm making a 'crystal collector' game, where i am given a large random number, along with 4 hidden values in my buttons. When I click a button, that hidden value is added to my score, and the goal is to match the random number without going over. Simple.

Now I know how I would add to my score with javascript, but I haven't been able to find a solution with jQuery. I have been using my google-foo, but nothing I can find makes sense, nor can I use to work.

var score = 0; var wins = 0; var losses = 0;
var gameState = "";

//Main Random Value

var lotteryValue = Math.floor(Math.random() * 120) + 19;

//Random Crystal Value var crystalValue1 = Math.floor(Math.random() * 12) + 1; var crystalValue2 = Math.floor(Math.random() * 12) + 1; var crystalValue3 = Math.floor(Math.random() * 12) + 1; var crystalValue4 = Math.floor(Math.random() * 12) + 1;

$(document).ready(function() {

$('currentNumber').val(lotteryValue); $("button").val(crystalValue1,crystalValue1, crystalValue1,crystalValue1); score = $('.scoreBox'); $(".btn1").click(function () { }); $(".btn2").click(function () { }); $(".btn3").click(function () { }); $(".btn4").click(function () { });


javascript i could just do an if/else statement and easily add to the score, but everything I try with jQuery doesnt work. I just want to know if there is a 'simple' way to add to the score. Ive been thinking that i need to use .add or .val within 'btn1' 'btn2' etc but....idk thanks in advance.

edit: sorry my post is formatted weird. I didnt know it would do that

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

Follow-Up: More Lessons from my First Development Job

Learn Programming - Fri, 03/16/2018 - 00:13

Good Day, fellow Redditors!

A couple months ago, I posted this thread, where we had a great discussion about some of the lessons I had learned after my first several weeks of work as a Software Developer, and wanted to keep the discussion going, and share some more recent insights, to build upon what I mentioned previously.

Without carrying on too much, I want to thank everyone here for your help when I was learning, and I hope this post helps someone who is looking to make a career change.

Here are some more lessons I've learned in the past couple of months, in no particular order:

  • Impostor syndrome will NEVER go away. There are new threads on Reddit (in the several programming subs I follow) every week, from novices and professionals alike, talking about this phenomenon. It is, quite simply, an emotional response to a stress trigger. You get frustrated with how quickly/slowly you learn something new, and these thoughts are your brain's way of trying to get you to run from the stress event. It's fight or flight, and you have to fight. You are NOT stupid, you are NOT worthless, and you WILL figure this out!

  • Learn to use a whiteboard to your advantage. Notebooks work for this, but whiteboards are useful for collaboration, especially when working with complex structures or logic, and creating a visual representation of something before writing the corresponding code ensures you have an adequate understanding of the issue you are solving, as well as how to solve it.

  • Comment your code! Other developers tend to write code with minimal or no comments at all. These types of developers have a name that other developers use to refer to them. Usually, that name is "Asshole" (or some variation), and nobody likes them. Cleaning up their code, or trying to fix a bug is an hours-long affair, and requires far more intense thought and effort than it would if they had learned to leave a trail of breadcrumbs for others to follow. I think of myself as 3 people: Past Me, Present Me, and Future Me. See, Past Me was one of those developers. Present Me knows how irritating it is to work in Past Me's code, so he's made a vow to never leave code uncommented again. Future Me is a hard-working, intelligent, and highly skilled developer who doesn't have time for the shenanigans of Present Me or Past Me, and is feverishly working to develop a time machine so he can come back to pound their faces in. The better comments Present Me leaves, the less likely Future Me is to want to pound my face in. I (Present Me) am rather attached to my face, and would prefer that it keep it's general shape, size, color, and condition, so I'd like to avoid that kind of confrontation if possible.

  • You break it, you'd better fix it. When working in an existing codebase, it's important to remember that there are already mechanisms in use that rely on the existing code. If you implement a new feature, and find that an existing method does almost exactly what you need, that's not good enough. You can't modify that single method without also modifying every method using it. If you change the method to implement your feature, but don't fix those dependency issues, you are doing more harm than good. Don't break existing code for your own purposes, or you'll quickly gain a reputation you don't want, and may even be subjected to additional scrutiny when submitting completed work for review. This didn't happen to me, but I've seen it happen to others. Nobody wants to have 2 code reviews for every task they complete, especially when they are completing 10-15 tasks a week. Ain't nobody got time for that!

  • You never have time to do it right, but always have time to do it twice. This one is a tough lesson to learn the hard way, so learn from my mistakes. Working on one of my first projects, I took some shortcuts, or stayed away from some more complex solutions for fear of screwing up my implementations of them. I've had to go back and refactor that project, but now I have to touch every piece of code that used that old projects' code, and fix that to work correctly. It's a massive undertaking, and if I had just done it the right way then, I would have easily saved myself a weeks' worth of work spent on the refactor/redesign. Remember Past Me and his tendency to not comment his code? Yeah, if I ever see him around, I'm going to pound his face in.

That's all I can come up with at the moment. I'm sure I have more, but it's getting late, and I need to get some sleep. I'll check in tomorrow, and I really look forward to seeing your thoughts on what I've written. Again, to everyone who offered input, advice, and support along the way, I am eternally grateful!

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

Are there any large-ish ecommerce operations running on Drupal 8 + Commerce?

Drupal - Open Source Content Platform - Fri, 03/16/2018 - 00:09

Good examples seem few and far between.

I'm a Magento guy originally - which whilst it's awesome for transactional, is pretty poor for content. I can only see content being more deeply embedded in the customer journey going forward, which Drupal 8 is awesome at managing.

So are there any good examples of some medium - high profile sites running on D8 + Commerce?

I recall Lush Cosmetics being on D7 + Commerce, but any D8 ones out there?

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

[HTML5/Javascript or Windows app] Viewing a million CSV records - date/temp/humidity. Does a program exist already?

Learn Programming - Fri, 03/16/2018 - 00:04

Is there a website that lets us view a year or more temperature/humidity sensor data from a CSV file?
It sounds like something someone may have already written, given the number of available sensors on the market.

I've got a SensorPush model it has a data viewer Android app, but it's lacking a "select a section" zoom, and an overlay of weekly results. It's also not on my PC!

So I exported the data - and it's in the CSV format of:

"2017-05-06 12:34","22.99","36.45"
"2017-05-06 12:35","23.34","43.53"
"2017-05-06 12:36","23.39","43.04"
"2017-05-06 12:37","23.38","42.83"
"2017-05-06 12:38","23.35","42.74"
"2017-05-06 12:39","23.30","42.68"
"2017-05-06 12:40","23.24","42.71"

Hah, quotes around the floats!

So the data:
It's an ASCII CSV file.
There's a years worth of data - 500,000 items, sampled ever minute.
Each record is : ISO standard date and time, and two series.

I'm hoping there's something that can navigate a chart of that data as one long linear one... and zoom in to places of interest.
Another display the program should do is overlay the data into week chunks so I can compare temperature changes.

If not - I was thinking of putting together a website that lets anyone with generic sensor data to upload it!

So my other main question is - what JavaScript "Big Data" charting software does anyone recommend?

Thanks for your time!

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

Beginner here in the military. Going on deployment and won’t have internet but want to learn to code while I’m gone.

Learn Programming - Thu, 03/15/2018 - 23:57

Im in the military and want to learn code and hopefully get into web development after I get out. Is there any software I can buy/download that will help me learn how to code that can run offline? I’m bringing my pc laptop with me on deployment but most likely won’t have internet for 6 months. I’ve looked and can’t find what I’m looking for. Any help would be appreciated. I really want to learn to code!

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

Possibility to simplify my rather long Regex

Learn Programming - Thu, 03/15/2018 - 23:44

I need regex that matches floating points BUT NOT INTEGER. I have come up with:


Following is my test strings. The regex should match everything except #1 and #2:

  1. 452345
  2. -452345
  3. 435624f
  4. 543.5342
  5. 6545.5438f
  6. 54332.
  7. .543
  8. .4634f
  9. 452345e4
  10. 435624E+5f
  11. 543.5342e-7
  12. 6545.5438e+58f
  13. .543e+4
  14. .4634e-76f
  15. -435624f
  16. -543.5342
  17. -6545.5438f
  18. -54332.
  19. -.543
  20. -.4634f
  21. -452345e4
  22. -435624E+5f
  23. -543.5342e-74
  24. -6545.5438e+8f
  25. -.543e+4
  26. -.4634e-74f

My regex does work, but is it possible to simplify it further?

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