• Breaking News

    Tuesday, March 26, 2019

    Do you ever feel weird using a feature you built or seeing a mere stranger using a feature you built and / or contributed to? Ask Programming

    Do you ever feel weird using a feature you built or seeing a mere stranger using a feature you built and / or contributed to? Ask Programming


    Do you ever feel weird using a feature you built or seeing a mere stranger using a feature you built and / or contributed to?

    Posted: 26 Mar 2019 03:27 PM PDT

    I'm building an application for an Android and iOS application for an organization and I saw someone using the application one day since they were one of the people we decided to roll the beta out to. It felt so weird seeing them using the application I built. Does anyone else feel that way?

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

    How did you get things like callbacks, promises, async await, and arrow functions to "click" and make sense to you? This is still a big blind spot for me

    Posted: 26 Mar 2019 06:18 PM PDT

    I'm a CS grad and was a database engineer for 3 years, moved into web development a bit over a year ago. I still get confused when working with or talking about these aspects of javascript. My thought that is that they're all somewhat related, they are generally used when dealing with asynchronous code, e.g. getting data over a network (?). Do you have any suggestions for how to understand these concepts better? If there are certain books, talks, projects, or anything else I'd be interested.

    Thanks for any advice.

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

    [C++] I cannot figure out how to get part of my code to work. I would appreciate the help.

    Posted: 26 Mar 2019 04:15 PM PDT

    The goal of my program is to find a Bible verse in a Bible .txt file. I want it to tell me if the book, chapter, or book is not found. However I cannot figure out how to get it to tell me when the chapter is not found, or if the verse is not found. I suspect that I need to alter the if statements that correspond to them, but I am not sure what I should change.

    Here is a sample of the .txt file.

    THE BOOK OF JUDE CHAPTER 1 1 Jude, the servant of Jesus Christ, and brother of James, to them that are sanctified by God the Father, and preserved in Jesus Christ, [and] called: 2 Mercy unto you, and peace, and love, be multiplied. 3 Beloved, when I gave all diligence to write unto you of the common salvation, it was needful for me to write unto you, and exhort [you] that ye should earnestly contend for the faith which was once delivered unto the saints. 4 For there are certain men crept in unawares, who were before of old ordained to this condemnation, ungodly men, turning the grace of our God into lasciviousness, and denying the only Lord God, and our Lord Jesus Christ. 5 I will therefore put you in remembrance, though ye once knew this, how that the Lord, having saved the people out of the land of Egypt, afterward destroyed them that believed not. 6 And the angels which kept not their first estate, but left their own habitation, he hath reserved in everlasting chains under darkness unto the judgment of the great day. 7 Even as Sodom and Gomorrha, and the cities about them in like manner, giving themselves over to fornication, and going after strange flesh, are set forth for an example, suffering the vengeance of eternal fire. 8 Likewise also these [filthy] dreamers defile the flesh, despise dominion, and speak evil of dignities. 9 Yet Michael the archangel, when contending with the devil he disputed about the body of Moses, durst not bring against him a railing accusation, but said, The Lord rebuke thee. 10 But these speak evil of those things which they know not: but what they know naturally, as brute beasts, in those things they corrupt themselves. 11 Woe unto them! for they have gone in the way of Cain, and ran greedily after the error of Balaam for reward, and perished in the gainsaying of Core. 12 These are spots in your feasts of charity, when they feast with you, feeding themselves without fear: clouds [they are] without water, carried about of winds; trees whose fruit withereth, without fruit, twice dead, plucked up by the roots; 13 Raging waves of the sea, foaming out their own shame; wandering stars, to whom is reserved the blackness of darkness for ever. 14 And Enoch also, the seventh from Adam, prophesied of these, saying, Behold, the Lord cometh with ten thousands of his saints, 15 To execute judgment upon all, and to convince all that are ungodly among them of all their ungodly deeds which they have ungodly committed, and of all their hard [speeches] which ungodly sinners have spoken against him. 16 These are murmurers, complainers, walking after their own lusts; and their mouth speaketh great swelling [words], having men's persons in admiration because of advantage. 17 But, beloved, remember ye the words which were spoken before of the apostles of our Lord Jesus Christ; 18 How that they told you there should be mockers in the last time, who should walk after their own ungodly lusts. 19 These be they who separate themselves, sensual, having not the Spirit. 20 But ye, beloved, building up yourselves on your most holy faith, praying in the Holy Ghost, 21 Keep yourselves in the love of God, looking for the mercy of our Lord Jesus Christ unto eternal life. 22 And of some have compassion, making a difference: 23 And others save with fear, pulling [them] out of the fire; hating even the garment spotted by the flesh. 24 Now unto him that is able to keep you from falling, and to present [you] faultless before the presence of his glory with exceeding joy, 25 To the only wise God our Saviour, [be] glory and majesty, dominion and power, both now and ever. Amen. THE BOOK OF REVELATION CHAPTER 1 1 The Revelation of Jesus Christ, which God gave unto him, to shew unto his servants things which must shortly come to pass; and he sent and signified [it] by his angel unto his servant John: 2 Who bare record of the word of God, and of the testimony of Jesus Christ, and of all things that he saw. 

    Currently, if I search for Jude 2:3 (which doesn't exist) it will output Revelation 2:3, since that is the nearest nearest chapter 2 with at least 3 verse. I need it to stop when it reaches the next book, but I cannot figure out how. Also when I searched Psalm 23:7 (which also doesn't exist) it will go to Psalm 24:7 since that is the verse 7.

    Here is my code:

    int main () { //declares the needed variables. string bookName; string chapter; string verse; string line; bool foundVerse = false; bool foundChapter = false; bool foundBook = false; //opens the text file. ifstream fromBible; fromBible.open("Bible.txt"); //checks and reports any error while opening the text file. if(fromBible.fail()) { cout << "Error while opening the Bible." << endl; exit(1); } //opens a new file to put the searched verses into. ofstream verseFile; verseFile.open("verse.txt"); //checks and reports any error while opening the verse text file. if (verseFile.fail()){ cout << "Error while creating the verse file" << endl; exit(1); } //retrieves the book name, chapter, and verse from the user. cout << "Pleae enter the reference of the verse you would like to retrieve: " << endl; cout << "The book: " << endl; getline(cin, bookName); cout << "The chapter: " << endl; getline(cin, chapter); cout << "The verse: " << endl; getline(cin, verse); //changes the inputed strings into all caps to match the text file's book names. for (int i = 0; i < bookName.size(); i++) { bookName[i] = toupper(bookName[i]); } //loop that searches the file for the verse wanted. while(!foundVerse) { getline(fromBible, line); //determines if the book was found. if (line == "THE BOOK OF " + bookName){ foundBook = true; } //should output if the book does not exist. else if (!foundBook && fromBible.eof()) { for (int i = 1; i < bookName.size(); i++) { bookName[i] = tolower(bookName[i]); } cout << "The Bible does not contain the book of " << bookName << "." << endl; break; } //determines if the chapter was found after finding the book. if (foundBook && line == "CHAPTER " + chapter || foundBook && line == "PSALM " + chapter){ foundChapter = true; } // DOES NOT WORK. For some reason it outputs before the one it does. else if (foundBook && line.substr(0,12) == "THE BOOK OF ") { for (int i = 1; i < bookName.size(); i++) { bookName[i] = tolower(bookName[i]); } cout << "The book of " << bookName << " does not have chapter " << chapter << "." << endl; break; } //outputs the correct verse after findin the correct book and chapter. if (foundBook && foundChapter && line.substr(0, verse.length()) == verse) { for (int i = 1; i < bookName.size(); i++) { bookName[i] = tolower(bookName[i]); } cout << bookName << " " << chapter << ":" << line << endl; foundVerse = true; } //DOES NOT WORK. Finds the nearest verse number that fits the description if not available in the chapter. if (foundBook && foundChapter && !foundVerse && line.substr(0, verse.length()) == verse) { for (int i = 1; i < bookName.size(); i++) { bookName[i] = tolower(bookName[i]); } cout << "Chapter " << chapter << " of " << bookName << " does not have verse " << verse << "." << endl; break; } } return 0; } 

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

    [C++] Need help for setting up Geany for C++ programming.

    Posted: 26 Mar 2019 05:07 PM PDT

    The code is this:

    #include<iostream> using std::cout; using std::endl; struct X { int x; X(int i=0): x(i) {} X(const X &r): x(r.x) {} X(X &&r): x(r.x+1) {} ~X() = default; }; X f(const X& r) { X a(r); return a; } int main() { X a(2); X b(f(a)); cout<<b.x<<endl; return 0; } 

    So the expected output must be 3 since the return of f is an rvalue, and therefore it will use the rvalue reference constructor, however, using Geany with the following build commands:

    Compile: g++ -Wall -std=c++0x -c "%f"

    Build: g++ -Wall -std=c++0x -o "%e" "%f"

    The output is 2, at first I thought it was a problem with my code but I tested it in Visual Studio and it gave me 3. Can anybody help me configure Geany so that it gives me the right value?

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

    Need Help Embedding Facebook Messenger into Website

    Posted: 26 Mar 2019 09:04 PM PDT

    Hello,

    I was trying to embedded code into a company website for facebook messenger / to popup as a chatbox to be able to assist customers. I found the following code but wasn't able to get it to work consistently (it would pop up randomly then off on page refresh).

    Code -

    <script> window.fbAsyncInit = function() { FB.init({ appId : 'to be found from facebook developer section', autoLogAppEvents : true, xfbml : true, version : 'v2.12' }); };

    (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "https://connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script>

    <div class="fb-customerchat" page_id="xxxxx facebook company page ID"></div>

    I was looking to avoid using a 3rd party app / website for the chatbox, as I figure no need to share customers private info with other parties.

    so my questions are the following - 1. is the above code correct / is something missing ? is there an updated code? 2. I've read somewhere that I need to include a "privacy policy" for this app on the developer website, is this necessary or am I doing something wrong?

    If there's another subreddit that would be more appropriate to post this, please PM me so I can cross post.

    Thank You

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

    Image Comparing bot

    Posted: 26 Mar 2019 09:48 AM PDT

    Hey, I'd like to know how hard it would be to code an extension or bot to search a given webpage for a image on my drive?

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

    I’m looking to get into programming as well as building a computer. Are there any specific specs I should know about?

    Posted: 26 Mar 2019 07:12 PM PDT

    Title, basically. Is there anything unusual about a computer made for programming? I'm kind of new to all of this, and I'm not really sure if there's a better place to post this.

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

    HackerRank solution times out on some test cases. (Java)

    Posted: 26 Mar 2019 05:26 PM PDT

    This is the problem:

    Lilah has a string, s, of lowercase English letters that she repeated infinitely many times.Given an integer,n, find and print the number of letter a's in the first letters of Lilah's infinite string.For example, if the string s='abcac' and n = 10 , the substring we consider is 'abcacabcac', the first 10 characters of her infinite string. There are 4 occurrences of ain the substring.

    This is my code:

    static long repeatedString(String s, long n) { //# of a's long anum = 0; //counter for string int j = 0; for (long i = 1; i <= n; i++){ //update # of a's if (s.charAt(j)=='a') anum++; //iterate or restart the string if(j == s.length()-1){ j = 0; } else j++; } return anum; } 

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

    Dockerizing Java CLI

    Posted: 26 Mar 2019 04:28 PM PDT

    Hey,

    I created command line application in Java, but not everybody have installed java on their systems. So I created Docker image running my *.jar application and bash script to build and run docker container. This CLI should be running on CI/CD instances by default or on local machines periodically. My question is, is I'm going to far with this scripting?

    Bash > Docker > Java > {actual job} 

    Maybe there is some better way to do this? My app basically is searching for reports, extracts some values (hard part, and this is the main reason why I used Java) and send them to API.

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

    How do chat clients like slack and discord implement image previews?

    Posted: 26 Mar 2019 03:39 PM PDT

    A lot of chat clients will inline an image for you if you link directly to one. But sometimes they give you an image preview even when the link isn't a direct image link.

    For instance if you post this in discord,

    https://tenor.com/view/gary-oldman-everyone-yelling-gif-7290106

    it will just display the gif itself. But if you go to the link in a browser it displays the whole webpage containing the gif.

    How does discord know? Have they implemented a custom solution specifically for tenor (and imgur, gfycat, etc), or do the sites include some metadata to help clients?

    Are there any libraries I can check out that implement this kind of robust image preview?

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

    Help with vba assignment.

    Posted: 26 Mar 2019 03:06 PM PDT

    Hi guys, posted here once before for help with some vba code and had great results. Figured you guys could help me out this time, as well. Basically the guideline is as follows:

    "Design a program that accepts a number representing a class, counts the number of requests for the class and then displays the class number, name of the class and number of requests for each class. "

    This is meant to be done using arrays which we're just now going over in uni. I have (what I think) To be the baseline for the code, but when i try to output the results, it tells me "method or data member not found" and says that my lst.additem function is the problem. If anyone could tell me what's triggering the error, i'd really appreciate the help!

    Dim classes(5) As Integer

    Dim index As Integer

    index = 0

    Do Until index > 4

    classes(index) = 0

    index = index + 1

    Loop

    Dim yoga(5) As String

    yoga(0) = yoga1

    yoga(1) = yoga2

    yoga(2) = childsYoga

    yoga(3) = preNat

    yoga(4) = seniYoga

    yoga(0) = InputBox("How many people will be attending Yoga 1?")

    yoga(1) = InputBox("How many people will be attending Yoga 2?")

    yoga(2) = InputBox("How many people will be attending Children's yoga?")

    yoga(3) = InputBox("How many will be attending Prenatal Yoga?")

    yoga(4) = InputBox("How many will be attending Senior yoga?")

    Do Until index > 4

    lstYoga.AddItem ((index + 1) & classes(index) & yoga(index))

    index = index + 1

    Loop

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

    Editing windows 10 display configuration with scripts?

    Posted: 26 Mar 2019 10:43 AM PDT

    I'm sure there's a way to do this, I just haven't been able to figure it out. I need to write a script that can change the display settings between PC screen only and second screen only.

    Are there Hooks/APIs I can use to do this? The way multiple displays work in Windows is so atrocious I imagine they'd include something.

    submitted by /u/I-Downloaded-a-Car
    [link] [comments]

    Mongoose & Node.js question about $set for updating objects from an array.

    Posted: 26 Mar 2019 02:13 PM PDT

    Hi! I hope the title is clear but I'll explain myself better here, so I have the following model for my mongoose schema:

    const pollSchema = mongoose.Schema({
    title: { type: String },
    description: { type: String },
    questions: [{ question: { type: String }, answerType: { type: Number }, answer: { type: String } }],
    usrInsert: { type: mongoose.Schema.Types.ObjectId, ref: 'AdminUsr' },
    usrUpdate: { type: mongoose.Schema.Types.ObjectId, ref: 'AdminUsr' }
    });

    My array of objects that is questions it's made dynamically in the front-end and can be added perfectly with all the fields as of now, the problem is how to update my array on my server.

    For updating I've been trying to do the following:

    router.put("/edit/:id", (req, res, next) => {
    const poll = {
    title: req.body.title,
    description: req.body.description,
    questions: req.body.questions
    };
    console.log(poll.questions);
    Poll.findOneAndUpdate({ _id: req.params.id, 'questions._id': poll.questions._id }, {
    '$set': {
    'questions.$.question': poll.questions.question,
    'questions.$.answerType': poll.questions.answerType,
    'questions.$.answer': poll.questions.answer
    }
    }, poll).then(result => {
    console.log(poll);
    res.status(200).json({ message: "Update succesful" });
    })
    .catch(error => {
    console.log(error);
    res.status(500).json({
    message: "Couldn't update poll!"
    });
    });
    });

    It looks like it can update but not the way I wanted it to.

    For example this are my questions:

    question: how to do something question: do you do thing
    answerType: 1 answerType: 2
    answer: This way answer: yes

    And when I try to update them like for example change question 2 from 'do you do thing' into 'have you went to place', when I save all the objects save with the data in my first position.

    Instead of achieving updating a single object all of them change into the first from my array.

    Why does this happen and how can I fix it? Is there a better way to do this?

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

    Snake game problem in C#

    Posted: 26 Mar 2019 08:39 AM PDT

    I've got a problem in this Snake project where I can't make the snake move like a regular snake. It's not complete so there's stuff not implemented yet but I'd like to fix the moving part before I move on. I'm doing something wrong and I'd like any help I can get. And if you can, please tell what I can do better to make the code more readable or just more consistent. Just noticed that you might have to comment out the Game Instance in KeyEvents.css

    https://github.com/krabbster/Labbar

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

    Courses to learn AI in the Montreal or Toronto area?

    Posted: 26 Mar 2019 08:13 AM PDT

    Hey, I don't know if this is the right place to post but was wondering if anyone had suggestions about where to fin reputable, in-person, hands-on AI courses (like a web programming bootcamp but for AI).

    I came across this: https://aideepdive.com/. Any thoughts?

    Thanks!

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

    Best community to ask AI/ML/data science questions?

    Posted: 26 Mar 2019 08:05 AM PDT

    Looking for a heavy programming/math community that does various AI.

    So far, reddit's communities have not been responsive.

    Any suggestions?

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

    Arduino code

    Posted: 26 Mar 2019 03:48 AM PDT

    Gd morning..I'm a final year student @ university.. I'm currently trying to design my project.. Is there anyone with Arduino Code experience that may be able to help me write some code for my project..

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

    Software that makes it easy to create mathematic formula programs?

    Posted: 26 Mar 2019 03:35 AM PDT

    Hi, as a warning I know nothing about programming.

    So I'm wondering if there is some kind of program/software out there that allows me to easily make a "calculator" where I decide what each button does etc. So I could make a program to, for example, decide what my options for dinner are, using variables such as "are the kids home?" "budget" or "healthy?", and then using an equation that I made beforehand, spit out an answer that I've put in depending on . And any number of exciting equations lol

    I'm not asking for a program that tells me what my options for dinner are btw, Im asking if there is something that allows me to easily make programs like that.

    This may not be the right place, but honestly I don't even know where to start.

    Thanks muchly <3

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

    Free code-signing blockchain service for non-commercial projects

    Posted: 26 Mar 2019 02:17 AM PDT

    Hi everyone, I want to invite you to join codenotary.io

    Why paying for a code signing certificate that proves file integrity and your identity, when there is a blockchain service that does that for free. Lifetime, free access for all non-commercial projects.

    As we're just getting started we would love to get your feedback. Step by Step guide can be found here: https://www.codenotary.io/help/

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

    How do I install SDL_ttf on windows (windows 7)?

    Posted: 26 Mar 2019 01:30 AM PDT

    Hi, I want to be able to show text on screen in an SDL2 program. I've looked everywhere, but there seems to be next to no information on how to actually install it. I have downloaded SDL_ttf and put the files in the correct place, as well as done my best to install freetype but theres even less information on that. I keep getting the following error when I try to build a file that uses SDL_ttf;

    c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lSDL_ttf

    Is there perhaps a better way to do this?

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

    Can anyone tell me how does scrimba.com interactive video works?

    Posted: 26 Mar 2019 12:49 AM PDT

    Scrimba.com has this cool feature to click and edit the code while watching the tutorial. The video gets paused and user get to interact with the code from point video was paused. I believe that it's the DOM that's being recorded instead of pixels. Can anyone tell me its algorithm. How can I build such an app?

    https://scrimba.com

    submitted by /u/raza-j
    [link] [comments]

    No comments:

    Post a Comment