• Breaking News

    Saturday, May 9, 2020

    Books and sites to learn theory and practices? Ask Programming

    Books and sites to learn theory and practices? Ask Programming


    Books and sites to learn theory and practices?

    Posted: 09 May 2020 05:11 PM PDT

    I been self teaching myself Rust and python plus and a class in c++ and I am inching my way to being able to call myself half way competent but I find myself lacking in actual theory. In example I found joke floating around reddit that was a bad sorting algorithm joke and it went over my head.

    I am looking for something that would show for better security, efficiency, and or readable code.

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

    Which high level languages allow direct inline assembly?

    Posted: 09 May 2020 11:05 AM PDT

    C and C++ can do that.

    Which other languages can do that without calling C or C++ to do that?

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

    Need ideas for making a wall street bets version of drug wars game

    Posted: 09 May 2020 06:13 PM PDT

    For those who didn't play it, drugwars is a simple text game where the character starts with like $5000 debt to a loan shark, $2000 cash, space for 100 drugs in his pocket, and 30 days to pay off the loan shark and try to make a huge profit ($50,000,000 is considered perfect).

    To do this, you go around five boroughs and buy and sell from a selection of like 8 drugs including cocaine (usually about $20,000), heroin (about $9000), weed (about $800) and so on. When you go to a different city, drug prices change slightly. However, a special event occurs as well including stuff like "a pharmacy was raided. Ecstasy is being sold for really cheap!" or "a cocaine bust occurred. Prices have skyrocketed!" (Which means ecstasy can fall from $1000 to like $300 or cocaine goes from $20,000 to $90,000 for example). There's opportunities to find drugs on dead people when you're going between cities, and sometimes officer hard ass attacks you - if he catches you, you lose all your drugs and pay a fine. You can try running or shooting him.

    So basically here's what I need your help with. I wanna make a stocks based game which is based on that game. It'll be a Robinhood trader trying to take advantage of illegal shit ("4chan hacks Robinhood. Berkshire Hathaway stocks are being temporarily sold at a steep discount!" or "insider trading has occurred. A pump and dump has made Facebook stocks worth a lot more than normal!").

    The problem is I need ideas on what stocks to use for the game. The cheapest of my stocks will just be a generic thing called "penny stocks". Since it'll be about doing electronic stocks, what would I use in place of going city to city? I'm thinking website to website might work, but it's still not a perfect plan.

    Instead of officer hardass, the SEC will go after you. You can try to "run" by attempting to use legal loopholes. If you succeed, the SEC backs down for that day. If you fail, they steal all your stocks (and levy a fine). If you can afford it, you can buy a lawyer and have the lawyer fight back, but this makes the SEC mad and they do damage (damage can be represented by "evidence", and if you take 100 evidence worth of damage, you lose because you're jailed).

    So basically, what stocks should I use? I need ideas on illegal events that occur that can raise or lower the prices of stocks. Random events where I find a Bitcoin (and make free money) or get phished (and lose stocks). And I need an idea for why I can only hold 100 stocks (pockets won't work since it's digital). Thanks.

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

    I've heard a lot about COBOL and how there are some good jobs. Would it be worth trying to learn it?

    Posted: 09 May 2020 09:46 PM PDT

    I'd only be able to get into the industry in ~5 years after university, and I'm in Australia. I only ask because many current COBOL engineers retiring would leave openings and because the potential pay is lucrative.

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

    display text/html and download file for one HTTP request?

    Posted: 09 May 2020 09:40 PM PDT

    I am making a web site where the main output is a zip file to be downloaded, but I would also like to display some html after the 'save as' dialog comes up. I am thinking this may not be possible if the uploaded file is considered an HTTP response because HTTP only allows one response per request, but I am wondering if any real web developers know any tricks to get this done.

    I am using the Openresty Lua API with a lua script that calls a c function that actually does most of the work. So this is an Nginx/Openresty problem and it also has to be done inside of a lua script I think. Basically the user submits a form which runs the c program and creates the file for download but I would also like to display the contents of the generated file.

    I would like to call ngx.print(htmlstring) after the 'save as' dialog pops up but that just isn't working. Is there some way I could get this done with a redirect? Do I have to somehow simulate another http request?

    I am thinking that if the server told the browser that the conversation is over then it doesn't matter what I send the browser because it is not expecting new data, but I think I remember web sites that send you a file and redirect to another page afterwards even though you have not made any more HTTP requests.

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

    What language for starting-on-a-free-plane type hobby desktop application project in 2020?

    Posted: 09 May 2020 02:45 AM PDT

    For your hobby desktop application project, what language would you choose?

    Let's say it won't be anything commercial or huge.

    Rust? Haskell? Zig? Julia? Something else or even more hip?

    Forget your corporate or backward compatibility mindset and let your inner utopian soul speak in the comments below ;)

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

    Getting Started

    Posted: 09 May 2020 07:58 PM PDT

    I'm completely new to programming and want to build a career as game developer. Which language should I start with? Any additional advice will be helpful.

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

    How do you implement different paid tiers in an application?

    Posted: 09 May 2020 03:23 PM PDT

    I feel kind of silly because I have 5 years of professional development experience and another ~6 prior to that of programming but I have no idea where to even start on implementing this.

    Here's some context to help.

    I'm building a website where people can track the bowel movements of their pets. Users can upload pictures and record the date and time when the bowel movement occurred.

    The application is a simple SPA that uses some APIs developed by myself.

    Users can sign up and use the application for free to track the bowel movements of one pet. Users can optionally pay $5 dollars a month if they want to track the bowel movements of multiple pets. The free user tier is the default state and easy to implement in itself.

    So my questions are:

    1. How can you be sure that a particular user has paid before exposing the paid features? I figure I would use something like Stripe to handle the actual payment processing but how does my app know that payments have gone through successfully and continue to do so on a monthly basis?
    2. Do I need to verify every single request to the API to make sure that people are using the right feature set? Would storing this information in a claim in the JWT be a normal thing to do?
    3. How do I customize the web application based on subscription tier? Would the web app just grab the tier info and conditionally render various components? That seems basic enough, but if the tier info is in the JWT claim then when a user purchases a paid tier, the app would need to generate a new token. The app could instead make a request to an API to pull the tier info for the user, but there may be some lag between the payment being accepted by Stripe and my app's database being updated to reflect that a user has paid.

    ----

    My DDG-fu isn't good enough to find a great answer to this. Any help or pointers to some good resources would be much appreciated. Thanks!

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

    [Swift] URLSession not working?

    Posted: 09 May 2020 09:14 AM PDT

    I don't know what I've done wrong. Even though it reaches task.resume() it just ends the function. It doesn't execute the code within the dataTask.

     func FetchURL(url : String){ let session = URLSession(configuration: .default) if let urlToServer = URL(string: "https://jsonplaceholder.typicode.com/users"){ let task = session.dataTask(with: urlToServer) { (data, response, error) in print("Stuff") if let response = response{ print(response) } if let data = data{ print(data) } } task.resume() } } 
    submitted by /u/ChasmMyAbyss
    [link] [comments]

    Does a stateful session token need to by cryptographically secure?

    Posted: 09 May 2020 05:35 PM PDT

    I'm building an API that requires an authentication system to determine which accounts authenticated users belong to. Think SaaS application. I'm using stateful sessions with Redis on the server side and local storage on the client side. Upon successful login, I generate a token using Google's UUID library, so I should be fine on the collision side of things, but I'm curious if there's a reason to ensure these are cryptologically produced. There's no information embedded in the token, obviously, and they expire after a period of inactivity. It's not a JWT, so there's nothing to be encrypted/protected other than the its own existence, since all session data is stored server side.

    Is using a simple UUID for a stateful auth token is good enough? Any insight is appreciated.

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

    How Do I create a test method to test the accurate motion of a planet compared to motion of asteroid( gravitational pull of planet on asteroid)

    Posted: 09 May 2020 05:34 PM PDT

    Does anyone else have overheating issues when running Docker + Kubernetes?

    Posted: 09 May 2020 04:50 PM PDT

    Specs:

    • 2018 15" Macbook Pro
    • Intel Core i7-8850H CPU
    • Radeon Pro Vega 16 dedicated GPU
    • 32GB of RAM

    Throughout the time I've been running Docker + Kubernetes on my machine (I've just recently started learning but I've been using it on my machine for work for a while now), I've had multiple instances, where heating became a serious problem for me. Maybe it's because my machine's cooling system is just plain terrible (thermals were never really good for the modern MBP lineup until the 16", apparently); maybe it's because my CPU is too weak; or maybe, no matter the device, Docker + Kubernetes causes temp-related problems for everyone. Maybe it's all those reasons and more. Either way, I've experienced some horrible issues from serious slow downs to the machine just straight up abruptly shutting down because it gets too hot. I've honestly had enough and am now on the market to purchase a new laptop to get my work done. Luckily, the new Razer 15 dropped, and it's got everything I'd want in a laptop right now, but the two things that stick out the most are the vapor chamber cooling and a more powerful CPU.

    While I'm aware that the more powerful CPU (and GPU) may cause even more heating, I've heard that the vapor chamber cooling seriously does its job. I don't plan on using a new Razer Blade for gaming, anyways, so heat caused by gaming isn't too much an issue for me. The closest thing to heavy GPU usage from me is most likely going to be 3D rendering for ThreeJS, but that's about it.

    I'm ready to fork over the cash to get it because this overheating situation has gone on long enough. I just want a better cooling system or a method to get this annoying abrupt shutting down issue to go away. I can't explain the amount of times I've lost good progress thanks to this issue. But I don't want to count my chickens before they hatch, so I'm wondering if this is an issue that anyone else gets.

    Does anyone else have these heating issues? If you've found a way to remedy this, I'd love to hear it. being able to save $2600 would make me very happy lol

    If there is no practical work around, I'm willing to shell out the money if it means that I can code in peace without Dockernetes anxiety looming over my shoulder every second I'm coding.

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

    [JavaScript] Problem starting a React app.

    Posted: 09 May 2020 04:14 PM PDT

    Hello! I just created a new React project in an empty directory using npm install -g create-react-app and create-react-app projectName. I called npm start from the command line to test the default project, and instead I got the Hello Blockstack sign in page. I tried using this package months ago and forgot about it, how do I make it go away? I tried deleting it from my node_modules directory, it didn't work. Thanks.

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

    Is there a term for languages embedded inside another?

    Posted: 09 May 2020 04:13 PM PDT

    For instance, TikZ is embedded inside LaTeX, and CLOS is embedded inside Lisp.

    Essentially, when a language has powerful enough macros to define new syntaxes and uses this to create a new language.

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

    Which programming language has the best tools for unit testing out of the box?

    Posted: 09 May 2020 11:13 AM PDT

    Is there any language that is an undisputed king of the unit testing out of the box? Is there some language that is very bad for getting unit testing infrastructure going?

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

    Looking for software

    Posted: 09 May 2020 02:56 PM PDT

    Hi! i am looking for a software like an eBay sniping tool, but basically that i can download, or use on google chrome so that it works with a website, i am basically trying to find something that looks for a specific text to press it, if it doesn't find it, to search for another text.

    If it does find it, to press it and search for the next button to press.

    I don't really know how to explain it better since I am not as familiar with software.

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

    Help with a first-person code im using

    Posted: 09 May 2020 11:00 AM PDT

    Alright, everything else is (hopefully) flawless, but it keeps saying this error message

    "UnassignedReferenceException: The variable playerBody of MouseLook has not been assigned.

    You probably need to assign the playerBody variable of the MouseLook script in the inspector.

    UnityEngine.Transform.get_localRotation () (at <480508088aee40cab70818ff164a29d5>:0)

    UnityEngine.Transform.Rotate (UnityEngine.Vector3 eulers, UnityEngine.Space relativeTo) (at <480508088aee40cab70818ff164a29d5>:0)

    UnityEngine.Transform.Rotate (UnityEngine.Vector3 eulers) (at <480508088aee40cab70818ff164a29d5>:0)

    MouseLook.Update () (at Assets/MouseLook.cs:32)"

    Here is the code. For more Help, I'm using Unity 2019.3.13f1 Personal and Visual Studio Community 2019.

    using System.Collections; using System.Collections.Generic; using UnityEngine; public class MouseLook : MonoBehaviour { public float mouseSpeed = 100f; public Transform playerBody; float xRotation = 0f; void Start() { Cursor.lockState = CursorLockMode.Locked; } void Update() { float mouseX = Input.GetAxis("Mouse X") * mouseSpeed * Time.deltaTime; float mouseY = Input.GetAxis("Mouse Y") * mouseSpeed * Time.deltaTime; xRotation -= mouseY; xRotation = Mathf.Clamp(xRotation, -90f, 90f); transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f); playerBody.Rotate(Vector3.up * mouseX); } } 
    submitted by /u/ProjectAkio
    [link] [comments]

    How can I let the client control line breaks through the input?

    Posted: 09 May 2020 02:39 PM PDT

    I would like to display a line break every time that the user presses the enter button in the input field. Let me show you this example picture : https://i.stack.imgur.com/wyF4R.png

    As you can see, the user writes in the input:

    line 1 line 2 line 3 line 4 

    But my application does not recognize those as line breaks and shows everything in one line as shown above the inputs.

    This is how my input code looks like:

    <TextField label="Description" variant="outlined" id="desc" type="text" name="Description" value={this.state.desc} onChange={(e) => { this.setState({ typed: true }); this.setState({ desc: e.target.value }); }} required disabled={this.state.loading} multiline ></TextField> 

    I'm not sure how to render every line break that the user places in the input especially because every change is registered as the value of the description state and even if I use regex to replace line breaks with br it will just show br as a string.

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

    Stack recommendation for dynamic information management tool

    Posted: 09 May 2020 02:24 PM PDT

    I want to build a personal information management system to increase the accessibility and visibility of information that I gather or create over time.

    I'm envisioning these types of uses:

    • Dashboard that shows a random quote from the information tagged as "Quotes", and the top 5 tasks that are prioritized. From the dashboard view, I can click a task to get more information and/or mark the task complete
    • Ability to see the entire to do list or search for tasks tagged with certain categories.
    • Ability to pull up non-task information by tag, date, or other stored metadata
    • Automated e-mail summary of things to accomplish in a given week

    Basically, I want a backend database which I can interact with through a customizable front end. Information stored will be ~60% tasks, and 10% lists (could be considered tasks that are not exactly to-dos, like a list of potential birthday gifts), and 30% reference information (quotes, advice, frequent flyer numbers, etc).

    Primary features:

    • Searchable catalog of tasks, lists, and reference material
    • Ability to catalog tasks, lists, reference material with any number of tags
    • Auto-prioritized to do lists
    • Automated reminders
    • Ability to view / add / edit information from any device
    • Automated e-mail summaries

    As far as I can determine, requirements include:

    • Backend database to story information and metadata
    • Front end interface to:
      • view formatted data
      • Search / filter for data
      • Add / edit data
    • Front end customizability
    • Front end accessibility through desktop and mobile
    • Backend ability to make data calculations based on a recurring schedule (for instance, instead of just sorting tasks by level of importance, each task's priority would be some calculation of importance, time to due date, level of effort, priority of tags applied, etc)
    • Ability to send e-mails on a recurring schedule

    Things I've tried or considered:

    • Django + MySQL
      • I actually built out a version that works, but it became very cumbersome (likely due to my intermediate level of expertise).
      • I failed in building a hosted solution, so it only lived on my local machine.
    • Currently available to do list apps
      • But I want to store more than just tasks.
      • I also want to tag information with metadata that I can process in specific ways. Most apps are straightforward to do lists
    • Evernote / One Note / Google Keep etc
      • As stated above, I want to be able to process / calculate across stored information
    • Airtable
      • Airtable doesn't operate as a backend, so I'm stuck in their UI

    So my question to the group:

    1. If I am willing to built this from scratch, would you recommend a specific stack over another? I'm most interested in ease of development / deployment. This is just for personal use, so while I'm not concerned about traffic overload, I do also want to consider the security of data
    2. What steps would you recommend in initiating this project? What might steps 1-5 be? Are there resources you would suggest?
    3. Is there an obvious, readily available option I may not be aware of?
    submitted by /u/erogers82
    [link] [comments]

    Standard format for saving the content of a live web page?

    Posted: 09 May 2020 02:12 PM PDT

    Is there a recognized standard used by sites like archive.is for saving web pages? I'd like to write a script to periodically store all the reddit posts I've saved (since Reddit has a limit of 1,000 saved posts and I use the save button almost as much as the upvote).

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

    Need help creating a simple online database for an NGO which helps feed stray animals

    Posted: 09 May 2020 07:29 AM PDT

    Hello everyone,

    So the NGO is currently using just basic excel to store a list of entries for their records. They disburse funds to the vendors directly using those entries.

    I wanted to help them move to a more organized process.

    For example it looks something like this right now:

    Name | Dogs | Cats | Vendor Bank Details | Feeding Area

    ABC | 100 | 60 | XYZ Bank, 12345 | Food Street
    DEF | 120 | 75 | PQR Bank, 67890 | Water Street

    What is the fastest and cheapest (preferably open-source or free) way to take this online?
    The entries should be editable, but only approved by admins. The form can be public (preferably only to the registered feeders if possible)

    Any suggestions on how to do this? Sorry if I wasn't clear or more information is needed.

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

    Do you expect your Manager to be as Technically skilled as you?

    Posted: 09 May 2020 09:41 AM PDT

    I am an Individual Contributor at my recent job, however I have been a Manager in the past. I've always been led by Managers who've a lot of technical breadth and have developed similar projects as their team. When I was managing teams, I was required to not only manage their career growth, hire people, but also to provide technical guidance/mentorship. Currently, I am led by someone who doesn't have enough breadth to technically lead the project I am on. They don't seem to know the platform as well as the programming language we are using. They don't seem to have awareness of technics/tools/strategy required to develop/debug on this project. I am finding it hard to believe that I am led by someone who is not at par and I am seeking to change my team. Do engineers and managers in this community think their Managers should be technically skilled enough or not?

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

    Is it possible to reprogram a mobile wireless to be a wireless adapter ?

    Posted: 09 May 2020 01:03 PM PDT

    Best Practice for Moving Data to a New Index and Reordering?

    Posted: 09 May 2020 09:13 AM PDT

    Hi all,

    What I'd like to do is take an ordered list of stuff, whether it be a list of dictionaries(Python), or database rows. For instance:

    {"id": 0, "color": "red", "index":0} {"id": 1, "color": "orange", "index":1} {"id": 2, "color": "yellow", "index":2} {"id": 3, "color": "green", "index":3} ... {"id": 99, "color": "grey", "index":99} {"id": 100, "color": "black", "index":100} 

    I want to be able to take out "orange", and put it in between "grey" and "black", while keeping the order of everything else the same and updating the index.

    After a lot of brainstorming, my solution would be to set the "index" value of "orange" to a new temporary value, like 101

    {"id": 1, "color": "orange", "index":101} 

    subtract the index value of everything in between "orange" and "black" by 1,

    {"id": 0, "color": "red", "index":0} {"id": 2, "color": "yellow", "index":1} {"id": 3, "color": "green", "index":2} ... {"id": 99, "color": "grey", "index":98} {"id": 100, "color": "black", "index":100} {"id": 1, "color": "orange", "index":101} 

    and then re-assign the desired "index" value back to "orange"

    ... {"id": 99, "color": "grey", "index":98} {"id": 1, "color": "orange", "index":99} {"id": 100, "color": "black", "index":100} 

    I'm working on a couple of Python web Project in Django, and I can see I'll need this functionality in many places (change order of songs in playlist, adjust the position of a transaction in a ledger, etc), so I figured I'd ask what the best practice is for something like this as I'm not formally educated.

    My concerns are that:

    1. this could be potentially an expensive operation for a minor feature(one which I'd still very much like to have).

    2. I'm worried about "collisions" (if that's the right word) between different asynchronous operations manipulating data at the same time. Especially if the data is in a database with with a lot of rows.

    This has to be a common functionality with proven methods but I don't think I'm wording my Google searches right. If any of you could shed some insight on what you'd do, or a link to an example, I'd really appreciate it.

    Hope my question made sense. Thank you in advance.

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

    3 levels problem

    Posted: 09 May 2020 12:29 PM PDT

    Let's say you want to learn a programming language so you google and bing and find Python, Lua, JavaScript. So, you pick one of them and do it. It kind of works. This is the first level of your programming... quest.

    Then, after a year or two of maintaining this program and getting questions why it is so slow and why this and that, you say to yourself, hey, I'ma do it better, faster and more like the older kids and the second level is that you rewrite the same program in C or C++.

    Great. Another two years go by and you ask yourself, what is next, I want it to be better, I want the code to be poetry and not but-it-works, like many C++ guys often say.

    My question, what is the next step, the next language, the next... quest?

    What is the third mythical level after C++ or C?

    Is there anything more elegant while still as performant as those two languages?

    I know the answer for the first and the second level, however, the last piece of the 3 levels problem puzzle is missing.

    P.S. I will upvote you even if you answer Assembler, machine code, Brainfuck or Wenyan, but I would prefer something more serious to accomplish my... quest.

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

    No comments:

    Post a Comment