• Breaking News

    Sunday, April 29, 2018

    TIS-100, a wonderful game to introduce people to programming math and logic learn programming

    TIS-100, a wonderful game to introduce people to programming math and logic learn programming


    TIS-100, a wonderful game to introduce people to programming math and logic

    Posted: 29 Apr 2018 05:15 AM PDT

    When I started learning programming, I went a bit too ambitious and some of the math and logic required for my project was way too much to get my head around, and it kinda discouraged me from programming. About a couple months later, I came across TIS-100 on steam and it looked neat and creative so I got it and tried it out. This game is pretty much the perfect basic tutorial for those trying to get their heads wrapped around programming and it helped me a lot with understanding the math required to get certain data, so I highly siggest this to beginners and professionals alike because it's fun and simple and really gets you thinking, as well as it being one of the best programming tutorials I've ever come across.

    Link: https://store.steampowered.com/app/370360/TIS100/ ($6.99)

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

    How to connect program to database without storing my password and username in plaintext? [Java/Oracle DB]

    Posted: 29 Apr 2018 11:41 PM PDT

    Hey all. I made a pretty cool project with my school's database and I just got permission from my school to have access to this database my entire time I attend school as well as a year after graduation.

    I'd like to be able to post this project on my GitHub, but it stores the password and username in plain text.

    Is there a tutorial or guide on how I can encrypt this information?

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

    Making a website for a project, which tools would be good to use?

    Posted: 29 Apr 2018 11:38 PM PDT

    Sorry if it's the wrong sub-reddit to post this. So, i'm making a website with some basic functions for a project and i'm a little lost on which tools to use to make it. I was thinking on using bootstrap for the task but i don't know if also i will need to learn a little bit of javascript to make the functionalities of the website (when pressing a button should show a message if it's necessary, verify textboxes, in case of a monetary transaction that it can show the amount that was given or the part that it was covered of a certain amount, etc). I was looking on some services like Wix so the UI can be made more easily but what worries me more is the functionality of the site.

    Any suggestions on tools that could help in this situation?

    Thanks in advance :)

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

    How to get Instagram data post-CA drama

    Posted: 29 Apr 2018 10:14 PM PDT

    hey guys, with the huge new limits coming to Instagram some scripts I've written to get publicly available code aren't working. I use to get inform via ?__a=1 but that's gone now. I don't have an API key anymore as it got deactivated and it doesn't seem like they're likely to give me another key for the purpose of smalltime data manipulation.

    What tools do you guys use to get hashtags or pull up specific post's data? Paid or free I'd be happy to look at, it'd just be good to know how to navigate this space now that I can't access it so easily.

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

    Owner of open source project not reviewing my PR

    Posted: 29 Apr 2018 11:28 AM PDT

    Hello,

    I submitted my very first PR on an open source project. It felt like quite an accomplishment !

    However, after 10 days, the owner of the repo has not replied to it. I kindly mentioned him in a comment requesting feedback, but I still have not heard back.

    The project is a npm package with ~700 stars and 74k weekly downloads, so it's not an abandoned project.

    Is this to be expected in the open source community ? How long do PR typically take to get merged or closed ? How can I find other maintainers who may be to at least tell me what I did wrong ?

    I understand that my additions to the project could be rejected (though they solve at least 2 open issues), but I would like to know why so I can learn from my mistakes.

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

    Been trying all day, how to I replace the text version of a link with a hyperlink. Javascript Extension

    Posted: 29 Apr 2018 05:45 PM PDT

    EDIT: Example source, my extension already turns it into a link, but I need it clickable. https://www.reddit.com/r/RapLeaks/comments/8ft9xc/leak_drake_my_love_solo/

    My extension converts a key (ex "https://dbr.ee/3gf4") into a link (ex "https://dbr.ee/3gf4"), and that works great. But they're not hyperlinks, so you can't click them you have to copy and paste. Is there any way I can replace the text of the link with a clickable link?

    Here's my source so far, but it doesn't include any of my failed code attempts at making the links clickable.

    replaceAll(); // setInterval(function(){ replaceAll(); }, 2500); function replaceAll(){ findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('Dbr: ', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); findAndReplace('https://dbr.ee/', 'https://dbr.ee/', document); } function findAndReplace(a, b, el) { if (!el) el = document.body; var nodes = el.childNodes; for (var n = 0; n < nodes.length; n++) { if (nodes[n].nodeType == Node.TEXT_NODE) { nodes[n].textContent = nodes[n].textContent.replace(a, b); } else { findAndReplace(a, b, nodes[n]); } } } 
    submitted by /u/LoveEverone
    [link] [comments]

    [JAVA] Manipulating String into ArrayList

    Posted: 29 Apr 2018 11:32 PM PDT

    I have a txt file like this:

    P 4 0 3 0 2 0 4 0 6 P 3 0 2 7 4 5 8 S 2 3 4 5 4 T 3 4 5 6 7 8 3 

    I read it into a string, and was trying to split the string. I need to split the String at P, S, T and store the string into an arraylist. I had this so far

    List<String> list = new ArrayList<String>(Arrays.asList(content.split("P"))); for (int i = 0; i < list.size(); i++) { System.out.println(list.get(i)); } 

    and got

    ArrayList size: 3 4 0 3 0 2 0 4 0 6 3 0 2 7 4 5 8 S 2 3 4 5 4 T 3 4 5 6 7 8 3 

    while i want the strings in the ArrayList to be something like

    P 4 0 3 0 2 0 4 0 6 P 3 0 2 7 4 5 8 S 2 3 4 5 4 T 3 4 5 6 7 8 3 

    With each line representing a string. How can i go about doing something like this?

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

    Effective Kotlin: Use Arrays with primitives for performance critical processing

    Posted: 29 Apr 2018 11:26 PM PDT

    Python Zelda Clone Project Tutorial

    Posted: 29 Apr 2018 12:42 PM PDT

    Can someone ELI5 trampoline programming?

    Posted: 29 Apr 2018 06:51 PM PDT

    I've been doing some research on Retpoline, the Spectre mitigation proposed by Google here (https://support.google.com/faqs/answer/7625886).

    The name "retpoline" is a portmanteau of "return" and "trampoline."

    I've been trying to wrap my head around what trampoline is in the context of programming. I've read the wikipedia page and a couple articles on medium and searched reddit for a while but can't seem to wrap my head around it. https://en.wikipedia.org/wiki/Trampoline_(computing)

    Can someone explain why it's useful and how it works? The trampoline metaphor is tripping me up.

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

    Alternative to /r/learnprogramming: C++ (and others) discord server

    Posted: 29 Apr 2018 10:29 PM PDT

    It's a small server, so come around and say hello: https://discordapp.com/invite/gu6PQYZ

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

    Integration Testing with Spring + Security + OAuth2

    Posted: 29 Apr 2018 04:28 PM PDT

    Hello everyone, I'm hoping I can find some help here as I've been looking for the past few days at this and can't seem to find any information. I know this is a big pool of people so hopefully someone can direct me to a guide or some documentation or something.

    So I'm making a practice REST API project with Spring Boot, and I've been trying to follow TDD. The API seems to be working fine so I decided to try to bring in Spring Security and Spring Security OAuth2 to get it secured. For all of my Integration Tests (in classes annotated with @SpringBootTest) up until now I've been using the TestRestTemplate to make requests and use assertions to make sure what I'm getting back is correct.

    But I keep seeing people suggesting that I use "rest-assured" for Integration Testing.

    So I guess my questions are:

    • How exactly do I go about Integration Testing Spring Security and Spring Security OAuth2 in a TDD way? If everything works fine before I add the dependencies for SS and SSOA2 do I just modify my tests that now fail with the appropriate headers and slowly add my Resource Server and Authorization Server until the tests pass? Or should I make another Auth/Resource server that ONLY the tests use so that I can allow in memory authentication and a token store instead of actually using a real DB with "fake" data? This is what I'm mostly stumped on, I can't really find a single guide on it. I would like to use the Password Grant type, but I'm not quite sure where to "setup" the "fake" client that I would be using for testing either. I'm self taught and I see a bunch of older posts on stack exchange about something similar, but I'm still not sure of the best way to do any of this?
    • I'm trying to include this project on my resume, so is rest-assured something I should really learn to use / would it make the testing of SS and SSOA2 easier compared to just using TestRestTemplate?

    Thanks in advance for the help everyone, I've been pulling my hair out for the last few days trying to do this the "best" way possible.

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

    How would I go about making something that does exactly this?

    Posted: 29 Apr 2018 10:15 PM PDT

    So, as a huge fan of Overwatch, I'm really into the esports scene of it, a frequent browser of /r/CompetitiveOverwatch, and I watch the stream whenever it is on. Normally in the streams, there is a lot of spam, with a lot of people repeating common phrases/terminology etc...

    Besides that, let me get to the point. Someone in the subreddit often posts messages with how many times a popular phrase has been said, what the phrase was, and the total amount of messages sent during the rounds/per minute etc... I've been fiddling with JS for around a year now, and am at an okay level, but can't figure out how to do this. How can I go about doing this? I already reached out to the user that posts these updates, and haven't had any luck.

    Here's an image of what I'm trying to accomplish, if what I said above makes sense:

    https://i.imgur.com/A7bAcYj.png

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

    Why does my function bit counter work fasted on a sorted array?

    Posted: 29 Apr 2018 02:34 PM PDT

    Title should read: Why does my bit counter work faster on a sorted array?

    I wrote a naive implementation of a bit-counter, which goes like this:

     40 struct NaiveBitCounter : BitCounter { 41 42 uint8_t count_bits(uint32_t n) override { 43 44 uint8_t counter = 0; 45 for( ; n; n>>=1 ) 46 /* Same as if(n&1){++counter;}, but avoids branching */ 47 counter += (n & 1); 48 49 return counter; 50 } 51 }; 

    The parent class provides a wrapper for count_bits() which measures performance of the count_bits() method by measuring how much time it takes to count all the bits an a large const vector<uint32_t>&.

     struct BitCounter { double bitcounting_total_time(const std::vector<uint32_t>& v) { /* Used to guarantee the compiler does not optimize out calls to count_bits. */ uint8_t dummy = 0; high_resolution_clock::time_point t1 = high_resolution_clock::now(); /* Call count_bits for each element of the array */ for(const auto& vv : v) dummy |= count_bits(vv); high_resolution_clock::time_point t2 = high_resolution_clock::now(); std::cout << dummy << std::endl; /* Print to make sure the compiler doesn't optimize this out */ return duration_cast<duration<double>>(t2-t1).count(); } virtual uint8_t count_bits(uint32_t) = 0; }; 

    In my main(), I start by measuring the performance for a sorted array, then for a sorted array, and then for an array of the same value. It surprised me that it was significantly faster to count bits in the sorted and constant arrays.

    int main() { NaiveBitCounter nbc; const int n_elements = 5E8; std::vector<uint32_t> numbers(n_elements); /* Fill the array with integers from zero to n_elements - 1 */ std::iota(std::begin(numbers), std::end(numbers), 0); std::cout << "Testing for an array of sequential integers" << std::endl; std::cout << "NaiveBitCounter : " << nbc.bitcounting_total_time(numbers) << std::endl; /* Shuffle the array */ std::random_shuffle(std::begin(numbers), std::end(numbers)); std::cout << "Testing for an array of shuffled integers" << std::endl; std::cout << "NaiveBitCounter : " << nbc.bitcounting_total_time(numbers) << std::endl; /* Constant data: fill all entries of the vector with the first element of the shuffled array */ std::fill(std::begin(numbers), std::end(numbers), numbers.at(0)); std::cout << "Testing for an array of similar integers" << std::endl; std::cout << "NaiveBitCounter : " << nbc.bitcounting_total_time(numbers) << std::endl; return 0; } 

    Unexpected results (in seconds):

    Testing for an array of sequential integers NaiveBitCounter : 6.67119

    Testing for an array of shuffled integers NaiveBitCounter : 9.32365

    Testing for an array of similar integers NaiveBitCounter : 5.78701

    Does anyone have a hint on what may be causing this discrepancy between the processing times of sorted and unsorted vector<uint8_t>?

    Thanks in advance.

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

    [JS/JQuery] Parsing data from a URL (Chrome Extension)

    Posted: 29 Apr 2018 09:55 PM PDT

    Hi,

    I am currently in the process of constructing a chrome extension. I am trying to construct an extension that displays stats that I get from parsing a URL whenever you click on this pop-up extension.

     

    So far, I have been able to just display the website within this pop-up window by writing data to the document using JQuery get and the success callback function.

     

    The problem I'm having is how do I go about parsing the stats within this URL ? As far as I know, data is a string representing the HTML/source code of that url. What is the best approach to parsing this data ? Do I need to convert it to html first ? If I do that using parseHTML, how do I read this array of DOM nodes ? The info I want is quite heavily nested (It is a Yahoo Sports stats page).

     

    Thanks ! Sorry if this is a noob question, I have had 0 experience working with JS/HTML/JQuery/CSS. I just dived in head first trying to make this extension.

    // This is in popup.js chrome.storage.sync.get("trackingURL", function(result) { var currentURL = result.trackingURL; console.log("Value currently is " + currentURL); $.get({ url: currentURL, success: function(data) { console.log(data); document.write(data); }, error: function(xhr, textStatus, error){ .... } }); }); 
    submitted by /u/McNuggets91
    [link] [comments]

    I just purchased a Macbook Pro, why is Codecademy so dang slow on it?

    Posted: 29 Apr 2018 09:31 PM PDT

    It's a brand new computer, but apparently it can't run codecademy?

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

    What is a program similar to CodeRunner for Windows?

    Posted: 29 Apr 2018 05:42 PM PDT

    I use the application CodeRunner on my MacBook to write and run code (mainly in Python, but it is able to write in many languages).

    I was wondering if there is an application (preferably $15 or less) for Windows that is able to write and run multiple languages? (Also if it automatically colors certain words, that's nice icing on the cake)

    Thanks!

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

    Make a blog on HTML?

    Posted: 29 Apr 2018 09:25 PM PDT

    As part of our BA in New Media examination, were supposed to create a blog via HTML and make two posts. I have a good amount of expwrience with Wordpress, but none with HTML. Any help?

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

    Help! Question regarding C# windows forms

    Posted: 29 Apr 2018 09:10 PM PDT

    My program has 2 combo boxes. One combo box contains school standards, the other combo box contains grades. Each standard has a number of credits assigned to them as a string. if a standard is selected the credits assigned to that standard get displayed within a label. The user must select 5 standards. For example:

    User selected standard 91637 as his/hers first standard . 91637 has 4 credits assigned. The number 4 is displayed within a label named lblCredits1.

    The user must select a grade, either A (for achieved) or NA (for Not Achieved) for each standard. If the first grade gained on the first standard is A. Then the credits within the lblCredits1 need to be gather.

    I need help gathering the credits that the user has achieve over the 5 standards and i need help changing these credits from string to decimal.

    Once all the assigned credits to the standards that the user has gained Achieved at gathered. They need to be added and total to be displayed within a label.

    For example Standard 1 is 91637 = 4 credits, Standard 2 is 91633 = 6 credits, etc

    Total= ......

    This is what I got for converting the string to decimal but it not working:

    decimal decimalVal = 0;

     decimalVal = System.Convert.ToDecimal(lblCredits1); lblCreditsAnswer.Text = decimalVal.ToString(); 
    submitted by /u/C0deC0deC0de
    [link] [comments]

    What are two vastly different programming languages , and how do they make programming easier?

    Posted: 29 Apr 2018 09:05 PM PDT

    How do these languages make dealing with system complexity easier too? I know there is Python, which is a good beginner language to learn due to it's low difficulty, but what are some other ones?

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

    Help me understand this mutual recursion problem

    Posted: 29 Apr 2018 08:53 PM PDT

    The problem is to count the different ways to partition a number 'n' with maximum partition size of 'm'.

    So if you called a partition function count_partitions(6,4), then it should return 9 because there are 9 ways to split the number '6' with max size of '4':

    6 = 2 + 4 <---- +4 is as high as you go.

    6 = 1 + 1 + 4 <------

    6 = 3 + 3

    6 = 1 + 2 + 3

    6 = 1 + 1 + 1 + 3

    6 = 2 + 2 + 2

    6 = 1 + 1 + 2 + 2

    6 = 1 + 1 + 1 + 1 + 2

    6 = 1 + 1 + 1 + 1 + 1 + 1

    I am having a lot of trouble trying to tackle the 'recursion' part of this problem, but so far I've come up with a few base cases:

    1. if n=0 then return 1 since there's one way to partition '0' and that's just '0'.
    2. if m=0 then return 0 since you can't partition a non-zero integer with max size of 0.

    3. if n<0 then return 0 since you can't partition negative integers.

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

    Annoyed with myself

    Posted: 29 Apr 2018 02:54 PM PDT

    My lack of creativity and inability to be satisfied by any project idea is pathetic.

    I spent the last 2 years in business school, with the help of my families support I dropped out and next year am going to school for comp sci. Im absolutely stoked, but in the mean time I'm gonna be working so I want to spend this year coding and being a way better coder.

    I've taught myself Python and Java pretty well over the past 2 years. But in that same time for the past year I have a hard time thinking of what to code.

    I always see, "code something to solve a problem" which in theory is great advice but I have nothing to solve that'll make my life easier (in terms of what I can tell). Also, projects like a calculator, to do list, web scrapers, and basic stuff like that just seem like a waste of time to me and boring. I don't like web development at all, and I hope to work in sec or software. I also don't enjoy python that much, it feels like solving lego. Importing pieces of libraries and reading tutorials on how to put them together, which is also boring to me.

    I'm at a lost, and I don't want to waste this year coding nothing because my creativity is pathetic, and I also hate spending time learning new languages when its like whats the point I havent coded anythign in other languages before that are impressive.

    For example I wanted to learn packet sniffing with Java but all it is was importing library and using the classes built in that library to call the functions that sniff packets and get data like MAC address etc. Seems pointless since all the work is done for me.

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

    Question regarding text based C++ maze game assignment.

    Posted: 29 Apr 2018 05:03 PM PDT

    Hi peeps, I'm trying to figure out what my assignment for c++ is specifying. "using a non-grid-like asymmetrical network of links rather than using a 2D-array"

    Does it mean I need to use multidimensional Array?

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

    School ended for me until August and I want to pick up Python for the challenge and also to bolster my resume. How do I maximize my time between May and August to learn as much as I can?

    Posted: 29 Apr 2018 02:34 PM PDT

    This is my first exposure to programming or coding in general and I have no idea what I'm doing. All I know is I want to try and not be bored while out of school and simultaneously make my resume better.

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

    No comments:

    Post a Comment