• Breaking News

    Monday, December 21, 2020

    For anybody on an M1 Mac - what are you doing about package managers? Ask Programming

    For anybody on an M1 Mac - what are you doing about package managers? Ask Programming


    For anybody on an M1 Mac - what are you doing about package managers?

    Posted: 21 Dec 2020 08:18 AM PST

    So I know that macports is supported on M1, and brew isn't yet, but you can use it through Rosetta 2. But how does that actually work? Like if I install a package through brew/Rosetta, will the x86 version be installed, or can I install the ARM native version?

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

    What's the best career decision you've ever made and why?

    Posted: 21 Dec 2020 01:28 PM PST

    Just started studying programming, asking for advice

    Posted: 21 Dec 2020 09:42 AM PST

    I started a course of basic programming (html, cs, js and that sort of stuff) in late November and once done I'll get into similar stuff related to web programming and such.

    I take notes and write pretty much everything down, then I practice.

    My biggest fear is not remembering the code and rules of programming. Do you guys have any advice for studying? Anything at all.

    Thanks in advance.

    EDIT: Thank you all for all the answers! I really appreciate it.

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

    Cheapest Deployment Options

    Posted: 21 Dec 2020 11:52 AM PST

    Hi, What are the cheapest deployment options for full stack web applications.

    The stack I have experience with is Python Flask with SQLAlchemy for the backend and bootstrap and jinja2 for the frontend

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

    Making a game desktop operating system for better performance.

    Posted: 21 Dec 2020 02:59 PM PST

    First of all, this is an hypothetical. It would require way too much time to make. Here is a general idea of the system I am talking about: You startup in the game menu when you boot, only the necessary services are loaded. There is no network functionality. It is completely offline. No security options. It is a strategy game and mostly limited by the cpu. The operating system is the bare minimum to make the game work.

    I assume having to check and load less things unrelated to the game would make it faster.

    How do you think the game would benefit from this over using gentoo linux and disabling networking? I am interested about the fps, load times, stuttering and stability of the game.

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

    How do I find elements with an exact class using selenium?

    Posted: 21 Dec 2020 06:24 PM PST

    On a web page, there are 31 buttons (each for every day of the month) and the buttons that are clickable have the class "v-btn v-btn--active v-btn--floating theme--light" and the buttons that are not clickable have the class "v-btn v-btn--active v-btn--floating v-btn--disabled theme--light"

    I want selenium to find the clickable buttons, but I don't know how to do that since it doesn't have a class name that the non-clickable buttons don't have. Is there a way I can target an element with an exact class?

    I'm new to selenium so pardon me if this is a noob question haha.

    Here's a picture: https://ibb.co/rbDDqsn

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

    How to come up with project ideas relevant to my coursework?

    Posted: 21 Dec 2020 09:38 PM PST

    I'm a junior in university right now, and I try to brainstorm project ideas sometimes, and now that it's winter break I think I'm gonna take one on. But I'm struggling to think of anything that will actually make use of my coursework. For example, I'll come up with ideas for discord bots that allow users to get info for websites, but stuff like this doesn't seem at all related to what I'm learning about algorithms and computer systems.

    Any advice on how to come up with projects that will actually make use of what I'm learning?

    submitted by /u/5H1TP05T
    [link] [comments]

    Linking.

    Posted: 21 Dec 2020 09:14 PM PST

    I created a program to work with files, then compiled it and got an exe file, but its does not know where to get the file, how to link manually? Or how to deal with it?

    How to create such a program so that you can "open with *myprogramm*" in Windows?

    Can Main arguments be used?

    main(std::string FileName) {} 

    I use C++ and VS2019

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

    C# ASP.NET MVC Project for portfolio: Is it better to use Entity Framework, or to write one's own stored procedures?

    Posted: 21 Dec 2020 05:08 PM PST

    Forgive me if that's a silly question - I'm finally building a larger app for a portfolio, and trying to figure out how best to go about this project.

    It will be a CRUD application in C#, I need to use MVC and SQL Server, but I admit I have limited experience with Entity Framework, and I suppose I'm wondering why someone would use that over stored procedures. Less versatile? If I go with stored procedures, will I be unable to include them in a GitHub repo?

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

    C++ programming question, reading data from a file

    Posted: 21 Dec 2020 07:18 PM PST

    I created an electric and labor cost calculator. I am having trouble getting the function that I created to read data from a csv file. The output is messy with negative numbers. I would like this to be the output. There is a function that saves information to a file and another the reads information from a file.

    Name:

    Job number:

    Materials:

    Amount:

    Total Cost:

    #include<iostream> #include <string> #include <fstream> #include <ostream> using namespace std; const int ROW = 25; const int COLS = 2; string custNames[COLS][ROW] = { "" }; // This is the array for my code. It will store the customers names of the jobs int job_count[25]; void menu(); // funtion for menu items int Current(int x, int y); //function prototype int Resistance(int x, int y); //function prototype for calculating the resistance int Voltage(int x, int y); void get_cust_data(void); void save_cust_data(string firstName[], string lastName[], double total_cost, double amount, int index); double voltage, current, resistance, amount, cost_of_materials, total_cost; string itemPicked; char materialPicked; int main() { //These are all the varieables and their types that will be used below. double voltage, current, resistance, amount, cost_of_materials, total_cost; string itemPicked; char materialPicked; char choice; int index = 0; while (true) { //this is the menue of items for chose from. menu(); cout << "Enter your letter choice: "; cin >> choice; if (choice == 'O' || choice == 'o') // This code does the Ohm's law calculation { std::cout << "Welcome to Olga's Electric and labor cost Calculator. \n\n"; std::cout << "Please pick what you would like to calculate (voltage, current, resistance): \n\n"; std::cin >> itemPicked; cout << endl; // This code does the Ohm's law calculation if (itemPicked == "voltage") { cout << "Enter Current value: "; std::cin >> current; if (current < 0) { cout << "Please enter a value greater then 0."; } std::cout << "Enter Resistance value: "; std::cin >> resistance; if (resistance < 0) { cout << "Please enter a value greater then 0."; } std::cout << "Voltage is " << Voltage(current, resistance) << std::endl; } else if (itemPicked == "resistance") { std::cout << "Enter Voltage value: "; std::cin >> voltage; if (voltage < 0) { cout << "Please enter a value greater then 0."; } std::cout << "Enter Resistance value: "; std::cin >> current; if (current < 0) { cout << "Please enter a value greater then 0."; } std::cout << "Resistance is " << Resistance(voltage, current) << endl; } else if (itemPicked == "current") { std::cout << "Enter Voltage value: "; std::cin >> voltage; if (voltage < 0) { cout << "Please enter a value greater then 0."; } std::cout << "Enter Resistance value: "; std::cin >> resistance; if (resistance < 0) { cout << "Please enter a value greater then 0."; } std::cout << "Current is " << Current(voltage, resistance) << endl; } else { std::cout << "Please pick from the following items. "; } } else if (choice == 'j' || choice == 'J') //Code for picking the materials. { cout << "Please pick the material for the job (c-copper, a - aluminum): "; cin >> materialPicked; if (materialPicked == 'c' || materialPicked == 'C') { cout << " Please enter the amount of material needed (feet): "; cin >> amount; cout << "Please enter the cost of material: "; cin >> cost_of_materials; total_cost = amount * cost_of_materials; // This is the calculation for total cost of the job. cout << "The cost for this job is $" << total_cost << endl; cout << "Enter the first name: "; cin >> custNames[0][index]; cout << "Enter the last name: "; cin >> custNames[1][index]; index++; save_cust_data(custNames[0], custNames[1], total_cost, amount, index); cout << endl; } else if (materialPicked == 'a' || materialPicked == 'A') { cout << " Please enter the amount of material needed (feet): "; cin >> amount; cout << "Please enter the cost of material: "; cin >> cost_of_materials; total_cost = amount * cost_of_materials; // This is the calculation for total cost of the job. cout << "The cost for this job is $" << total_cost << endl; cout << "Enter the first name: "; cin >> custNames[0][index]; cout << "Enter the last name: "; cin >> custNames[1][index]; index++; save_cust_data(custNames[0], custNames[1], total_cost, amount, index); cout << endl; } else { cout << " Invalid option picked, please pick form the options above."; } } else if (choice == 'C' || choice == 'c') { cout << "Here is the list of all customers." << endl; for (int i = 0; i < index; i++) { for (int j = 0; j < COLS; j++) { cout << custNames[i][j] << " "; } cout << endl; } } else if (choice == 'S' || choice == 's') { cout << endl; cout << " Customer name & Job info" << endl; cout << "----------------------------" << endl; get_cust_data(); } else if (choice == 'E' || choice == 'e') { cout << "Thank you for using my calculator." << endl; break; } } return 0; } // The follosing are function that preform Ohm's law calculations int Current(int x, int y) { return x / y; } int Resistance(int x, int y) { return x / y; } int Voltage(int x, int y) { return x * y; } void menu() // This are the options that the user can choose from { cout << "Pick an item:" << endl; cout << "O - Om Law" << endl; cout << "J - Job" << endl; cout << "C - Customer Names" << endl; cout << "S - Display Customer and Job information" << endl; cout << "E - Exit" << endl; } void save_cust_data(string firstName[], string lastName[], double total_cost, double amount, int index) { string materialName; int jobNo; ofstream output; //Open address file for output using ofstream() output.open("CustDataJobs.csv"); char answer = 'y'; for (int i = 0; i < index; i++) { cout << "Customer Name: " << firstName[i] << " " << lastName[i] << endl; cout << "Would you like to save the job information? (Y/N)"; cin >> answer; int jobCount = 1; while (answer == 'Y' || answer == 'y') { cout << "Please enter the job number: "; cin >> jobNo; cout << "Please enter the material type: "; cin >> materialName; output << firstName[i] << " " << lastName[i] << "," << jobNo << "," << materialName << " , " << total_cost << " , " << amount; cout << "Would you like to enter another job? (Y/N) "; cin >> answer; jobCount++; } job_count[i] = jobCount; cout << endl; } output.close(); } void get_cust_data() { string firstName[25], lastName[25], materialName; double total_cost, amount; int jobNo; ifstream input; //Open address file for input using ifstream() input.open("CustDataJobs.csv"); if (!input) { cout << "File is not found"; return; } int i = 0; while (!input.eof()) { getline(input, firstName[i], ','); getline(input, lastName[i], ','); cout << "Name: " << firstName[i] << " " << lastName[i] << " " << endl; int j = 0; for (int j = 0; j < job_count[i]; j++) { input >> jobNo; input.get(); getline(input, materialName, ','); input >> amount; input.get(); input >> total_cost; input.get(); cout << endl; cout << "JobNo: " << jobNo << endl; cout << "Type of material: " << materialName << endl; cout << "Amount of material: " << amount << endl; cout << "Total Cost:" << total_cost << endl; cout << endl; } break; } input.close(); } 
    submitted by /u/LadyOlgs2020
    [link] [comments]

    Is it possible to write a python code to assign a string to a key(like 1, 2, F3 or sth), then after one press, key back to default?

    Posted: 21 Dec 2020 06:50 PM PST

    that might be more convenient than the clipboard

    I actually need to assign new string into the key often, so it's more convenient to use python code

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

    HASH TABLE basic Question

    Posted: 21 Dec 2020 06:42 AM PST

    If I need to increment the size of my hash array what should I do with the elements inside my hash table?

    Should I rehash them to the new table with the new hash function?
    Or do I need to do something else?

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

    Advice best practice for working on multiple projects at once?

    Posted: 21 Dec 2020 11:24 AM PST

    Hey all! I'm a software engineering intern and I've been assigned two projects from different departments at the company I work for.

    One project is slightly smaller scale, and my second project was assigned by my boss' boss.

    How do you guys tackle multi-tasking? Should I complete one project in it's entirety, or should I break each project into smaller tasks and work on both simultaneously?

    EDIT: Title should be "Advice on", of course I messed that up.

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

    Question about Telegram API development

    Posted: 21 Dec 2020 02:32 PM PST

    I have a question about Telegram bot (or API) development. Scenario:

    User A have access to X Telegram groups (channels)

    User A uses a mobile app to redirect all messages from X groups to one Y group/channel. This mobile app are not reliable. it crashes and stop working for days.

    User B (myself) joined the Y group to read all messages from X groups.

    -

    Question: is there any way to develop a script (bots not allowed to enter X groups) to access User A account - with his consent of course - and read all X groups and forward all messages to to Y group? If possible, can you point me some article/etc?

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

    New project advice

    Posted: 21 Dec 2020 08:31 AM PST

    Hi,

    So I am new to programming and wanted to ask you all how do I start this project?

    So basically what I am trying to make is a digital pilot logbook.

    • A page to input data about the flight. Couple of fields, no biggie.
    • Something to export the flights in a pre defined format in PDF. A table basically made from the data which was put in and a database is built.
    • A google map connecting lines of all the airports connected. Basically shows all the routes flown.

    That's kind of the overview. Other than that, basically have monthly totals, and different totals and stuff like that.

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

    How does AWS S3 behind the scenes?

    Posted: 21 Dec 2020 02:21 PM PST

    I know systems like hdfs store big amounts of data redundantly by splitting up files across multiple nodes and having multiple copies of each shard. There is also a master that monitors the nodes, and replicates the data when one node is detected down. Since hdfs is open source, there is documentation on how it exactly works. Does anyone know how Amazons S3 service work. Does it use similar concepts and what does it do differently. Or is it a secret, even the broad concept? I couldn't find any documentation.

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

    'Zero divide' error in MQL4 - This error is challenging

    Posted: 21 Dec 2020 06:23 AM PST

    Hello, I am coming here from the AlgoTrading subreddit. I am using MQL4 in the MT4 platform. This language is a C-type language, as I understand it. For the past week, I've been trying to solve a 'zero divide' error in my code. I have scoured the internet and tried to fix it the ways I know how, and nothing has fixed this error so far. This error is happening in the Strategy Tester.

    The error from the terminal reads, specifically, "zero divide in 'AdvancedLibrary.mq4' (26, 52)" and the next line reads, "Testing pass stopped due to critical error in the EA."

    21 double UNITSneededForSL = 500; 22 // = balanceUSD1percent_UNITS * stopLossPips; 23 double USDCADexchangeRate = 1.28; 24 // = (USDCADask + USDCADbid) / 2; 25 26 double CADunitsNeededForSL = UNITSneededForSL / USDCADexchangeRate; 27 // = 500 / 1.28 ; 28 // 500/1.28 = 390.635 

    I commented out the original code, though I left it in case it could help find the issue. I switched this MQL4 code into C++ code with print statements for each variable; each of the variables were initialized correctly and the output worked fine without a zero divide error.

    Thank you in advance for taking your time to see my post.

    I checked the rules for this subreddit and I did not see any rules against posting code. My apologies and please feel free to remove this post if it is not permitted here.

    submitted by /u/2_stepsahead
    [link] [comments]

    Java Inheritance Questions

    Posted: 21 Dec 2020 10:50 AM PST

    Can someone tell me what I need to do to fix this and what's going on? Hard to find answers on the internet because i'm honestly not sure what to even search. I just want to know the "Best Practices" guideline on how to do something like this in Java.

    abstract class Pet { String type = "Not a real pet"; public void printType() { System.out.println(type); } } class Dog extends Pet { String type = "Dog"; } class Cat extends Pet { String type = "Cat"; } class TypeOfPet { public static void main(String[] args) { //Pet pet = new Pet(); Dog dog = new Dog(); Cat cat = new Cat(); //System.out.println("Should say Not a real pet:" + pet.type); System.out.println("Should say:" + dog.type); dog.printType(); System.out.println("Should say:" + cat.type); cat.printType(); } } 

    Result printed to screen-
    Should say:Dog
    Not a real pet
    Should say:Cat
    Not a real pet

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

    [JavaFX] Passing input value to a constructor

    Posted: 21 Dec 2020 06:55 AM PST

    I'm currently working on a hobby project and i have a constructor that takes these parameters: public void ironToLevel(double currentLevel, double goalLevel)

    and a GUI that looks like this: https://gyazo.com/71396524378ce76ae3becb766dc5f0e3

    I want to be able to take the input from the user that is typed into these two text fields and set the first text field as the first parameter in the constructor (currentLevel) and the second text field as the second parameter in the constructor (goalLevel).

    And when you click the button "Calculate" the constructor runs and prints out the result as a normal constructor would.

    I can't seem to find a solution for this. How would i go about doing this?

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

    Flutter install failing with INSTALL_PARSE_FAILED_NO_CERTIFICATES

    Posted: 21 Dec 2020 10:06 AM PST

    All of a sudden, when I try to install my apk I get this error. Its like the build is not signing the apk with my debug.keystore.

    Nothing has really changed, and I have been building and installing on my emulator and physical android device without problems for a long time. Now, it is complaining all of a sudden.

    I am building and install with..

    flutter build apk --debug flutter install apk 

    Anyone seen this before?

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

    [C#] How to repaint certain part of panel / or use two panel on top of each other with the top one having transparent background?

    Posted: 21 Dec 2020 03:55 AM PST

    I have a C# WinForms project where I have to paint some things on my panel. I load in a grid from a file that translates to squares that are painted on the panel. Then I load in a file with dots that are then painted on top of the squares.

    I then have a function that moves the dots around. But the repaint function is called every tick which causes the whole grid to flicker continously because it is painted so quick after each other. How do I make it so that only the dots are repainted?

    The repaint function is as follows: panel.invalidate();

    I also tried to use a second panel for the dots so I only have to repaint that one. But I cant get a transparent background working on the second panel, so the first panel is not visible this way.

    Somebody knows a good solution for this problem?

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

    Android Studio Help needed

    Posted: 21 Dec 2020 08:44 AM PST

    Hey guys let's get to the point so i downloaded Android Studio today opened it without internet connection and Whenever i try to open a new project it says"SDK is missing,erased" or something like that can anyone tell me a quick fix to how to install "SDK" I'm new to this and i dont know much about this plz tell me so that i can open and create a new project.Help!!!! Any help is appreciated. Peace. ☮️

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

    Are there any good markDown editors?

    Posted: 20 Dec 2020 11:24 PM PST

    Are there are good markdown editors that allow you to edit the markdown itself and not just the source code. I really like the reddit's markdown editor which appears when you submit a post. It's the best I've found but I can't take it out of reddit.

    Are there any other good standalone application like that?

    Requirements:

    • I should be able to edit the markdown version and not just the source code
    • It should have all the available tools in a toolbar like reddit's editor or evernote
    • Preferably I should be able to see both source code and final version side by side

    Please let me know if you know any such editor.

    Sublime extension, VSCode extension, standalone application, web app, anything that satisfies the above requirements

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

    No comments:

    Post a Comment