• Breaking News

    Monday, March 15, 2021

    How do I avoid going insane while unit testing shitty code with a shitty unit testing program? Ask Programming

    How do I avoid going insane while unit testing shitty code with a shitty unit testing program? Ask Programming


    How do I avoid going insane while unit testing shitty code with a shitty unit testing program?

    Posted: 15 Mar 2021 05:34 AM PDT

    There are two problems here:

    1. The code is bad. Many variables are named value, pointer, amount... Functions are non-descriptive and it's often unclear why they are used. I'm currently testing a SD-card interfacing module, which has four functions to read the same data from the card. Why?? There are doxygen comments on the functions, but they basically just repeat the function name. Everything is a singleton, everything needs a billion functions, there is a "DataService" that deals with over a thousand variables, which are then globally accessible. There are many more problems with this code.

    2. As much as I dislike the code, I'm actually finding more bugs in the unit testing program itself than in the code. We are using VectorCast for testing. I don't know what it does to deserve its price tag, but I'm not enjoying VectorCast. Its GUI feels clunky, it has 7 different spots for error messages and yet none of those tell me in which line or at least which function that segmentation fault occured. I can't find a way to debug other than slapping print statements on everything. VectorCasts documentation is worthless and the only way to get help is through their customer service. Maybe I wouldn't feel as bad about VectorCast if I had a colleague or anyone else to help me get into it, but I'm alone with this.

    Everytime I try to write a test, I just get pissed at the code or the testing program. I keep getting distracted by this. I find myself trying to manage the explosion of code complexity by stubbing every function, but then I'm not testing the unit as a whole, I'm testing each function individually. What can I do?

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

    Backend architecture pricing

    Posted: 15 Mar 2021 06:05 PM PDT

    I am developing a mobile application where each user is expected to posts 2 photos each day. I assume, and correct me if I'm wrong, that storing each image at about 150kb is enough to provide a good quality jpeg.
    Besides posting images, users can also view other images posted (think Instagram), and I expect an average user to view about 50 images each day.

    Now let's do some math, assuming the number of active users (I won't go into details how I got these numbers but I'll add them to provide context):
    first 6 months: an average of 3100 active users

    • stored data: 3100 users * 2 images * 150kb * 30 days * 6 month = 167,4 GB stored
    • outbound data transfer: 3100 users * 50 images * 150kb * 30 days * 6 months = 4.18 TB transferred.

    months 7-12: an average of 27500 active users

    • stored data: ~1.5 TB stored
    • outbound data transferred: ~37 TB

    The problem is that I have to store more and more data as time passes, and that can become very costly, so I have two problems.

    1. No matter if the product is freemium (preferred) or paid, I have to pay more and more on storage as time passes if I don't delete it frequently, without users increasing the revenue, as they contribute with the same amount. Is there any way to overcome this problem without deleting old photos after 3-6 months for example? As you can see, the stored data can get quite large, and that's only for the first year.
    2. I have done some research on where to store all this data, and I have a couple of options, but I'm open to others. AWS S3, Google Cloud or Firebase, DigitalOcean.
      For Firebase / GCloud and AWS S3 the fees are very high for the outbound data transferred, and also quite high for the stored data, but they offer many helpful services (especially Firebase and Firestore). DigitalOcean seems to offer a better price with their "Spaces" product, because you don't have to pay for the outbound transfer, but I will have to develop all the services by myself, and they only offer the infrastructure.

    How would you approach these problems? Any other advice is appreciated.

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

    Need help with a project

    Posted: 15 Mar 2021 08:00 PM PDT

    So I am in an intro to programming course and for my project, I have to make a simple math quiz using random numbers, is my pseudocode correct?

    //This program will give a simple math quiz by generating 2 random numbers and asking the user to answer the question

    //Declare variables

    Declare Integer num1

    Declare Integer num2

    Declare Integer answer

    //Initialize variables

    Set num1 = random(1, 200)

    Set num2 = random(1, 200)

    //Code for the quiz

    Display "Here is the quiz"

    Display num1

    Display "+", num2

    Input answer

    If answer == (num1 + num2) Then

    Display "Congratulations, you are correct!" 

    Else

    Display "Sorry, the correct answer is ", num1 + num2 

    End If

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

    Translating an "IF" C++ statement to MIPS

    Posted: 15 Mar 2021 05:45 PM PDT

    my question is when i try to asssmble this i still get 10 stored into $t1 even though the "ble" is false?

     .text .globl main main: li $t0, 2 li $t1, 1 ble $t0, $t1, assign nop nop j end end: nop assign: li $s1, 10 
    submitted by /u/WeinerlessHotdog
    [link] [comments]

    Is Tracking line/wait times in public areas possible?

    Posted: 15 Mar 2021 05:01 PM PDT

    Hi there, I have been thinking about ways to track line times in a public place such as a shopping center(all the lines from quarantine have made me think about this) and while I am not sure it is entirely possible without the help from the place itself, this is what I have thought about and I am wondering if anyone else has some insight!

    Originally I thought about asking the user to allow tracking of there location when they open the app and then you could estimate wait times based on how many phones are in the area, similar to how apple maps sees traffic. But I soon realized that most places are very close to each other and that even with the best connection possible(which is not realistic for everyone to have 5 bars), I am not sure you could pinpoint people to such a specific spot and know if they are at place A or place B that is next-door 20 yards away.

    My next thought which does not seem too promising either, would be tracking users all the time, and waiting for users to be an area for more than a few minutes(to exclude people driving/walking by) and pinging them asking if they are at place x and how long the wait would be.

    Does anyone have any insight as to how you could make this possible or any good information on programming and geo tracking on androids/iphones? Thank you!

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

    An architect creates and envisions a new building, but the constructor looks to it that all parts fit together and the building will hold. Who, in your opinion, has the 'constructor' role in large cross-platform IT projects?

    Posted: 15 Mar 2021 01:33 PM PDT

    A large system is more than single point software only. It consist of code, scripts environment, configuration methods, maintenance methods. How do you ensure this is done on all levels, on all platforms on the same way?

    Who is responsible for the overall integration detail issues in a large project? Like monitoring, not throwing all kinds of unnecessary warnings to the next subsystem. Like interfacing, having the same specs on all levels and throughout the the whole system so that information not gets distorted during its route through several subsystems. Having the same mindset in all systems and subsystems on developing practices. Having a system built on a mixture of software and on premise and on server configuration, how to ensure that on every spot the same methods are used.

    How do you ensure that interface descriptions are all on the same level and granularity, so that no information is lost?

    Who does the fine tuning between subsystems so no continuous unnecessary warnings are given to the next subsystem all the time?

    Software and system architects usually focus on the orchestration of systems and subsystems, and focus on interfacing everything nicely together. But as far as I see it, that is not enough to ensure the final system will run smooth and maintainable when finished.

    What am I missing here?

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

    How old is the oldest line of code you personally encountered in a project? What kind of code was it and why was it left there?

    Posted: 15 Mar 2021 10:20 AM PDT

    (Embedded foreign Frameworks do not count, just the code that actually was written for/by the company)

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

    Need help on program that uses facebook/instagram info

    Posted: 15 Mar 2021 01:33 PM PDT

    A client wants to have information about public instagram/facebook profiles (photos/videos published, total likes/comments) from a period of time. How do I go about doing this?

    I found out that some of that information is available in the website source code, but how do I use that information? Also is there any sites/services that does that already? The only ones I found only go as back as a few weeks, or only process future posts. I want to process the information and put it in a excel file.

    I'm new in programming, so any help is aprecciated.

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

    What should a physics major turned software engineer focus on learning?

    Posted: 15 Mar 2021 01:24 PM PDT

    Hello! I started a job in January in platform engineering, this is my first job after graduating.

    The graduate scheme, has almost zero training - I mean not even a pluralsight subscription, let alone structured rotations. It's like "we need X done, go away and learn Y and Z to get it done". I often find that I am completely out of my depth and not learning very much. I'm concerned that I will come to the end of my grad scheme having learned very little and that this will harm my job prospects when the scheme ends.

    To this end, I would like to ask your advice on what to study. Should I learn pure CS (for example teachyourselfcs.com) or should I focus on practical work like building projects? Which do employers value more? Does it vary with the company, for example, do FAANG companies expect deep CS knowledge or do they value personal projects more? What do you think is a good balance?

    Thanks :)

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

    Help me google for this kind of C++ inheritance/polymorphism

    Posted: 15 Mar 2021 12:37 PM PDT

    I am quite new to this aspect of C++, and I generally lack the right vocabulary to google for the answer. Asking here because this would probably get torn apart on StackOverflow.

    I would like to create a class that has different behaviour depending on a parameter that is supplied when the object is created, but externally it looks the same to other parts of the code. All external functionality is common, defined by the parent Widget class. A very simple code sketch is included below.

    class Widget(){

    `public:` `Widget(int ver);` `virtual void Describe() = 0;` 

    }

    class WidgetVer1::Widget(){

    `void Describe();` 

    };

    class WidgetVer2::Widget(){

    `void Describe();` 

    };

    void Widget::Widget(int ver){

    `if (ver==1)` `// Become a WidgetVer1 somehow?` `else:` `// Become a WidgetVer2 somehow?` 

    }

    void WidgetVer1::Describe(){

    `cout << "Old version!" << endl;` 

    }

    void WidgetVer2::Describe(){

    `cout << "New version!" << endl;` 

    }

    void main(){

    `Widget w1(1); // The ver parameters might come from user input, hidden in a file etc so we don't know what they will be until run time.` `Widget w2(2);` `w1->Describe(); // Should print "Old version!"` `w2->Describe(); // Should print "New version!"` 

    }

    I can think of a few inelegant ways to achieve this but I am looking for the most natural way where the object type gets set when the object is created and then never needs to be checked again. There might be several version numbers and many methods similar to Describe().

    Thanks in advance!

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

    What does an iOS developer need to do?

    Posted: 15 Mar 2021 04:06 AM PDT

    Assuming someone started with little or no programming experience and wanted to learn iOS development, what should that person know how to do to get a starting job as a developer? What basic skills are needed?

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

    Trying to figure out how to automate filling offline forms using data from an open browser window. I don't even know enough to know if this is feasible. I'm literally ignorant.

    Posted: 15 Mar 2021 11:29 AM PDT

    Here's the situation.

    I work with a company that uses a web-based software for customer management. It has records for each customer, sales order, etc. Users can pull up a customer/order/etc. record in a browser window, Chrome recommended.

    Company also uses a bunch of internally-generated forms.

    The internal forms usually need to have some data entered - customer name, address, etc.

    I think there has to be a way to get the info from the browser window into the form fields without the user doing it by hand, but, as previously mentioned, I have absolutely no idea how that would work. I do know that there's either no API access or it's very difficult to set up (not clear which, just that it's not really an option).

    The customer and order records are always going to be formatted the same. I believe that the relevant data will always show up in the same field, same formatting, etc. - it's just populating with the relevant DB entry on their back end.

    Ideally, I'd like to have a chrome extension where company users could open a customer record in a chrome window, select the correct internal form from a drop-down list from the extension, and have it create the form from a template with the relevant customer info (name, address, customer ID, etc) inserted.

    Most of the forms are maintained as PDFs at present if that's relevant - they don't have to be, that's just what worked best so far.

    I have literally no idea if something like that is possible, if it's been done before, or how hard it would be to make. I'll again bring your attention to the fact that I'm a complete moron in this arena. I know it would be a nice thing to have, I just don't anything helpful about actually getting it.

    Thanks in advance for any help.

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

    Design my batch script?

    Posted: 15 Mar 2021 10:34 AM PDT

    I have a limited understanding of programming structures.

    Can i ask someone to design it for me? It's simple, but I'm too airheaded to try to understand how to write it.

    It will be run at startup through Task Scheduler. I have already figured out the triggers (event IDs).

    What I request:

    The script asks a question "Do you want to cancel this process?". It sets a timer for 5 minutes. Within the 5 minutes, if I do not type 'Y' and press enter, it will run this code "powercfg /s a1841308-3541-4fab-bc81-f71556f20b4a". If I enter 'Y', it exists without running the aforementioned code.

    Thanks IF anyone can help, ELSE sorry for posting in the wrong sub. End IF.

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

    need suggestions on how to share secret key for AES encrypted SMS android app

    Posted: 15 Mar 2021 09:36 AM PDT

    I am currently working on my final year project for university and I'm making an android app that can send and read SMS messages that have been encrypted using AES but I've run into a problem in sharing the key. Most of the implementations i have seen have used firebase to store the key but since I'm using SMS i want the app to have no reliance on the internet at all. in my application each user can make accounts which are stored in a SQLite database so i was thinking of using the primary key for the users account and the saved ID for the receiver and appending them together to make the key but i feel like theirs better ways of doing this. any suggestions on how to do this or do you think i should use a different algorithm?

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

    build a custom reader app

    Posted: 15 Mar 2021 05:23 AM PDT

    I am slowly trying to build a custom reader app, but I wonder if anybody out there has already built something similar. It's basically just an e-reader, like an EPUB reader, but it displays one unit of
    information at a time - the user can select paragraphs, sentences or even words. So, as you scroll back and forth, like in an e-book reader app, it goes through the text, but not by fitting text that breaks
    mid-sentence at the boundary of the screen - instead, it displays one complete paragraph, sentence, or word at a time. It should also have powerful features like multi-color text highlighting and the ability to add in comments, which are in some way exportable, say as a text file, where each comment is next to the excerpt it's commenting on. Like any reader app, it should remember the location in the text you were at when you stopped reading. I am trying to build this myself, but I have to wonder if anybody out there has already built it.

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

    How long does it take to set up docker containers usually? (ballpark figure/approximate range)

    Posted: 15 Mar 2021 08:34 AM PDT

    We're working on an app that allows to set up dev environments within docker containers in less than 10 minutes and we'd like to compare with the manual setup process/alternative solutions.

    How long does it usually take you to setup a project before you get started on a project if you're starting from scratch?

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

    Java for algorithmic trading in Futures/FX by API, what framework, and what setup shall I choose for best of the best performance? Please help?

    Posted: 15 Mar 2021 04:17 AM PDT

    Note:

    -I'm looking for the achieving best of the best performance or code execution?

    -Best of the best JDK for developing an application for algorithmic trading in Java by API.

    -Best of the best JRE for executing the developed code of the algorithmic trading in Java.

    -Best of the best Java framework for developing the most professional and clean code that does not lag and has the best memory management in real-time computing on Futures/FX markets.

    Hiya,

    I'm looking for the implementation of the trading idea for Futures/FX in Java with API. As there are many Java frameworks, J2SE Java Spring, JavaFX, etc I'm confused on how shall I progress for implementation of the best of the best performance for the algorithmic trading idea. What JDK shall I use for development and what JRE shall I use for the runtime of the application of trading in Futures/FX in Java.

    There are many books and websites about Java, but I don't know which one specifically designed for algorithmic trading by Java and will if they are any useful? I need advice, please?

    In the end, I only want to implement my trading idea into Java code that reaches the best of the best performance and I'm confused between the J2SE Java Spring framework shall I choose or JavaFX or something else?

    Tnx and best of luck

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

    Why reverse nibble

    Posted: 15 Mar 2021 07:04 AM PDT

    So I've been learning about reverse nibbling (for phone numbers etc... In feature phones) and I wondered why? I don't see the reason for it and everything I found online skips over the reason why.

    Could someone please explain this to me?

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

    C++ vs Python. Plz read desc.

    Posted: 15 Mar 2021 03:42 AM PDT

    Hello. I have been learning C++ for some time and don't know if I should continue or start learning Python. :)

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

    Why does it print all at once?!

    Posted: 15 Mar 2021 01:57 AM PDT

    Hey guys, I'm wanting to make a function in C++ which would output a sentence say "I am losing my mind right now" but instead of displaying it all at once, it would display 5 characters each second until the end. In other words this behaviour sorts of behaviour:

    t = 1: I amt = 2: I am losi...t = 10: I am losing my mind right now

    After some thinking I came up with this code snippet that I believe should work but doesn't and I would like to know why. What is wrong with my logic? Is sleep_for() not applicable in for-loops? That is my main suspect currently but I highly doubt that's why.

    void printThis(string text){ int x = 5; // I want to split it for every 5 char int length = text.size(); // max length of string // prints a line in sequentially each second for(int i = 0; i < length; i++){ if((i % x != 0 or i == 0)){ cout<<text[i]; } else{ sleep_for(seconds(1)); // it will suspend for 1 second every 5 chars // because it's divisible by x=5 chars cout<<text[i]; } } // running printThis("This is a longer string") results // in the program hanging for few seconds then finally // outputting the full string all at once 

    I'd appreciate any help/feedback on this. I understand how pointless this may be but it's sort of a novel idea for another project of mine. Thanks in advance.

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

    Software licensing scheme: transferable node lock?

    Posted: 15 Mar 2021 12:18 AM PDT

    So, node-locked software licensing with HW ID is pretty common (info in license file tied to mac address...which is validated when the software is run, for example). But some companies offer the ability to transfer licenses between machines. I don't understand how that is enforced, though.

    Is there a way to ensure only 1 machine is activated at a time, without the constant need to phone home to a license server? How do I prevent users from having two simultaneously activated machines?

    Imagine this naive approach:

    User activates machine A, but then wants to transfer license to machine B. So he loads up a de-activation tool on machine A and the tool deletes their license file and reports to a server that the file is deleted. Then the user goes to machine B to activate, and the server reports that the other machine was deactivated and thus the transfer can continue.

    But what is stopping the user from simply manually reverting the deleted license file on machine A after activating on machine B?

    How can I ensure a license transfer is complete and irreversible, without requiring constant phoning home to ensure the user didn't revert license changes on either machine?

    I was thinking about maybe hashing the license file's creation/modification date in the registry editor or something, so that if the file is reverted the hash won't match...but that means that if the user ever bumps the file their license will be invalidated. Seems pretty extreme.

    Any other ways to ensure that a deleted/deactivated license file on a particular computer remains that way, without phoning home?

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

    No comments:

    Post a Comment