• Breaking News

    Saturday, July 27, 2019

    C++ & XCode debugging memory/variable location Ask Programming

    C++ & XCode debugging memory/variable location Ask Programming


    C++ & XCode debugging memory/variable location

    Posted: 27 Jul 2019 04:00 PM PDT

    EDIT: I'm a fucking idiot. I hadn't actually stepped into the function yet. Not sure why it claimed both views of r had different values at the same address but as soon as I stepped in the nonzero one got set correctly so maybe it was just looking at one of the argument registers, or something. The bug I am hunting lives on, but at least it's not here. Ignore this post.

    https://imgur.com/a/U5UsJ9G

    Hopefully the link above works. Please let me know if that's not the case.

    I'm moving from C to C++, writing a simple chess engine as a first project, in XCode. Running into a bug I've got no idea how to fix. I consider myself a good C programmer and I have a good handle on stack frames and where most data lives in memory in a C program, however I have very little understanding of all the various constructors that C++ offers or how & when they allocate memory.

    I have a breakpoint on the constructor in the second image, set to the condition that (r < 0 || r > 7 || c < 0 || c > 7), since the oob (out of bounds) member seems to be getting set incorrectly. I hit the breakpoint, and the debugger showed both r and c as having the value 0 but being greater than 7. I added a new expression "r" to the variable view window and this time it showed up as a large (seemingly random?) value. Using "view memory" on either of the "r" expressions in that window shows me the same pointer to the same chunk of memory.

    The nonzero value of r has no zeroed bytes so it doesn't seem to be an endian or word-size issue. My best guess is it's some complication of C++'s member initialization that I don't understand.

    Please help.

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

    I'm curious about the reasoning and methodology behind the long string of numbers for versions and updates of professional apps

    Posted: 27 Jul 2019 06:56 AM PDT

    Why does it always seem to be something like "v1.0.1.4.2.7," instead of just "version 26" or something like? What's the thought process behind that? How do they decide which number to increase, or when to add a new decimal place? I feel like, if I were releasing something professionally, I would probably just be adding numbers at the end somewhat arbitrarily, only doing it because that's what people expect professional version numbers to look like.

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

    Will answering questions on subreddits for learning languages and putting my Reddit on my resume help in applications?

    Posted: 27 Jul 2019 06:11 PM PDT

    'User' and 'Post' Relationship No SQL

    Posted: 27 Jul 2019 05:46 PM PDT

    I'm playing around with Mongo DB for the first time and want to know what is the best way to model a 'user' and 'posts' relationship.

    I feel like they should be in separate collections as there may be thousands of posts per user and this seems like it would significantly slow down the reading of the user collection.

    Should I reference the posts owner through the object Id of the user and store that in post?

    Or should I have an array of post ID's within the user object, with just the usernames first name and last name mentioned in the post? This way I can update all referenced posts if there is a change to the user record.

    What would be the standard approach?

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

    Running my program from terminal (st) breaks it while works fine on pythontutor.com (C, whitespace, Infix->Postfix)

    Posted: 27 Jul 2019 03:23 PM PDT

    Here is the code -- > https://pastebin.com/XUcStdUM

    It works fine when I use it on pythontutor.com but fails when I am using whitespace in terminal.

    for ex: a+b*c --> abc*+ [This works]

    a+b * c --> ab+ [This doesn't]

    Is there any better way to code the condition for the whitespace?

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

    What would be the best data store for fast write/read of billions of float32s? SQLite? Hdf5? Other?

    Posted: 27 Jul 2019 04:26 PM PDT

    I am trying to create a library for sparse training. So it would need fast read/write of not only the machine learning model weights, but their optimizer momentum values as well. At the moment I would only like to experiment with values in the billions.

    Each parameter would be a float32 value.

    One example case is for embedding training. An embedding would be 256 dimensions of float32 values, and there would be say 60 million of those embeddings.

    I think I can just use a single column in all cases, but there may be some instances where multiple columns would be helpful. For example, each column would represent a different component in the machine learning architecture.

    Each update step in the training would be looking up and writing values do the data store, so I am looking for the fastest database for my situation. Having a database at all would already significantly reduce ram memory, so that that is not a concern for me.

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

    How can I create a two-dimensional matrix with strings on C?

    Posted: 27 Jul 2019 12:18 PM PDT

    I know that to create a matrix is done in the following way:

    int matrix[2][2];

    In this case it means that it will be a 2×2 matrix.

    I know that one of the ways to declare a string in C is like an arrangement of charts:

    char str1[2] = "Hi";

    But how can I do to have an array of n×m that are strings?

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

    Tech for Automated Food Ordering

    Posted: 27 Jul 2019 02:58 PM PDT

    So a while back I saw a guy build something that systematically ordered his food for him on a website for a restaurant he frequently eats at. I am now looking to do something similar, just as a learning experience.

    What kind've languages would this sort've thing require? JavaScript? HTML?

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

    Local host MVC net question

    Posted: 27 Jul 2019 02:35 PM PDT

    I get the local host message: the model item passed into the dictionary is of type 'System.Collections.Generics.List'1[final_budget_expense.Models.BudgetRecord]', but this dictionary requires a model item of type 'final_budget_expense.Models.BudgetRecordViewModel'. I have tried searching online, but have been unsuccessful. I ended up including a view model and tried to compile the code and got this message. I have tried playing around with my controllers and see what model is being included, but I have been unable to pinpoint the issue. I can share code if necessary. Any tips or advice.

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

    Is there a name for this design goal?

    Posted: 27 Jul 2019 10:40 AM PDT

    In computer engineering, there's the famous goal of "scalability". But that's mostly for performance; it refers to a system's ability to accommodate a higher workload with linear scaling of costs.

    Is there a name for the design goal of scalability, but from the programmer's perspective (sort of)? Basically, the goal of designing the skeleton of a system such that when a programmer works on any given part, they don't have to think about the bigger picture and how everything connects together, and they can focus all their energy on their little portion.

    I'm familiar with the design goal of modularity, but I think I'm speaking of something slightly different. There are systems that satisfy my property, but I wouldn't describe as "modular", necessarily. Some examples:

    • Academic papers. Academics don't need to think about how their work fits into the bigger picture of human knowledge. They can just submit their paper to the correct journals, and their paper will get incorporated into the proper place within our collective knowledge automatically.
    • Wikipedia. Volunteers don't have to think about how their edits will impact the entirety of Wikipedia, despite the fact that at any one point in time, "Wikipedia" is just some set of articles, and they are changing that state. They don't need to think about policy guidelines or whatever---as long as they're editing with good intentions, everything will self correct.

    The idea I'm trying to capture here is a system that has a lot of entities working on it together, but is carefully designed so that the workers can focus as much energy as possible on their work, and not how the system fits together, for the system to be successful.

    This is obviously more general than programming, but I'm asking it here because I tend to get the best answers from here.

    It's not modularity, because that's more a property of what the system looks like (it has modules) than what it's able to do. It's not "self correcting", because that doesn't capture the notion of making the collective effort sum together in an efficient way. Maybe "efficient"? But that means many things.

    Sorry for the long post. Also, reading this again I realize this perhaps isn't the most clear, so please ask me for clarifications as to what I'm trying to say.

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

    Should I get of of developing for Magento?

    Posted: 27 Jul 2019 05:14 PM PDT

    My first job was developing a new Magento website and maintaining their existing one for a sister company. Now I work at a bigger company doing Magento work. Anyone have experience with the platform? Anyone who's worked with it would know how much of a pain it can be because of how massive the system is. I don't know if these are the skills I want to keep putting my time into.

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

    Hosting ASP.NET website with custom domain from home with IIS and DDNS through No-IP

    Posted: 27 Jul 2019 10:51 AM PDT

    Whew. Quite the hefty title right there.

    I am in the process of configuring a website that will be served through my local network and the comfort of my own home. I am a bit lost in the weeds when it comes to the litany of protocols, IP addresses, and the interconnected channels of Windows/auxiliary tools. The topic of web and networking is documented in depth so I want to keep this brief as I understand most of what is happening but I am having difficulty actually serving the files and I'm struggling getting data online.

    So far, I've managed to be able to type an address into a browser and have the application home page show up...but I think this is still resolved locally through a loopback or something?

    I've done manual configuring with the records of the DDNS provider (which happens to have built-in functionality with my router I guess?) and the domain registrar that I think are correct I just need some guiding after that. I've got a neighbor I can ask about what direction to head and maybe another guy; however, this is something I would really like to build mostly myself or with the help of online communities. In any event Reddit, thanks, and have a good weekend.

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

    [Request] Simple Input to log program

    Posted: 27 Jul 2019 03:29 PM PDT

    Hey guys.

    I have a need for a tiny program that simply takes what ever it is piped in.. fx if i use "program.exe horse" it would write horse in the txt log file it would create. and each time i use it, it would add a new line with the imput..

    Anyone able to assist on this request?

    Thank you already

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

    Reddit Personal Project Question

    Posted: 27 Jul 2019 10:47 AM PDT

    Hey pals!

    So I've recently started trying to lose weight and have joined a couple weight loss subs. One "issue" (more of an annoyance) I have with them is that some people post numbers using metric over imperial, and because Imma dumb American I can't be helped to look them up myself.

    Then I thought this could be a cool project. To make some sort of bot or something to go through reddit (or maybe even chrome as a whole if that'd be easier in some weird way) and show the equivalent units or something like that. So, what technologies do you think would be good for this? I'd prefer something using python but I'd be open to whatever. Just don't know what libraries or frameworks to look into to build this.

    And yes, I'm assuming there's already some product like this but I'd like to build it myself for the experience.

    Thanks!

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

    Should the Go Store be campaigned against by environmentalists for shipping a single $0.50 sticker in a $3.70 box instead of an envelope?

    Posted: 27 Jul 2019 06:40 PM PDT

    I think yes.

    Please share your thoughts.

    Also I would like to buy one (1) Sit Gopher for $1.25 (that will cover your stamp and envelope). Please let me know if you can come through.

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

    Language button on Javascript

    Posted: 27 Jul 2019 05:47 AM PDT

    Context : I made a rock paper scissors webpage where you play against the computer. It provides status updates on the match ups so e.g. if you picked rock and the computer also picked rock it would say "rock vs rock. It's a draw".

    problem: It's all works out fine when its in english, a simple if statement makes it work out. However I'm trying to make it so if you press for example the japanese button, it switches the status updates to japanese instead of english. Is there a method for doing this? I was thinking of toggling an active class on the buttons when they're pressed and then writing an if statement along the lines of -- If (button is active) {DOM manipulate so that text is in desired language}. However I could not find anything for that if button is active statement.

    Question: How would I go about doing this ? Is there a better way of doing it than I thought?

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

    Curly brackets or whitespace for a scripting language

    Posted: 27 Jul 2019 02:32 AM PDT

    So I wrote a scripting language [intepreted] for use in runtime compilation in Unity3D. I wrote the language and it works, however, I wrote it to use curly braces, it works well but I thought the people who will use the scripting language in runtime in their unity games won't want a bulky language. I rewrote the parser to use whitespace instead in another version, however, I don't like the lack of flexibility this gives me when writing programs. What is the objectivly best option for a 'leightweight scripting language for use in runtime compilation in Unity'. [an example use is a game where you write code in-game to control an AI]

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

    Reading compressed data from an .xml

    Posted: 27 Jul 2019 02:31 AM PDT

    I'm working on editing some files for the game Rimworld. Specifically I am trying to load the map grid data as a .csv (or similar).

    I located the data I need in the save file (.xml file), however the data is deflated (I believe via Unity, but not sure). Does anyone know how to turn this gibberish into something readable?

    https://imgur.com/a/pO40DtN

    I can post the full data if wanted but it's rather long and I didn't want to bloat the post. https://pastebin.com/i7Q39PFA

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

    Quick question about ruby on rails, creating an environment

    Posted: 26 Jul 2019 10:53 PM PDT

    Hi there everyone! I'm a fairly new programmer following the upskill course that is recommended on the subreddits and I was just flying through them but I hit a brick wall during the ruby portion.

    I tried googling anyone who had the same option but to no avail, its mostly during the start (lesson 32: Turning Cloud9 into a server) and whenever I try typing "rails server -b $IP -p $PORT" it doesn't do anything. it gave a bunch of lines and even when perusing through it, I don't see anything related to what I'm supposed to do and since I'm pretty new, I tried seeing if there's anything that makes sense but I'm quite confused.

    Here's a photo of the situation: https://imgur.com/fHfQGmf. I tried doing rails new as well but nothing is really happening.

    Thank you for your help! Keeping and eye on this because I wanna jump right back into the course to keep learning.

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

    No comments:

    Post a Comment