Should an if-else go in the main or method? Ask Programming |
- Should an if-else go in the main or method?
- Met up with an old buddy, he's working on "self correcting software" (his words). I know nothing of this specialization. Is there any relevant software or hardware that I can get him as a gift? He likely does not want books/courses.
- How do you do things like reserve objects if you're using a nosql db like Cassandra? If 3 Uber drivers click accept on a single ride at once, how do you handle the race condition?
- App design: how to best trigger a GUI window
- How to calculate a string expression with only 1 operand?
- Super super basic JavaScript. Although I'm stupid enough to not understand it.
- My team is building a boring, pedestrian business web application. What resources do you have for improving ease of interaction, good looking but still functional design layout, and anything else that makes a site easier to use for employees but also looking more modern?
- My company is giving us a hack day to build whatever we want, but what we produce has to have some sort of benefit to the company. What are some ideas that my team can produce?
- Hey front end developers!! What are some design practices you use very often?
- Header function declarations local to file
- Express.js - Cross-Origin Request Blocked
- Help me get started on working on a project!
- Need Some Advice on Structuring AI
- Computer Science Prof. says we have to use netbeans, can he tell if I use Eclipse?
- How to create an HTML form that allows MS word type of formatting?
- How do I prevent create-react-app's `npm start` from deleting the `paths` property from tsconfig.json?
- What's a good intermediate level C++ book?
- How to structure code that contains slightly different logic for different customers?
- I don't know if this is the right place
- Help creating “simple” executable
- C# - windows cannot find command
- Looking for a stock market API
- Looking for feedback on how developer resources could be improved!
- Pre-increment and Post-increment in C
Should an if-else go in the main or method? Posted: 29 Aug 2019 05:58 PM PDT Basically should it be this: or this: I imagine it would be a bit circumstantial but I feel like I need some consistency in this regard. Note: this code is generic. I'm not looking for a solution for this exact code. [link] [comments] |
Posted: 29 Aug 2019 02:08 PM PDT |
Posted: 29 Aug 2019 04:12 PM PDT I can think of a few solutions, but I'm not happy about any of them. You could have a single app server that is the only one used for a given ride, but that complicates load balancing and you have to handle what happens if the server goes down. I'd rather somehow just handle it entirely in the db. One idea is to insert a record reserving the ride for each driver. Then you wait some period of time and query for all records applying to this ride. Then, the record with the earliest creation date or lowest uuid would win and the others would report failure to reserve the object. But is that guaranteed to work? How can you pick a time period that's sure to work? If this is a terrible idea, what is a correct approach? [link] [comments] |
App design: how to best trigger a GUI window Posted: 29 Aug 2019 07:36 PM PDT I want to write a reminder app that launches at startup automatically. Now the users should be able to launch an application window and add reminders in the app. What can I do to listen for users trying to launch the app by themselves considering the app is already running on the background? Platform is POSIX/Freedesktop and toolkit is GTK if that's relevant. [link] [comments] |
How to calculate a string expression with only 1 operand? Posted: 29 Aug 2019 11:03 PM PDT OPERATOR*** For example the user enters string "451+234","2*3". There can be only 1 operator in the expression. When I searched for help elsewhere I saw using sstream can be helpful but I've never used it before. I feel like the question is simple but the answer is very complex for a beginner programmer. [link] [comments] |
Super super basic JavaScript. Although I'm stupid enough to not understand it. Posted: 29 Aug 2019 06:02 PM PDT <!DOCTYPE html> It is supposed to say What can Javascript do? and then underneath it would have a button. The button would say "Javascript can change HTML content." When you click the button, it would say, "Hello JavaScript" I have no idea why it isn't working, honestly I'm trying to learn but its extremely difficult. Hopefully someone can help me out here. Thanks :) [link] [comments] |
Posted: 29 Aug 2019 09:32 PM PDT |
Posted: 29 Aug 2019 08:05 AM PDT |
Hey front end developers!! What are some design practices you use very often? Posted: 28 Aug 2019 11:29 PM PDT |
Header function declarations local to file Posted: 29 Aug 2019 07:17 AM PDT In C++ (14) I have a header file that defines some *templated* functions. Since they are templated, they must be in the header, not a .cpp. However, these templated functions are not meant to be externally visible - they are only used by the functions in the header that are intended to be visible externally (i.e., from other source files that include the header). Is there a way to declare that some of these functions defined in the header should be "as if they were in the .cpp file", i.e., not visible to other files that include the header? Note: My header is not a class or struct - it just contains function prototypes. I'm also not using a namespace right now. I know I can fix it using namespaces, but I'm curious if I'm missing some keyword like "local". [link] [comments] |
Express.js - Cross-Origin Request Blocked Posted: 29 Aug 2019 01:17 PM PDT I have a Node.js server running on localhost port However, when I click on the Google+ button, I have a CORS blocked error which tells me that I have a missing CORS even though I have enabled cors in my server code. I've tried changing parameters to
I've also tried adding I also get a HTTP Node.js file: ``` const express = require('express'); const bodyParser = require('body-parser'); const cors = require('cors'); const passport = require('passport'); const app = express(); app.use(cors()); // Routes app.use('/user', users); // Passport strategy passport.use(new GoogleStrategy({ clientID: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET, callbackURL: '/user/google/redirect' }, function(accessToken, refreshToken, profile, done) { User.findOrCreate({ googleId: profile.id }, function (err, user) { return done(err, user); }); })); // Server start app.listen(3000, (req, res) => { console.log( Router: ``` // auth with google+ router.get('/google', passport.authenticate('google', { scope: ['https://www.googleapis.com/auth/plus.login'] } )); // callback route for google to redirect to router.get('/google/redirect', passport.authenticate('google', { failureRedirect: '/login' }), function(req, res) { res.send('Done!'); }); ``` Vue.js file: ``` <template> <v-card class="elevation-12" v-on:submit.prevent="login"> <mdb-btn align-center justify-center class="btn-gplus" icon="google-plus-g" fab v-on:click="authGoogle()">Google +</mdb-btn> </v-card> </template> <script> import axios from 'axios'; import router from '../router/router'; import { mdbBtn } from 'mdbvue'; const { URL } = require('../config'); export default { name: 'Login', methods: { authGoogle () { axios.get( When I enter [link] [comments] |
Help me get started on working on a project! Posted: 29 Aug 2019 10:52 AM PDT So now that I have a couple years of coding experience, and pretty comfortable with C and Python, I want to start a project but there's so many things running through my mind on how to start one that I need advice. 1) Would it be easier to make a website or an app? And in both scenarios, do employers find it even impressive at all if you say you just coded a personal website or app without making it public? 2) If I choose to make an android app, what do I need to do? What language do I need to know? What programs do I need to download? Can I just code in VSCode like I've been using to practice python? 3) Same questions as #2 but for websites. 4) Any other tips appreciated. Anything I'm skipping over before starting a project? Do I need to post my stuff on Github? (Or git...??? Idk the difference). Thanks!! [link] [comments] |
Need Some Advice on Structuring AI Posted: 29 Aug 2019 12:42 PM PDT I'm working on an AI that uses a State Machine to switch between states (Attack, Defend, Move, etc) there is also multiple types of different AI that all share the same state machine, and I want them to act differently. So my question is how can I make the states unique without adding the same code to all the AI in the game? Any help with this is truly appreciated, because I'm stumped :/ [link] [comments] |
Computer Science Prof. says we have to use netbeans, can he tell if I use Eclipse? Posted: 29 Aug 2019 10:41 AM PDT I was wondering if its possible to use eclipse without him knowing when i turn in my assignments, or is there something in the file that somehow shows what I've used? [link] [comments] |
How to create an HTML form that allows MS word type of formatting? Posted: 29 Aug 2019 10:31 AM PDT I am making a form for an app I am creating. So far it is just a simple text box that allows the user to type stuff and submit. But, I want the user to be able to format their text with bullet points, bolding, and pretty much like most of the options they'd have when typing in MS word in Google docs. Any ideas on how I can go about this? Is there a bootstrap library for this or any JS libraries? [link] [comments] |
Posted: 29 Aug 2019 12:52 PM PDT Every time I add [link] [comments] |
What's a good intermediate level C++ book? Posted: 29 Aug 2019 12:35 PM PDT |
How to structure code that contains slightly different logic for different customers? Posted: 29 Aug 2019 12:26 PM PDT My current approach is to encapsulate different logic into different methods(or classes) and use feature flags to enable/disable them for different customers. It gets messy when you get more customers and more customizaions are needed. A bunch of if and switch statements everywhere. What's the best practice to handle it? Thanks! ( I mostly write Python and Java code) [link] [comments] |
I don't know if this is the right place Posted: 29 Aug 2019 12:10 PM PDT Sorry if this isn't the right place, but i'm starting a new project for my uni, I need to accomplish a few things and I'm trying to figure out what the best languages would be for this.
Thanks for any advise in advances [link] [comments] |
Help creating “simple” executable Posted: 29 Aug 2019 09:21 AM PDT Hey AskProgramming, how should I go about creating a simple executable (thinking notepad) to search within a limited criteria (akin to "K:\Programs\DesiredSearchableFolders") and create a shortcut to the relevant files. If for example folder "Test1" contains a text file "project1timeline.txt", and folder "Test2" contains text file "project2timeline.txt", I want to create a shortcut link for each individual "timeline" file, such that in my folder "timelines" I would have a shortcut to each seperate text file. Google searches of available commands for notepad havent yielded commands capable of creating shortcut files... can you guys help me with this? [link] [comments] |
C# - windows cannot find command Posted: 29 Aug 2019 09:13 AM PDT I'm using system.diagnostics.process.start to call cmd and run and LPR command (LPR port monitor is enabled on my machine) but my app throws up a command window with an error saying: The call i'm using for this in my app is: Can anyone tell me what i'm doing wrong? [link] [comments] |
Looking for a stock market API Posted: 29 Aug 2019 08:50 AM PDT Hi! My brother is a statistician that doesn't know how to program, and I am a hobbyist programmer who knows nothing about the stock market. He asked me if I could help him automate plotting stock market data and so I'm trying to oblige him. I first tried with Alpha Vantage, which has a python library, seems easy enough and they claim "Global coverage" which I assumed meant you can request data about any stock globally, but that doesn't seem to be the case since I get errors when requesting stocks on the nordic market. I mailed the support about this but they haven't responded. So I've been searching other APIs that allows this but reading up on them only confuses me when I can't understand any finance lingo they use. So now I'm turning over to you guys, wondering if anyone of you can recommend an API able to work on these criteria:
Bonus if there's support for:
No requirement on price, but naturally the cheaper, the better. Any advice would be much appreciated. [link] [comments] |
Looking for feedback on how developer resources could be improved! Posted: 29 Aug 2019 07:56 AM PDT Offering $10 for filling out a 5 minute survey below! https://docs.google.com/forms/d/e/1FAIpQLScv8qle1HfzX8VAm7AE3BXFiDiOWMD1Z-B5y-w8XKX5zT_ehA/viewform [link] [comments] |
Pre-increment and Post-increment in C Posted: 29 Aug 2019 05:13 AM PDT Hello reddit, today i come begging for some explanation about Pre-increment and Post-increment in c. I have the following program in c, in which i increment\decrement x and save the value to n (or the other way around i'm not really sure), what i initially thought is that we're going to post increment x (x is 9 now), and then decrement (x is 8), and then increment again (x is 9), finally decrement (x is 8), but it seems like am getting the following output, 9 - 8 int main() { int x = 8, n; n = (x++, --x, ++x, x--); printf("%d - %d \n", n, x); return 0; } Can somebody please explain what exactly am i doing wrong. Thank you :) [link] [comments] |
You are subscribed to email updates from AskProgramming. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment