• Breaking News

    Wednesday, March 17, 2021

    How to distribute interrupts between multiple cores in low level x86 assembly? Ask Programming

    How to distribute interrupts between multiple cores in low level x86 assembly? Ask Programming


    How to distribute interrupts between multiple cores in low level x86 assembly?

    Posted: 17 Mar 2021 11:23 AM PDT

    I've been screwing around with x86 assembly recently and the so called Unreal-mode, and I just got multiple CPUs running code simultaneous in DOS. Currently when it comes to old fashion interrupts like keyboard and timer, it seems that only the first CPU reacts to them. I'm guessing one should somehow configure the APIC with which core responds to which interrupt, but I don't know how to do this yet. I suppose I would eventually dig this info from somewhere, but I would appreciate it if someone familiar with the subject has simple examples of how to do this.

    In case anyone is interested, I posted my code here: https://pastebin.com/4YJULxin. The first core responds to timer interrupt by incrementing the first character on the screen and the second core is simultaneously incrementing the second at much higher rate. That's all the code does for the time being. It runs only without EMM386 because of obvious reasons. Tested in FreeDOS.

    I was thinking of running an adlib emulator to generate PCM on the other core so that PCI sound card that is not normally compatible could be made to work with DOS games. Then I just trap port writes to 388h and 389h when the game is trying to write, and update registers for the second core so it can keep generating the waveforms and respond to the sound card interrupts. I already dug adlib emulation code from dosbox and it seems fairly easy to get it to run standalone.

    This is a hobby project so I'm not interested in doing it the easy way. Rather, I specifically want to see everything as low level as possible, minimize all latency, make everything as synchronous as possible, understand stuff on port and memory address level, and so forth.

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

    Struggling with recursion

    Posted: 17 Mar 2021 04:26 PM PDT

    Hi all, I'm trying to learn recursive functions and it's breaking my brain. I found this very basic example online, but I still don't understand it:

    #include <stdio.h>

    int factorial(int i)

    {

    if(i <= 1)

    {

    return 1;

    }

    return i * factorial(i - 1);

    }

    int main()

    {

    int i = 12;

    int j = factorial(i);

    printf("Factorial of %i is %i\n", i, j);

    return 0;

    }

    Now, I've run this code in my IDE and I can confirm is does work, but I just can't figure out why. The base case simply returns 1 and since the base case is always eventually called, surely the function should simply just return 1 in every case regardless of the input, so I would expect the output to be:

    Factorial of 12 is 1

    This is driving me nuts, any help would be a great relief.

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

    How should I choose a JS framework to learn?

    Posted: 17 Mar 2021 04:14 PM PDT

    They all seem fairly identical from a surface level glance, but react seems to have the biggest market share. Looking to get some good JS on my resume

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

    Trouble using python in Command Prompt

    Posted: 17 Mar 2021 09:40 PM PDT

    I'm new to python and CS and wanted to learn how to install packages and such using pip, and found that I can't use the command "Python --version" in Command Prompt without getting an error of "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases". The weird thing is that "py" works and will show me my Python version and everything, and I've also been working with Python for a little bit in Eclipse/definitely know it's installed.

    Furthermore, when I check my environment variables, I see two paths:

    C:\Users\Bradley\AppData\Local\Programs\Python\Python39\

    and

    C:\Users\Bradley\AppData\Local\Programs\Python\Python39\Scripts\

    Which is what I found out I need according to some posts on the internet, and this is apparently what fixes the problem (making these paths when they're not already there) so I'm stumped and don't know what's going on.

    Any help is appreciated!

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

    Rust, trouble understanding task

    Posted: 17 Mar 2021 09:37 PM PDT

    Hello, i've been set a task and i'm struggling to understand what it is that i'm supposed to do. I'm not asking for someone to code this for me, just for some help understanding. It would really be appreciated. The task is shown below:

    Define the following struct:

    Particle that contains x and y data members.

    ParticleSystem that contains a vector of Particles.

    Implement a new function for each of the data structures.

    A suggested starting point would be 100 particles limited in position to a 10 x 10 enclosure.

    Now add a function to ParticleSystem that moves each particle a random distance within the enclosure You may find the following function useful (It returns a random floating point number in the range 0 to 1):

    rand::random::<f32>()

    Add appropriate test code to ensure that the particle positions are both initialised correctly and updated when the move function is called.

    Now add a function to ParticleSystem that contains a loop that repeatedly calls your move function, for approximately 10 seconds.

    what data type should the data members be and what is meant by a 10x10 enclosure? thank you in advance for any help.

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

    Need a programmer

    Posted: 17 Mar 2021 09:28 PM PDT

    Looking for a programmer who works script/web pages for add bots on agar.io, 4 idioms required

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

    Need help calculating which input was used the most in C

    Posted: 17 Mar 2021 08:52 PM PDT

    I'm trying to make a program that presents the user with a list of options that can be selected by their associated number value.

    Ex:

    1. Mark
    2. Jack
    3. Joe

    Enter the number for the name you want to select:

    How would I go about finding the most frequently used input and printing that out? My one bit of advice I was given was "How might you track a count (a total) for multiple things? "

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

    Is it possible to load a JS file using the "javascript:" PREFIX from the url bar ?

    Posted: 17 Mar 2021 12:03 PM PDT

    javascript:<script src="blahblah.com/test.js"></script>

    does nothing.

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

    How to implement apple subscriptions for an iOS app when I'm developing the backend in python?

    Posted: 17 Mar 2021 04:49 PM PDT

    Basically all in the title. Looking through the docs and resources I don't have any kind of clear idea on how to proceed with subscriptions and in-app purchases for all things server-side.

    I'm not working on the iOS app another guy is, so I mainly need to understand the server-side stuff.

    Any help is greatly appreciated, thanks!

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

    Attempting to scrape images from raw data

    Posted: 17 Mar 2021 04:08 PM PDT

    I have an old DOS MZ exe that I'm trying to decompile. It has audio in it, and it also has Images within it somewhere too. I've managed to extract audio from it by passing it through audacity using raw 8bit 18000Hz. I've actually created a webpage that lets you extract the audio already, as proof of concept. Trying to work on the images next, and I'm also hoping to eventually get to machine code. I'm missing a lot of knowledge here, and I'm struggling to find good articles online about any of this. Hoping to release my findings on GitHub later but would really appreciate any help if anyone has experience in doing these things.

    Spoilers: it's DrainStorm.

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

    Help me help my grandpa with a quick webscraping job

    Posted: 17 Mar 2021 03:01 PM PDT

    Howdy,

    I'm trying to extract some text from a webpage in python for a little side project my grandfather is trying to do. I have moderate python experience, but only have a small amount of web scraping knowledge. I've tried to extract the html with requests (also tried urllib) and parse it via beautifulsoup already.

    When I make a request call to the website, I get a 200 response code, and some html is ostensibly extracted / parsed. Upon inspection, the only extracted text reads "Your browser does not support scripts or has been configured to not allow scripts....". Since I can extract html from other webpages, I'm guessing this is some kind of server side issue?

    The text on the webpage I want to extract is visible. When I inspect the source code for the page, the text I want to extract is nowhere in the source, so I have to imagine it is loaded by some widgit that is like echoing the value of some variable otherwise hidden to me as a user.

    Given, this, is there any common mistake I could be making that is preventing me from grabbing what I need, or is it more likely the webpage is preventing my request. In the latter case, what could I do to programmatically get the raw text from a webpage? I was thinking of somehow automatically saving it as a pdf somehow, then using a text extraction program on the pdf, but that seems complicated.

    P.S., I googled the extracted text but didn't find any useful help there.

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

    Function wont return

    Posted: 17 Mar 2021 06:22 PM PDT

    Hi, what is wrong with my code?

    #include <iostream>

    #include <math.h>

    using namespace std;

    double FlMulAd (double a, double b, double c)

    {

    double answer ;

    answer = fma(a,b,c);

    return answer;

    }

    int main() {

    double x, y, z;

    cinxy>>z;

    FlMulAd(x,y,z);

    }

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

    TypeError: Cannot read property 'waypoint_order' of undefined

    Posted: 17 Mar 2021 03:18 PM PDT

    Trying to work the Traveling Salesman Problem with Google sheets' scripteditor. I'm pretty new to this and can't figure out what's wrong with this code. (Neither can my buddy)

    function optimalRoute() { var df = Maps.newDirectionFinder(); df.setOrigin(String("Großaspacher Straße 10")); df.setDestination(String("Weiherstraße 31")); df.setMode(Maps.DirectionFinder.Mode.DRIVING); df.setOptimizeWaypoints(true); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sql Daten"); var stops = sheet.getRange("B2:B71").getValues(); for (var i = 0; i < stops.length; i++) { var addr = stops[i][0]; if (addr.length > 0) { df.addWaypoint(addr); } } var directions = df.getDirections(); var stops_order = directions.routes[0].waypoint_order; var stop_sequence = []; for (j = 0; j < stops_order.length; j++) { var stop = stops_order.indexOf(j) + 1; stop_sequence.push([stop]); } return stop_sequence; } 

    TypeError: Cannot read property 'waypoint_order' of undefined

    What's causing this? Any ideas? Is this even the right sub for code questions?

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

    App ideas - looking for some critic!

    Posted: 17 Mar 2021 02:47 PM PDT

    Hi all,

    I am a newbie at web development, and I just currently joined a coding Bootcamp. I was brainstorming some app ideas for my portfolio. I have a few ideas, and I would love to receive any feedback.

    First idea:

    I come from a health care background, and I have previously worked with patients with mental health and acquired brain injury. In particular, I worked with a patient who suffered from speech impairments. Due to his speech impairments, he often struggled with conveying his message and had to repeat himself multiple times, which often caused him to get frustrated and formed into an outburst at times. Also, sadly the patient wasn't proficient in English. He couldn't write or read English and had intermediate speaking skills. I was thinking of creating an application that he (and others suffering from a similar problem) could talk into and it could customize a well-structured sentence and read out loud. This way he could easily communicate, without having to repeat himself until the other person understands him.

    Second Idea:

    I am deeply impressed and inspired by the game City Guesser, which is a game that portrays video locations of places around the world, and you have to guess the place on the map. I have a deep love for traveling, and I think it's a very fun game. I was thinking of maybe recreating the game with a few changes such as either creating a mobile version? or adding a history portion to it - such as a small blurb on important landmarks around the world or creating a category such as tropical, rainforests, desert, etc.

    or

    A trip planner app that shows important information to the place you're traveling or planning to travel such as cheap flights, weather, landmarks, places to stay, danger zone (high crime areas), shopping area, places to eat, local suggestions, tips, if shopping, price matcher, as to what locals pay for the idea and what the tourist are asked to pay (that way the tourist aren't robed).

    Thoughts?

    Any suggestions and/or recommendations will be greatly appreciated!!

    Also, as mentioned I am a newbie and although I get ideas I often get stuck on the execution part. I would love to know how I can approach these ideas and how I can create it? tips and tricks? suggestions?

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

    How frequently can I programmatically access a website URL without getting in trouble?

    Posted: 17 Mar 2021 02:18 PM PDT

    Were I live, I'm currently eligible for the Covid vaccine, but unable to reserve an appointment due to the crazy high demand! I thought that this would be a good excuse to code up a small project and coded a small NodeJS bot that would programmatically access CVS's website, check for available appointments in my area, and send me a text when a spot opens up!

    I tested the bot, and it works fine, however, I'm scared of leaving it running because I worry that CVS might block the bot's IP (currently on Heroku). Right now I wait 10 minutes in between hitting the site, is that safe?

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

    MySQL - if I have a composite Primary Key, is indexing any of those columns by themselves redundant?

    Posted: 17 Mar 2021 09:48 AM PDT

    I've got a table whose primary key consists of four columns, in this order:

    1. VARCHAR
    2. INT
    3. INT
    4. DATE

    I know, maybe VARCHAR as part of a key isn't a great idea, but that aside, would that be any point indexing any of these columns separately, or are they already individually indexed by being part of the primary key?

    Say I wanted to search on the second column (INT). Will that already be as fast as it can be, because that column is part of the primary key and so has a full index, or does having its own index make the search faster because the VARCHAR is out of the equation?

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

    Help with pointer array in C++

    Posted: 17 Mar 2021 09:44 AM PDT

    I have a pointer array as the input to my function. arr is a zero vector and I want to increment certain values and then return the array's value. As is I am doing

    int * func(int * arr)

    for i{

    arr[i]+=1;

    }

    return arr;

    But this is giving me memory addresses and not values, how can I work with the values instead?

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

    How to tell a browser a site is already in dark mode?

    Posted: 17 Mar 2021 01:01 PM PDT

    Maybe it's not even possible considering auto dark mode in chrome is not really supported yet.

    What I'm noticing is that it basically makes light colors dark and dark colors light, which makes sense. Problem is, it converts the dark mode already setup on my site again. So using white for example becomes black.

    I realize it's possible to check if the OS is in dark mode, but at least currently (with auto dark mode enabled in chrome), #FFF and #000 are the same, black. Anything lighter than grey #ccc turns black.

    It doesn't happen on reddit's dark mode somehow, so there has to be something I'm missing.

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

    Prime a trading algo at point A using indicator X to be executed at point B using indicator Y with Python

    Posted: 17 Mar 2021 11:53 AM PDT

    https://i.ibb.co/1bt0cKd/coding-question.jpg

    I'm coding a trading algorithm with python and my strategy involves buying at an MACD cross after the RSI indicates oversold conditions of the market. The problem I can't seem to overcome is that the RSI does not ever stay below 30 before the MACD fast line (white) crosses the MACD signal line (teal) and therefore I can't just use something as simple as

    if macdfast > macdsignal and rsioversold = True setholdings(1) 

    because the RSI never remains oversold.

    I can't seem to figure out the best way to accomplish this. I'm very new at python (only been using it for about a week and a half) so if this is a simple fix and you'd like to call me an idiot go ahead.

    TL;DR: Need to prime algorithm when RSI goes under 30 and stay primed even after RSI goes over 30 until MACD fast goes over MACD signal

    Any help or advice would be appreciated. Thanks in advance

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

    Best frameworks for end to end testing (Java)?

    Posted: 17 Mar 2021 11:12 AM PDT

    I have a Spring Boot service that I want to test by sending events/API requests to and then check that the correct events are published or the correct data is persisted to the DB.

    Are there any frameworks you would recommend for doing this? I've heard of Spock, would that be suitable?

    At the moment I have another service that uses RestAssured and WireMock (to mock calls to other services) to do this testing, but it's quite a manual process.

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

    ELI5: How do you turn those files into a website?

    Posted: 17 Mar 2021 07:13 AM PDT

    English is not my first language so please bare with me. I just started watching tutorials about making systems on youtube and I find out that they have to make a file first. You know, those files that have to be run by xampp. How do you turn those files into a website? Because I saw that instead of a link, the file location is what's on the address bar.

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

    How to convert latex objects in a JSON file to readable text?

    Posted: 17 Mar 2021 04:47 AM PDT

    I have a JSON file with latex objects and I want to convert them into normal text on the front end. I'm looking for some simple ways to do it in javascript or if possible only HTML and CSS. I found a few libraries that tell how to convert latex text, but doesn't say how to deal with huge JSON files. Any help?

    Here's a snippet of how the data looks like :

    { "name": "BR_Lambdab0_K-_D0_p.-BR_Lambdab0_pi-_D0_p", "latex": "\\frac{{\\cal{B}} ( \\Lambda_b^{0} \\to D^{0} p K^{-} ) }{ {\\cal{B}} ( \\Lambda_b^{0} \\to D^{0} p \\pi^{-} )}", "category": "Bbaryon/D", "average": 0.07840881240362992, "error": 0.008607155901120699, "measurements": [ { "value": 0.073, "error": 0.011169491020860955 }, { "value": 0.112, "error": 0.025998451891820918 } ] }, 

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

    Help with explanation?

    Posted: 17 Mar 2021 11:30 AM PDT

    Hi guys! I have this assignment with the instructions:

    1. Write a Java method, called getArticle, that gets a String as a parameter and returns the String value "an" if the parameter starts with a vowel otherwise returns "a".
    2. To test the getArticle method, include a main method that:
      1. Gets a noun from the keyboard as a String
      2. Calls the getArticle method. The noun is passed as the argument
      3. Prints the returned value from the method followed by the noun
      4. For example, if user inputs "Cat", you program returns "a Cat" and if user inputs "Apple", your program returns "An Apple".

    As far as the code goes I had some help and got the code:

    https://pastebin.com/SUmSUEeK

    I was just wondering if anyone would be able to explain the code step by step so I could know and understand what I was doing.

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

    No comments:

    Post a Comment