• Breaking News

    Wednesday, April 10, 2019

    If you have a student email, take advantage of the Github student pack and others learn programming

    If you have a student email, take advantage of the Github student pack and others learn programming


    If you have a student email, take advantage of the Github student pack and others

    Posted: 10 Apr 2019 03:04 PM PDT

    https://education.github.com/pack

    Gives you a lot of free access to learning and dev tools to try out for a month to a year.

    https://www.jetbrains.com/student/

    You can get their professional IDEs for free.

    submitted by /u/PyTec-Ari
    [link] [comments]

    Now, you can learn new IT related skills online for free from Microsoft

    Posted: 10 Apr 2019 02:14 AM PDT

    Recently, I came across a site which provides awesome online courses which you can take for free. The courses and tracks are designed and made by Microsoft. Thought I should share this with you so people who want to learn this skills can find necessary guidance made by experts working in the industry. Now, you can also skill up with the experts, and help open career doors. Things you can learn include data science, artificial intelligence, IoT and much more. Details can be found from here, https://academy.microsoft.com/en-us/professional-program/tracks/

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

    How do i remember what i learn?

    Posted: 10 Apr 2019 04:34 PM PDT

    Whenever i go too start programming something to make sure i understand it. It all seems to vanish and i forget everything that ive learned besides for the basic print commands. How do i remember this stuff?

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

    Recently completed my engineering degree and want a career in computer science. I need some guidance.

    Posted: 10 Apr 2019 06:14 PM PDT

    Here's some background: I just turned 24, I graduated with a degree in Civil engineering in 2018. During school I worked a co-op position and I have been working for 8 months after graduation in my field of study which I am grateful for, however, there is/was no passion. My undergraduate degree saw 2 separate occasions (first and third year) where I went to the office of administration to switch to computer engineering, but I just did not pull the trigger. I guess it was the fear of leaving what was comfortable/safe. I say this to make clear that I've been sitting with this for some time now and I need to make a change. I have taken C and Python in school and I enjoyed them a lot (lead to the dilemmas). I have been working on Colt Steeles web development course on Udemy and continued python studies with free continuation of the course i took in school but I struggle with consistency with a pretty nasty commute and laziness frankly.

    I consider my position quite flexible. Should I enroll in a bootcamp? Go to college (shorter than university in Canada can be 2 years The idea of doing another 4 year bachelors degree seems pretty daunting to me)? Or grind the self-taught route? Any guidance is very much appreciated. I am ready to pull the trigger.

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

    Any advice for a student looking to get into contributing to open source for the first time?

    Posted: 10 Apr 2019 09:05 PM PDT

    I'm looking into contributing to GitHub code for the first time better because I've heard it'll help with learning and to show potential employers that I know stuff and am active. But it's all very daunting, nothing like what I've done before. Any tips on where to begin? Thanks!

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

    Feeling lost on web developer bootcamp. Wanting to quit.

    Posted: 10 Apr 2019 08:23 PM PDT

    I am currently a sys admin. When I was getting out of the military I was contemplating the route that I wanted to go. Programming was the route I decided. I purchased a couple of different udemy classes, Colt Steele's boot camp being one. This was about 2 years ago. Due to moving or something always coming up I have never made it through and have started over several times. The position I'm in is maintaining web servers and if I can ever learn to program I can get real experience by developing some things here in php.

    I recently made it a goal this year to really learn programming I am currently on the advanced DOM section however, I continue to feel lost. I feel like every exercise given I don't remember the syntax and I need to go back to the previous video (which I feel is cheating) or I need to search the web to find a solution which may not line up with what he is trying to teach in the exercise. This leads to me feeling very frustrated and wanting to give up.

    So for anyone who's aware of the bootcamp is it just not good? Does he not provide enough exercises to grasp each topic and correct syntax?

    Or should I be doing my own exercises as I go through this? If this is the answer then how do I know what to do?

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

    In c ++ how do I access the element of a queue struct in a linked list ?

    Posted: 10 Apr 2019 09:54 PM PDT

    struct std_element {
    string coin;

    };
    struct node {
    std_element el;
    node *next;

    };
    struct queue {

    node *head, *tail;
    unsigned credit;

    };

    //lets say I want to create a queue called q1 and access the elements inside of it .

    queue q1;

    q1.head->el.coin = "nickel";

    cout << q1.head->el.coin;

    //is it posible to do it , can someone give me an idea why it is not working? .I can access the elements of node struct and std_element struct normally but im stuck with the queue struct . Thank you for any answers .

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

    Need help understanding what this C code does

    Posted: 10 Apr 2019 07:39 PM PDT

    Hey guys, so I have an assignment to translate some C code to assembly. Problem is, I'm pretty unfamiliar with C and the first step here is obviously figuring out what this C code snippet does in the first place.

    C code in question: https://pastebin.com/BCEeSJXq

    I know this code is a simulator of MIPS, and it has something to do with the Babbage program of summing cubes, and that's what the hex code in the long m[MAXMEM] is (my code from a previous assignment). I'm just unsure of where to start looking to translate everything, and I'm a little overwhelmed. Any help would be appreciated.

    EDIT: honestly I looked at it for a bit and it kinda clicked, haha. It's the same as my program before, just prints all register contents after each step.

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

    Need help with code for a programming assignment

    Posted: 10 Apr 2019 09:05 PM PDT

    Here is the assignment that I am working on:

    "A parking garage charges a $3.00 minimum fee to park for up to two hours. The garage charges an additional $0.75 for each hour or part thereof in excess of two hours. The maximum charge for any given 24-hour period is $12.00.Assume that no car parks for longer than 24 hours at a time. Also round hour upward to its nearest integer. For example, if someone parks for 4 hours and 15 minutes, it will be rounded to 5 hours. Write a JavaScript program that calculates and displays the parking charges for each customer. Also, round the result up to two decimal places."

    I believe that I have created the basic code for the program, but it is not displaying as intended and i'm not sure what isn't working. Forgive me if it looks messy or very amateur, as the programming world is completely new to me. Here is the code I have written so far:

    <!DOCTYPE html> <html> <head> <meta charset = "utf-8"> <title>Assignment 3</title> <style type = "text/css"> div { text-align: center; width: 25%; position: relative; left: 25%; border-width: 5px; border-style: solid; } </style> </head> <body> <form action=" "> <div><table> <tr> <th style = "border-style: solid"> Total Amount </th> <th style = "border-style: solid">Amount</th> </tr> <tr> <th style = "border-style: solid">Hours</th> <th style = "border-style: solid"> <input type="text" id="Hours"> </th> </tr> <tr> <th style = "border-style: solid"> <button onclick="calculateCharges()">Calculate</button> </th> <th style = "border-style: solid"><p id="due"></p></th> </table></div> </form> <script> function calculateCharges() { var Hours = document.getElementById("Hours").value; if (Hours = 0) { var Charges = 0; } else if (Hours > 0 && Hours <= 2) { var Charges = 3; } else if (Hours > 2 && Hours < 24) { var Charges = num.toFixed((Math.ceil(Hours - 2) * .75) + 2); } else { var Charges = 12; document.getElementById("due").innerHTML = Charges; } } </script> </body> </html> 

    I greatly appreciate any insight and assistance anyone can provide with what I am doing wrong. I'm just a bit stuck at the moment.

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

    Snowden (2014) coding test?

    Posted: 10 Apr 2019 08:44 PM PDT

    As someone who is a front end developer, what exactly was Snowden doing in the code test link to clip, mainly with the ether net cables

    How hard of a test was that he was doing?

    submitted by /u/Storm-Spirit
    [link] [comments]

    Having a dilemma, keep trying Swift or attempt to learn python

    Posted: 10 Apr 2019 08:31 PM PDT

    For the past 2-3 months I have tried many resources to learn Swift. I just am not sure if I'm advancing enough to continue. I know that is horrible I really want to learn how to build iOS apps but sometimes feel like I am not getting or understanding some of the concepts. I have tried a Udemy course (which ended in an error I wasn't able to figure out nor did it seem anyone else could), took to trying Stanford iOS class on iTunesU got stuck when I had to complete a challenge on my own. Finally I am on day 7 of 100 days of Swift from Hacking with Swift. When I take the quizzes I get about 50-70% of the questions write.

    I have been following r/python for a while and seem to like the language I tried learning it about 8 months ago but got busy and couldn't continue. I just don't know if it would be a fit for me. I like the idea of creating an app of an iPhone. At the same time seeing the amazing things python can do. My only issue is, I see people using it to solve issues in their jobs like automating a task etc, well I'm a cashier so I don't have any issues I can automate. If that makes sense.

    What should I do? Give Swift more time?

    Edit: forgot to add, I found a resource called SoloLearn, I have python and Swift on there. Been doing more of the Swift than python so idk

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

    .NET Core:Unable to resolve service for type while attempting to activate controller

    Posted: 10 Apr 2019 11:49 PM PDT

    I'm trying to make a simple ToDo List app following a tutorial and I get the following error(it appears when I log in as user and try to access my ToDo list):

    InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager`1[AspNetCoreTodo.Models.ApplicationUser]' while attempting to activate 'AspNetCoreTodo.Controllers.ToDoController'.

    TODO Controller:

    namespace AspNetCoreTodo.Controllers { [Authorize] public class ToDoController : Controller { private readonly IToDoItemService _toDoItemService; private readonly UserManager<ApplicationUser> _userManager; public ToDoController(IToDoItemService toDoItemService, UserManager<ApplicationUser> userManager) { _toDoItemService = toDoItemService; _userManager = userManager; } public async Task<IActionResult> Index() { var currentUser = await _userManager.GetUserAsync(User); if (currentUser == null) return Challenge(); var items = await _toDoItemService .GetIncompleteItemsAsync(currentUser); var model = new ToDoViewModel() { Items = items }; return View(model); } [ValidateAntiForgeryToken] public async Task<IActionResult> AddItem(ToDoItem newItem) { if(!ModelState.IsValid) { return RedirectToAction("Index"); } var currentUser = await _userManager.GetUserAsync(User); if (currentUser == null) return Challenge(); var succesful = await _toDoItemService.AddItemAsync(newItem,currentUser); if(!succesful) { return BadRequest("Couldn't add item"); } return RedirectToAction("Index"); } [ValidateAntiForgeryToken] public async Task<IActionResult> MarkDone(Guid id) { if (id == Guid.Empty) { return RedirectToAction("Index"); } var currentUser = await _userManager.GetUserAsync(User); if (currentUser == null) return Challenge(); var succesful = await _toDoItemService.MarkDoneAsync(id,currentUser); if (!succesful) { return BadRequest("Could not mark as done"); } return RedirectToAction("Index"); } } } 

    ToDo Item Service:

     public class ToDoItemService : IToDoItemService { private readonly ApplicationDbContext _context; public ToDoItemService(ApplicationDbContext context) { _context = context; } public async Task<bool> AddItemAsync(ToDoItem newItem,ApplicationUser user) { newItem.Id = Guid.NewGuid(); newItem.IsDone = false; newItem.DueAt = DateTimeOffset.Now.AddDays(1); newItem.UserId = user.Id; _context.Items.Add(newItem); var saveResult = await _context.SaveChangesAsync(); return saveResult == 1; } public async Task<ToDoItem[]> GetIncompleteItemsAsync(ApplicationUser user) { return await _context.Items .Where(x => x.IsDone == false && x.UserId==user.Id) .ToArrayAsync(); } public async Task<bool> MarkDoneAsync(Guid id, ApplicationUser user) { var item = await _context.Items .Where(x => x.Id == id && x.UserId==user.Id) .SingleOrDefaultAsync(); if (item == null) return false; item.IsDone = true; var saveResult = await _context.SaveChangesAsync(); return saveResult == 1; } } 

    Startup.cs (where I suppose the problem is)

     public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure<CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext<ApplicationDbContext>(options => options.UseSqlite( Configuration.GetConnectionString("DefaultConnection"))); services.AddScoped<IToDoItemService, ToDoItemService>(); services.AddDefaultIdentity<IdentityUser>() .AddDefaultUI(UIFramework.Bootstrap4) .AddEntityFrameworkStores<ApplicationDbContext>(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } } 

    I tried changing AddDefaultIdentity to ApplicationUser, add new Identity, didn't work :/.

    ApplicationUser is just a class I created that inherits IdentityUser.

    Any help?

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

    Lambda School wasn't for me....

    Posted: 10 Apr 2019 11:09 AM PDT

    A little about me:

    I've been studying programming on my own for over 2 years now, mostly as a hobby. Only know a little HTML and Javascript after doing FreeCodeCamp and CodeAcademy tutorials. I even tried my hand at a local bootcamp to learn further but couldn't finish due to work.

    After working in hospitality most of my life I wanted to make a change and finally pursue a career in tech as a software programmer. I mulled either going to school or doing a full time bootcamp. Money was an issue and I didn't want to drop thousands of dollars on a bootcamp without knowing if I'd get a job or not. Lambda School came across my path due to their ISA with no upfront cost, also the curriculum for their Web Development Track was everything! I wasn't working at the time so I decided to apply and I was accepted a week later! After completing their pre-coursework and code challenge I was ready to begin...or so I thought.

    Beginning Lambda I was nervous because I was virtually a beginner and I've heard their school can be intense, just like the life of a programmer. The staff reassured me that I would be okay if I worked hard, which I was prepared to do. My cohort had at least 250 people but split into groups of about 8. The first week was pretty brutal but I felt like I did learn a lot about git and version control. I found the daily 3 hour lecture to be long but informative. My PM was previous students of the program and sometimes couldn't answer my questions in a way that I could understand. They didn't even check our code for the projects, making me feel like I wasn't learning anything. The pace was incredibly fast and it was easy for me(and others) to get left behind. My PM offered to let me redo a week but I felt like the teaching and material was lacking, especially with the "Google is your friend" motto. Why pay for a program if I could be learning on my own for free?

    Eventually I left the school in the third week and back at the drawing board. I'm thinking of going the self-taught route or even going to college. Any advice would be helpful.

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

    If you only had a month and an hour a day to learn a programming language, which one would it be?

    Posted: 10 Apr 2019 11:09 PM PDT

    Sorry for the vague question but what I'm trying to ask is if you could only learn one programming language in lets say a month for an hour a day, basically learn a program language at basic level, which would you learn and why is it the most useful? Thank you everyone for your input

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

    Having an odd issue passing in derived class object into a function...

    Posted: 10 Apr 2019 10:52 PM PDT

    Done in C++, using Microsoft Visual Studio

    I get a compiler error for just one function under class 'player', but not for the near exact same function in class 'enemy'

    They are both derived from the base class 'entity'.

    I am lazy, so here is my code as well as the compiler errors.

    #include <iostream> #include <windows.h> #include <string> #include <random> #include <time.h> using namespace std; class entity { public: void setLvl(int x) { lvl = x; } void setGold(int x) { gold = x; } void setHp(int x) { hp = x; } void setHpMax(int x) { hpMax = x; } void setDmgMin(int x) { dmgMin = x; } void setDmgMax(int x) { dmgMax = x; } void setStr(int x) { str = x; } void setVit(int x) { vit = x; } void setAgi(int x) { agi = x; } void setName() { cout << "Enter a name: " << endl; cin >> name; } int getLvl() { return lvl; } int getGold() { return gold; } int getHp() { return hp; } int getHpMax() { return hpMax; } int getDmgMin() { return dmgMin; } int getDmgMax() { return dmgMax; } int getStr() { return str; } int getVit() { return vit; } int getAgi() { return agi; } string getName() { return name; } private: int lvl; int gold; int hp; int hpMax; int dmgMin; int dmgMax; int str; int vit; int agi; string name; }; class player : public entity{ public: player() { setName(); setLvl(1); setGold(0); setHp(50); setHpMax(50); setDmgMin(5); setDmgMax(10); setStr(0); setVit(0); setAgi(0); } void takeDmg(int x) { setHp(-x); } int dealDmg(entity* thisEnemy = new enemy()) { //THIS part is yelling at me, even though int x = rand() % getDmgMax() + getDmgMin(); // the near exact same method is fine ((player*)thisEnemy)->takeDmg(-x); // LOOK lower to see it. Its commented. cout << getName() << " deals " << x << " DMG -> " << ((player*)thisEnemy)->getName() << "[HP: " << ((player*)thisEnemy)->getHp() << "]" << endl; return x; } private: }; class enemy : public entity { public: enemy() { setName(); setLvl(1); setGold(0); setHp(50); setHpMax(50); setDmgMin(5); setDmgMax(10); setStr(0); setVit(0); setAgi(0); } void takeDmg(int x) { setHp(-x); } // THIS LINE IS NUMBER 68 IN MY COMPILER int dealDmg(entity* thisPlayer = new player()) { // THIS part works fine, NO errors from int x = rand() % getDmgMax() + getDmgMin(); // The compiler in this method. ((player*)thisPlayer)->takeDmg(-x); cout << getName() << " deals " << x << " DMG -> " << ((player*)thisPlayer)->getName() << "[HP: " << ((player*)thisPlayer)->getHp() << "]" << endl; return x; } private: }; int main() { srand(time(NULL)); entity* myPlayer = new player(); entity* myEnemy = new enemy(); for (int i = 0; i < 9; i++) { ((player*)myPlayer)->dealDmg(((enemy*)myEnemy)); Sleep(500); ((enemy*)myEnemy)->dealDmg(((player*)myPlayer)); Sleep(500); } cout << "end" << endl; return 0; } 

    COMPILER ERROR:

    syntax error: identifier 'enemy' line: 69 (lol, not planned)

    I do not understand how the compiler can give me one error for one method, but not another, despite the fact they are essentially the SAME method. Please help.

    ty <3

    TL:DR--- I don't really understand inheritance and am running into a problem passing two class objects derived from the same base class into each other.

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

    I'm working on my final project for CSP class and am encountering an error I need help with

    Posted: 10 Apr 2019 04:32 PM PDT

    Basically every time I run the code, when I get to the gameScreen, my drawing time timer works, but then my timer for guessing stops at counting down from 30 on 29. Can you guys help me figure out why this is happening?

    https://studio.code.org/projects/applab/TzDxiJq5GxDSkOz1XvSYHlLOhxMah3dCXL6nPJ2vlHU

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

    Access bank account data?

    Posted: 10 Apr 2019 10:25 PM PDT

    Recently found an app that tracks my net worth across multiple accounts (even stock brokerages). I wanted to make my own iteration of the idea with some improvements (especially live tracking). I am curious how apps like this support so many different bank accounts. Is there some universal https request standard?? Where do I start with reading this data myself? I absolutely do not want to use a 3rd party api, but rather learn how to make the network requests myself. Any *pointers? Thanks:)

    Also if there is a open source api that you are aware of, I would love to dig through the code.

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

    Resources/tutorials for making my own Wikipedia website (Similar to A Wiki of Ice and Fire)

    Posted: 10 Apr 2019 09:31 PM PDT

    I really dont know where to get started.

    This is the best tutorial I've found but it's still confusing to me as an amateur coder

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

    Thanks guys!

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

    What will be the final time complexity of this program? [Python]

    Posted: 10 Apr 2019 09:11 PM PDT

    def first_non_repeating(input_str):
    flag = None
    d = dict()
    for char in input_str:
    if char not in d.keys():
    d[char] = 0
    else:
    d[char] += 1

    non_repeating_items = [(k,v) for k, v in d.items() if v == 0]

    if len(non_repeating_items) > 0:
    flag = non_repeating_items[0][0]

    return flag

    result = first_non_repeating("aabbcc")
    print(result) # None
    result = first_non_repeating("djebdedbekfrnkfnduwbdwkd")
    print(result) # j

    Now the problem is quite simple: Given a string, print its first-non repeating character

    I have used a dictionary (similar to map in Java) to keep track of the count.

    And then filtering all the keys whose value is zero, taking the first element from that list and returning it

    Now the real thing bothering me is: what is the time complexity of the whole program ?

    For a string of `n` characters, we first scan all the characters to create the dictionary. So that amounts to O(n)

    Next we create a list of values from the dictionary whose value is zero, in the worst case all the keys have zero value. So this also amounts to O(n).

    The final step involves plucking the first element, so that is constant time i.e. O(1)

    This way the time complexity of the overall program will be O(n) + O(n) + O(1)

    or O(2n + 1). Can I assume this is effectively O(n) or am i missing something here ?

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

    What resource websites do you guys use?

    Posted: 10 Apr 2019 08:47 PM PDT

    So there's GitHub and stackoverflow. What else am I missing? Btw, I'm currently learning cpp on my own in order to take Data Structure on cpp in college. Any resources would help a lot. Thanks for your input

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

    Averaging the values of all the nodes in a binary search tree

    Posted: 10 Apr 2019 07:34 PM PDT

    Hello, I am starting to learn about binary search trees, and I was presented with the question of averaging the values of all the nodes in a binary search tree. My first thought was two create two helper functions sum() and numElements() and simply divide sum by numElements to get the average.

    My question is, can this be accomplished using only one function and no constant variables? I feel like this would defy the capabilities of recursion/divide and conquer, because we can't really divide the task of averaging values into smaller tasks.

    submitted by /u/noob-scrub
    [link] [comments]

    I could use some people to talk to.

    Posted: 10 Apr 2019 03:47 PM PDT

    I'm a 36yo male living in the United States and I have wanted to learn programming for a long time.

    One problem I have is that there is nobody to talk to. I don't need help as much as I need people around with the same interest that can give me company so that I don't feel alone all the time.

    Does anyone know of good groups that voice chat that I could join? Anyone up for hanging out on a voice chat?

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

    Using python in a php website

    Posted: 10 Apr 2019 12:57 PM PDT

    Many big and popular websites are built using multiple languages. I am confused about how this is done.

    Lets say I write most of a website in php, but i want to use python within my site because of its machine learning and data capabilities for certain tasks.

    Say i wanted to take data input or selected by the user and use python to do linear regression or some other analysis and display that information in my webpage numerically and/or visually with matplotlib, seaborn, etc.....

    How would i do this? Or where can i start to learn more about these kinds problems.

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

    RUBY: How do I sum up elements in this data structure? A hash multiple hashes where the value is an array of hashes...

    Posted: 10 Apr 2019 03:07 PM PDT

    I have this data structure of stats that are grouped by id and date. I need to sum up all of the values.

    { [12345, Mon, 11 Mar 2019]=>[ { :id=>12345, :date=>Mon, 11 Mar 2019, :values=>{:total=>895, :numA=>4, :numB=>0} }, { :id=>12345, :date=>Mon, 11 Mar 2019, :values=>{:total=>227, :numA=>0, :numB=>0} }, { :id=>12345, :date=>Mon, 11 Mar 2019, :values=>{:total=>7507, :numA=>66, :numB=>0} } ], [12345, Tue, 12 Mar 2019]=>[ { :id=>12345, :date=>Tue, 12 Mar 2019, :values=>{:total=>632, :numA=>7, :numB=>0} }, {:id=>12345, :date=>Tue, 12 Mar 2019, :values=>{:total=>446, :numA=>2, :numB=>0} } ] } 

    There are hundreds of elements. Those are just two.

    I need to sum up all of the VALUES. So I should still return a hash of hashes, or preferably an array of hashes, with the same amount of elements, but not all of those mini hashes in between them with individual values. They should all be summed up. So I should have ONE stat for March 11, which is a summation of all of the March 11 stats with that same id, one for march 12 with the same id, etc...

    so like [12345, Tue, March 2019] should map to a single hash. With :id=>12345, :date=>Tue march 12, :values=>{:total=>ONE TOTAL, :numA =>ONE NUM_A, :numB=>ONE NUM_B }

    I've tried things with inject and map, I figure the solution is somewhere using those. I'm still struggling a ton with this. Thanks.

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

    No comments:

    Post a Comment