• Breaking News

    Sunday, August 23, 2020

    Secret to program that claims it can read your mind: Ask Programming

    Secret to program that claims it can read your mind: Ask Programming


    Secret to program that claims it can read your mind:

    Posted: 23 Aug 2020 06:50 PM PDT

    I remember playing this Flash game - back in the mid 2000's - on Albino Blacksheep which seems to give the illusion that it can read your mind.

    Basically, the user is presented with a list of Orbs (the list is always the same every time the program is started), each matched to a corresponding number (the user however can't select any of them); and there is no input other than a Push Button.

    The user is instructed to choose 2 random numbers in their head and then do some sort of calculation which results in different number - one that will also match one of the orbs. And then, when the user clicks the Push Button, the program somehow correctly guesses the corresponding orb and number that matches the answer that the user got.

    So, although the user gives no input to the program other than clicking the push button, the program is able to guess the number that the user came up with by choosing two random numbers and plugging them into the simple equation.

    It seems like magic, but there must be an algorithm behind the inner workings of this flash program. Can anybody figure it out?

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

    Is there a software to automatize tests?

    Posted: 23 Aug 2020 08:16 AM PDT

    I'm being a T.A this semester, and one of our responsabilities is to make and mark the tests. There are a lot more students and less time to mark, so I'm looking for ways to automatize the process. Something along the lines of "Test for a negative number, now for 0 and then positive number, verify the results and mark the function accordingly"

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

    Not sure why this doesn't work

    Posted: 23 Aug 2020 10:06 PM PDT

    Hi,

    So I am very new to computer programming / coding and I wanted advice on my piece of code, moreso as to why it doesn't work.

    def coolornot(number):
    if number/7 == int:
    print(number, "is cool")

    else:
    print(number, "is not cool")

    coolornot(anyvalue) returns "is not cool". I'm not sure why this is and I'm looking for any advice.

    Thanks

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

    Animations not playing with When I receive block?

    Posted: 23 Aug 2020 08:48 PM PDT

    can you do GUI in html?

    Posted: 23 Aug 2020 05:40 PM PDT

    https://cdn.discordapp.com/attachments/654778284122439700/744939821507543061/Capture-3.PNG

    So this is my first assignment in my user interface class. Weird because this class didn't have internet programming(the class where you learn html, javascript, php etc)

    basically the pre req is java 2. So I'm a bit lost here. Im just given this stuff https://imgur.com/a/1FoD98y

    and have to make a gui

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

    Beginner java word search issue

    Posted: 23 Aug 2020 05:13 PM PDT

    Hey there,

    I'm having some issues thinking through the logic of a word search algorithm.

    I'm working on this program by making a list of lists, and I've got it to a point where I am condensing the rows and columns into an array list of the horizontal rows as well as the reverse horizontal row (example being {word, drow}) and vertical rows with reverse vertical rows (example being {code, edoc}). The reason I'm doing this is due to the required output for the program (left to right, right to left, up to down, down to up).

    Legal words are words of length 3 or more.

    I am just having an issue figuring out how to process the words in my lists...

    if the string is "worldly", I need to iterate through the string and check to see if it is in my dictionary, first checking wor, then worl, then world (which will be found), then worldl, then worldly (also being found).

    Following that though I would need to check orl, orld, orldl, orldly, when nothing is found I would move to rld, rldl, rldly.

    I'm just having issues thinking through this and any help would be super appreciated.

    Thank you so much.

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

    How to add cryptocurrency listing with API key to single Wordpress page?

    Posted: 23 Aug 2020 04:04 PM PDT

    I'm trying to add a Coinmarketcap cryptocurrency widget/form to a single webpage on my Wordpress website. I have the API key and the PHP code, but I'm just not sure where to put it, and how to get it to apply to the single page in question.

    I've been using the Coinmarketcap API documentation as a guide. Here is my PHP code:

    <?php $url = 'https://undefined/v1/cryptocurrency/listings/latest'; $parameters = [ 'start' => '1', 'limit' => '5000', 'convert' => 'USD' ]; $headers = [ 'Accepts: application/json', 'X-CMC_PRO_API_KEY: b54bcf4d-1bca-4e8e-9a24-22ff2c3d462c' ]; $qs = http_build_query($parameters); // query string encode the parameters $request = "{$url}?{$qs}"; // create the request URL $curl = curl_init(); // Get cURL resource // Set cURL options curl_setopt_array($curl, array( CURLOPT_URL => $request, // set the request URL CURLOPT_HTTPHEADER => $headers, // set the headers CURLOPT_RETURNTRANSFER => 1 // ask for raw response instead of bool )); $response = curl_exec($curl); // Send the request, save the response print_r(json_decode($response)); // print json decoded response curl_close($curl); // Close request ?> 

    I just simply want to get this integrated on my Wordpress site but can't seem to find the solution. Any help would be deeply appreciated.

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

    Tool for providing code reviews in a simple but structured way

    Posted: 22 Aug 2020 11:54 PM PDT

    A frequent request in subs like r/AskProgramming and r/learnprogramming is for comments or reviews on code that people have written.

    It's actually kind of a pain to provide these comments. You can try to write comments back directly in reddit (eg your loop on line 27 sucks) or if you *really* care enough then you can clone the repo and edit it and then do a pull request back. But that's a lot of work.

    There's obviously a ton of enterprise grade options for doing CI/CD and code reviews, etc - but they're a bit above my paygrade and I'm not aware of any that deploy to the web in an easy way.

    So I built a simple web app to help: https://codecomments.dev/

    The way it works is that you paste in the url of a file from github and it will load it, display it with pretty code formatting and allow you to add comments on individual lines. The input accepts markdown so you can even include code or links in your comment. I built this for my own use with python but it displays proper formatting for most languages.

    You can then share it back to the community or the person who asked for the review with a simple URL with a human-readable name. Have a look at https://codecomments.dev/script/view/uncovered-ammonite/ as an example.

    It's free, open source, ad-free and doesn't require any sort of registration - although it does have the option to send you an email containing the secret link for comments you've written if you like so you don't forget it.

    It runs on a python/flask back end with mostly plain vanilla bootstrap html and a bit of JS at the front end.

    Source code here: https://github.com/hankhank10/code-comments/ for anyone interested

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

    An economic keyboard?

    Posted: 23 Aug 2020 02:14 PM PDT

    Hi.

    Im looking for a economic mechanical keyboard without numpad. And please, make sure it has an Spanish version (because of ; () ""). As you could assume I'm Spanish and I'm acostumbrated to the position of the keys.

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

    [C++] Im calling an __stdcall function. That has a specific ECX. How do i pass it on the arguments?

    Posted: 23 Aug 2020 12:52 PM PDT

    So im able to call the function. But it crashes.

    The arguments show alright in the debugger.

    Only the ECX is not right. But if i change it manually to the right value.

    Then it works and the program does not crash.

    How do i change the ECX of this function?

    Its an __stdcall with 3 arguments.

    The Arg2 gets pumped automatically into the ECX.

    And thats unintended. I want the ECX to be something different.

    Please help me.

    This is my code:

    //Function structure: typedef void(__stdcall* _MQ2)(int a1, __int16 a2, __int16 a3); _MQ2 MQ2; 

    Later on in the main:

    //Calling the function: MQ2 = (_MQ2)(clientdllBase + 0x18E590); //ClientBase + RVA. int Arg1 = 0x1e2b3240; __int16 Arg2 = 0x4a; __int16 Arg3 = 0x1; MQ2(Arg1, Arg2, Arg3); 

    If anyone knows how i can change the ECX before the function is called or in the middle of the function, pls tell me.

    Thats all i need to solve the problem. Because its all working except the ECX.

    I also tried to put this in many places and it never changed the ECX:

    __asm { mov ecx, 0x36 //random number just to test } 

    Pls help.

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

    tracking position of an object with a camera?

    Posted: 23 Aug 2020 11:19 AM PDT

    Ill be honest, I am out of my league on this one. However, I have a lot of time and I'd like to know if its possible for me to do.

    I am looking for a resource on tracking the position of an object (in this case a golf ball) in relation to the camera itself. It would be in a controlled environment, a fixed camera position and a white golf ball on a background color of my choosing. I would ensure good lighting as well. The goal is to use the position of the golf ball to change the color of rgb LEDs. This could just be one change when it enters the position range of the hole, but it would be very cool to make it gradate towards a certain color as it gets closer.

    Any resources on the topic would be amazing. Cheers!

    edit:

    this is the best resource I've found so far if anyone is interested

    submitted by /u/TheRealGuy--BestGuy
    [link] [comments]

    Measuring Script Performance?

    Posted: 23 Aug 2020 11:12 AM PDT

    Coding a Chrome Extension to appear on Checkout pages. How hard would that be ?

    Posted: 23 Aug 2020 04:20 AM PDT

    I recently had an idea about a Chrome Extension. Behaving a bit like Honey, such as appearing on Checkout pages, but not offering the same thing, obviously. Having no experience in Javascript, a little bit in HTML/CSS, how hard would it be to learn to code for it and develop the extension ?

    There's not gonna be any complicated actions made by the extension such as finding coupons. It's only going to show a message with a call to action (button linking to webpage). I'm hoping it would not be TOO complicated am I right ?

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

    Looked everywhere but no luck: For Python 3, is there a way to read a continuously updating text file where new data is appended to a SINGLE line?

    Posted: 23 Aug 2020 09:36 AM PDT

    Hey everyone. Posting here for the first time. I just got into programming a little while back. But I have a STEM background so I'm not super new to coding.

    That being said, I looked extensively for help with this problem but I couldn't find anything anywhere, either here or on StackOverflow.

    Basically I have a device that continuously updates a text file with 32 bytes of data every second. Except this program isn't configurable by me and it adds that 32 bytes to the same line. So like, after 10 seconds, a single line contains 320 bytes.

    I know that if the new 32 bytes of data were appended to a new line, I could use a generator/follow function to parse the new 32 bytes and do something with it.

    But if it's being added to the same line, is there any way I can check every second or so for the new 32 bytes, extract/parse only that, work on it, and repeat every second? for the next chunk of 32 bytes?

    Any and all help is appreciated. Thanks!

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

    Java console game problem

    Posted: 23 Aug 2020 05:43 AM PDT

    I have this simple console "game", where you are a blue circle and can move with r, l, u, d but whenever I redraw the game state it draws it 3 times this is the code

    public class Player { final int width = 20, height = 10; int x = (int)Math.round(Math.random()(width-1)); int y = (int)Math.round(Math.random()(height-1)) ; int rounds = 0;

    public void show() { String str = ""; for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { if(i == x && j == y) { str += "🔘"; } else { str += "⬜"; } if(i == width - 1) { str += "\n"; } } } // for (int i = 0;i <= 52 - height*4;i++) str += "\n"; rounds++; System.out.println(str); try { char in; in = (char) System.in.read(); switch(in) { case 'd' : y++ ; break; case 'r' : x++ ; break; case 'u' : y-- ; break; case 'l' : x-- ; break; } if (x < 0) x = width - 1; if (x > width - 1) x = 0; if (y < 0) y = height - 1; if (y > height - 1) y = 0; } catch(Exception e) {} show(); } 

    }

    submitted by /u/22shadow08
    [link] [comments]

    What is wrong with my c++ program?

    Posted: 23 Aug 2020 07:55 AM PDT

    My code is giving the error : "has no member named 'end'

    19 | for(values = hashMap.begin(); values != values.end(); values++){"

    why is it giving this error, please could anyone help me.

    #include <map>

    #include <iostream>

    #include <string>

    using namespace std;

    int main(void){

    map<string, int> hashMap; hashMap["Key1"] = 68; 

    hashMap["Key2"] = 124;

    std::cout <<"This is how you output the value using 'cout'\\n"; std::cout << hashMap["Key1"] << hashMap["Key2"] << endl; map<string, int>::iterator values; for(values = hashMap.begin(); values != values.end(); values++){ std::cout << values -> first << values -> second << endl; } 

    return 0;

    }

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

    Brackets Live Preview Error

    Posted: 23 Aug 2020 07:36 AM PDT

    Hello fellows, I am currently having trouble out of the blue with my Brackets software when I open Live Preview for my HTML file on my Chrome Browser. I open my Brackets console log, and it shows errors (detail in screenshot link), I click the log and it leads me to LiveDevelopment.JS file, but I do not modify anything there as I have no idea how and I might mess it up.

    To let you know, My OS is Windows 10, 64 system, and My Brackets version is the latest 1.14.2. Here I will attach screenshots of what's going on on my desc.

    https://pasteboard.co/JnHIyfN.png

    https://pasteboard.co/JnHIREx.png

    https://pasteboard.co/JnHJ5D0.png

    I had previously done recommended solution on Brackets troubleshooting guide on Github, reading forums on Github and even another forum like StackOverflow, in addition, I also uninstall my Brackets and reinstall it, disable my firewall, enable my Chrome cookies, debug with and without extension, restarting my Windows, but still the error occurs.

    It will be really helpful if anyone has a solution and suggestion to this. Thank you.

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

    How do i add a row to my sql table when an html button is clicked?

    Posted: 23 Aug 2020 06:32 AM PDT

    Ok, let me preface this by saying, ive been trying to figure this one out for a while and came to reddit as a last resort. I dont even know where to start.

    So my website/webapp uses flask,python, html and sqlalchemy. I have a page where you can put in a search for a recipe and all the recipes from the search will list themselves into a table. I also added a button next to each recipe that says "Add" for essentially adding a recipe to a "My recipes" page.

    What i want to do is to be able to click on that button and magically run an sql query that adds the recipe next to the button to the sql table.

    Two things that i cant figure out how to do:

    1. Somehow connecting the button and the recipe so that each button "corresponds" to the recipe that it's next to.
    2. Running the sql query that adds the recipe.

    Im starting to feel like theres no way to do this using only python/flask/html/sql/js. Because everywhere i look for a question similar to this, they all use php and i have zero experience with that.

    If you need any code snippets, please tell me because i cant just post all of the code cuz its alot
    Here is the main code snippet for printing out the recipes and the add button: https://imgur.com/a/MD4hCP4

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

    php and bootstrap

    Posted: 23 Aug 2020 05:44 AM PDT

    Hi guys so I am trying to self teach my self html and I was wondering how would one insert data from a database e.g phpmyadmin to a bootstrap html form?

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

    What is an IWebdriver object in Selenium?

    Posted: 23 Aug 2020 04:05 AM PDT

    I want to learn C++

    Posted: 22 Aug 2020 11:35 PM PDT

    Hey for a long time I wanted to learn C++ because I think it's a very powerful language, but I can't find a good resource where I can learn it. Can you suggest me any good website or book?

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

    How do I become hireable?

    Posted: 23 Aug 2020 03:00 AM PDT

    Hope I'm not violating any sub rules (which I couldn't find).

    I'm going into my 3rd year of uni next semester in CS and I'd like to know what I should do to make employers interested. All the programming experience I have is from uni courses (Python, Java, C/C++) and I've only practically applied them in Intro to Machine Learning (Python) and Operating Systems (C++). My Git is practically empty and I started a course on Node.js to learn backend development but I'm not really into it.

    My questions are:
    1) What should I focus on? With the end goal being becoming hireable.
    2) Should I power through the Node.js course?

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

    No comments:

    Post a Comment