• Breaking News

    Thursday, August 1, 2019

    [JavaScript] Coding challenge reverse every word in sentence in 40 seconds! learn programming

    [JavaScript] Coding challenge reverse every word in sentence in 40 seconds! learn programming


    [JavaScript] Coding challenge reverse every word in sentence in 40 seconds!

    Posted: 31 Jul 2019 03:53 AM PDT

    So I see a lot of coding tutorials are long don't show what each function does and spends more time on asking to like and subscribe then actually coding.

    So I am starting to make these super fast videos with all resources shown so you can pause it.

    This is my first attempt at that so any feedback for new people who want to see more is appreciated.

    Hope someone finds it helpful!

    https://youtu.be/XK8-AUQSPW0

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

    Job Applications asking for GitHub portfolio...???

    Posted: 31 Jul 2019 11:14 PM PDT

    Hey everyone, I'm still relatively new to programming (almost at the one year mark), but I've made a lot of progress in my coding journey and am on the path to releasing my first app (mobile software engineering is what I'm focused on).

    I am also applying for jobs and/or internships (being ambiguous here to not expose myself lol?) to hopefully gain professional experience. However, these applications are asking for my GitHub portfolio, which I am more than happy to share. I have some concerns about it, which I would like to ask this community about, if anyone has ever had any similar experiences or how to go about sharing my portfolio.

    1st concern: My GitHub really only consists of a few completed projects in a sea of repositories that are all practice-projects where I'm practicing certain codes or playing with some frameworks. Would this mess of a GitHub portfolio look good or bad to recruiters/employers? I'd like to think that they see I'm constantly learning and working on coding, however, I'm also thinking they might see it and think I'm just a mess and shouldn't even be considered for the role/position.

    2nd concern: I've made some repositories private, especially the one project which might end up on the App Store within the year, I'd love for recruiters/employers to see it, however it's sensitive code to me as I wouldn't want people to see my source code for an app that I hope to release soon. How would I go about this sort of predicament? Could I include a note in the application saying that I have a private project that I'm working on and would love to show them in person? Could such a statement cause suspicion with recruiters/employers? Would it be a better idea to let them know that I'm working on a project and detailing what frameworks I am using/implementing?

    Thank you for any and all help/advice.

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

    Small question for school.

    Posted: 31 Jul 2019 08:49 PM PDT

    Is there any hosting place where I would be able to put up a local college forum app online for free? It would be for testing purposes. I'm sure it would only have around 20 daily visitor max and it would need a database. It would be preferable if the app could stay online for at least 3 months. Am I asking too much? Is what I want possible for free? or currently a pipe dream at the moment?

    Currently can't make purchases online since I just transferred to my University and money will be tied up for awhile.

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

    Want to start contributing to projects

    Posted: 31 Jul 2019 09:57 PM PDT

    I have been working as a .Net developer for last 1 year (and python newbie). I want to contribute to some opensource projects. I did some digging but could had no idea where to start and more confused now. Can someone suggest something? I have experience in Web, ConsoleApp and Windows Service. If I have to learn something then I will gladly do so.

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

    How can I return peak width after identifying peak location in Python?

    Posted: 31 Jul 2019 06:34 PM PDT

    I am a beginner programmer working on a project in which I am given a set of noisy data and have to filter out the noise to identify significant peaks in the data. I want to return variables like the width and height of the peak so that I could calculate the area (or at least a rough first estimate).

    The first picture is an example of what the data plotted looks like after I use the Peakutils indexes function to identify the location of each peak in the data: https://imgur.com/a/yytPxN2 (The x axis is in seconds spanning from 0.0 to 0.05 s).

    I want to find the width of each peak and am not sure how to go about that. I tried using the scipy.signal.peak_widths function but the program return the graph that looks like the second image I included in the link, where the x-axis is much larger (40000 to 60000) and I know that's because this graph is just of my x and does not factor in time.

    How I find the accurate width of the each peak in seconds that complements the indices returned in the Peakutils function?

    indexes = peakutils.indexes(x, thres=5*sigmanoise, min_dist=100, thres_abs=True) #find peaks using distance and threshold parameters results_full = scipy.signal.peak_widths(x, indexes, rel_height=1) plt.plot(x) plt.hlines(*results_full[1:]) plt.show() 
    submitted by /u/marmizzle
    [link] [comments]

    What level of knowledge does someone need so they can comprehend and get value out of Clean Code?

    Posted: 31 Jul 2019 05:25 PM PDT

    Referring to the book "Clean Code" by Uncle Bob. I picked it up and haven't had time to read it yet, but before I start getting into it I want to know how much knowledge you're expected to have going into it?

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

    I cannot white board.

    Posted: 31 Jul 2019 06:29 PM PDT

    Just had an interview. Asked 2 white boarding questions at the start. Questions were not kata level or anything just String Booleans and arrays. Solved them maybe halfway. Felt like I could not remember a single method. I came home and solved them on my laptop right after. Feels bad. Any tips to get better? I do practice white boarding maybe twice a week for 30 minutes.

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

    Creating a web service. Where do I start?

    Posted: 31 Jul 2019 09:34 PM PDT

    My professor gave me a project to connect two existing websites to enable communication between them. One is an older site, written in Java and MySQL. I was given a copy of this site's source code but there is no documentation. There is a lot of .java and other files and it's overwhelming to read them all. I figure the best way to make both systems communicate to each other is through a web service.

    While learning how to write a web service in Java seems manageable, the sheer amount of code I have to analyze is too much for a single person to handle. So basically, how can I read someone else's code without any documentation?

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

    How can I make this into pseudocode ?

    Posted: 01 Aug 2019 12:19 AM PDT

    Hi, I am making 2 buttons in HTML that call a function in JAVASCIPT, and set it to ethier true or false. I was wondering how you can write this in pseudocode form.

    here is my code:

    <button onclick="myFunction(true)">Click me</button>

    submitted by /u/1_-MSD-_1
    [link] [comments]

    How to securely store a master password hash onto SQLITE?

    Posted: 31 Jul 2019 02:19 PM PDT

    So I was working on a simple password manager, Faced a lot of troubles. Got bashed from Sqlite themselves, and they didn't show me a way. My basic python code abstractly did this:

    • A function to make a master password by passing a user input into a SHA256 hasher and then store the Hash into an SQLITE database.

    • A function to take user name and password, and use the just stored hashed master password to encrypt the password with AES, and then save it to the same SQLITE database.

    • During login, A function asks for the master password. If the runtime user password's hash matches with the stored Master Password's Hash, then Login.

    • The datatypes used to store the Master Password's Hash or what is also the KEY, The Encrypted Data, are stored in Sqlite BLOBS. And the data are in bytes. Like " b'xaab/sd3/2fag/12fasd/ " something like this.

    THE BIGGER PROBLEM:

    If I open the sqlite DB onto an sqlite browser, it displays garbage data on the hash and password columns, but if I open up a python shell, make a db object with the same name as existing db, for example con = sqlite3.connect('pass_man'),
    And run basic queries like KEY = "SELECT master_pass FROM secrets", and "PASS = SELECT enc_value FROM user_info", then it spits out the exact same data in bytes. Which I can copy paste in a notepad file, and then make a Decryption object with pycrypto in Python, and pass in those KEY and PASS values as arguments, for example,
    decipher = AES.new(KEY, AES.MODE_ECB)
    decipher.decrypt(PASS)

    It spits out the real data. So what I understand about SQLITE is that like MySql or MsSql, it doesn't come with default access control mechanism. Where I have to login and connect to a db with a password everytime. Yes SQLCIPHER is there, but it makes the program complex. I want it to be simple.

    So What can I do to make this better? How can I save myself from someone stealing my DB and quering the info out?
    As I don't have core industry experience, I don't really know if I am doing this the right or wrong way. Suggestions, Ideas, and Solutions are highly valuable for me.
    Thanks a lot.

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

    contribute to projects or organizations

    Posted: 31 Jul 2019 10:30 PM PDT

    Hi! I don't know if this is the right channel, but let's see if someone can help me. I am looking to collaborate with a project / organization as a Linux systems administrator, devops or similar . I would like to be able to expand help and in this way show my knowledge and learn from others. I write on this channel, because I can't find a way to follow in these collaborations.

    Thank you very much to everyone who wants to help me. regards

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

    Can someone eli20 me how mmaps work?

    Posted: 31 Jul 2019 10:23 PM PDT

    I don't have the complete CS background to understand as they are described in the main guides, but I am dying to get an Eli20 explanation in the meantime.

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

    Building a statistical probability/historical data analysis model to predict future performance of Formula 1 Drivers, but the data isn't easy to get.

    Posted: 31 Jul 2019 01:36 PM PDT

    Hi everyone!

    General gist of this post is basically the title: I'm building a data analysis model in Microsoft Excel to see if it's possible to accurately predict future placements of Formula 1 drivers based on numerous factors including air temp, track temp, weather conditions, time of race, qualifying times, practice times, short-term and long-term momentum, and many others I'm sure you're not too interested in me listing.

    The issue I am encountering is that many of these metrics are not readily available in a downloadable or even user-friendly database from which I can pull and translate data to be used by my model. In lieu of such a database existing, I am exploring ideas to automate the extraction of more readily-available data like race and qualifying placements for each driver so I can focus on recording more minute and specific details.

    My question is this: is there a specific software and/or process within Microsoft Excel that might facilitate this simple extraction of data from a website? I am willing to learn new software and even coding to make this easier so please do not hesitate to tell me to hop off Excel and try out Python or R (I am already knee-deep in my Excel model though so I won't go down without a fight). I am really just looking to pull basic race results and lap times from Formula 1's main website for now, and will expand whatever scripting tool I use/develop when possible to facilitate the data extraction process. I will respond to any and all recommendations/responses submitted by this community and will post my progress if requested.

    Thank you all so much for your help in advance, I really appreciate it!

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

    Do HTML Textareas register new lines?

    Posted: 31 Jul 2019 08:09 PM PDT

    Just for the sake of laziness, I'm trying to make a userscript in Tampermoney where you can copy and paste a list of numbers from an Excel document - it's a column so you can imagine how it copies and pastes - into a textarea, process it with a submit button and it will loop over each line. Do you have to split it by a special ASCII code or something?

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

    Can't figure out how to run multiple command line arguments with spaces in C#

    Posted: 31 Jul 2019 07:54 PM PDT

    I am trying to write a program that will extract text from documents at work. I have installed tesseract and it works nicely when I run it from the command line.

    I need to do more than just run Tesseract, so I'm writing a windows form to do everything and make the process simple. I am trying to use System.Diagnostics.Process and System.Diagnostics.ProcessStartInfo to use the command line in my program.

    I have looked through the documentation for ProcessStartInfo and I am aware that I need to triple escape arguments with spaces before I send them to the command line using ProcessStartInfo. But this is where my frustration/confusion starts.

    If I triple escape tesseract.exe, with no arguments so that Console.WriteLine(psi.Arguments) prints:

    /K """C:\Program Files\Tesseract-OCR\tesseract.exe"""

    I receive an error:

    '""C:\Program' is not recognized as an internal or external command, ....

    But If I double escape just tesseract.exe so that Console.WriteLine(psi.Arguments) prints:

    /K ""C:\Program Files\Tesseract-OCR\tesseract.exe""

    Tesseract is executes and runs how I'd expect it to with no arguments. Perhaps I am mistaken, but this is inconsistent with the documentation. Regardless, if I then try to run arguments, double escaping those with spaces, Console.WriteLine(psi.Arguments) prints:

    /K ""C:\Program Files\Tesseract-OCR\tesseract.exe"" ""C:\Users\atoss\Documents\OMIC\2019-07-24_947085\947085 001.bmp"" C:\Users\atoss\Documents\OMIC\2019-07-24_947085\

    And I receive the error:

    The filename, directory name, or volume label syntax is incorrect.

    I have no idea what is causing this error. I will include my code below. The function charString() just returns the input character a set number of times; I used it to make tracking my quotes easier.

    static void Main(string[] args)

    {

    string tesseractDir = "C:\\Program Files\\Tesseract-OCR\\tesseract.exe";

    string sourceImgDir = "C:\\Users\\atoss\\Documents\\OMIC\\2019-07-24_947085\\947085 001.bmp";

    string outputDir = "C:\\Users\\atoss\\Documents\\OMIC\\2019-07-24_947085\\";

    string q = charString('"', 2);

    string u = charString('"', 2);

    Process p = new Process();

    ProcessStartInfo psi = new ProcessStartInfo();

    psi.FileName = "cmd.exe";

    psi.Arguments = "/K " + q + tesseractDir + q + " " + u + sourceImgDir + u + " " + outputDir;

    Console.WriteLine(psi.Arguments);

    p.StartInfo = psi;

    p.Start();

    }

    Can anyone provide some insight? This is driving me crazy.

    submitted by /u/19Ant91
    [link] [comments]

    I haven’t coded in a month, been very busy. Any tips for picking back up?

    Posted: 31 Jul 2019 07:54 PM PDT

    So, I transferred into CS at uni last spring and basically coded non stop until mid June, where I got kind of burnt out from coding for virtually 12 hours a day 5 days a week.

    I wanted to use my summer break to well prepare myself for my Programming I&II classes but now im worried I screwed myself over by taking such a long break.

    I worry I forgot all the React I was learning and that I'm now dull in Python.

    Any tips for picking back up?

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

    Need help making a poker game

    Posted: 31 Jul 2019 07:52 PM PDT

    I've gotten the structure pretty much, but the program is basically ignoring 2/3 of the functions and I'm not sure why. This is going to be lengthy but here it goes (it's running with no errors, but only telling me what cards I have in each hand when I need if there's a flush or anything):

    include <stdio.h>

    include <stdlib.h>

    include <time.h>

    define SUITS 4

    define FACES 13

    define AVAILABLE 0

    define TAKEN 1

    void dealAcard(char *suitsInHand[], char *facesInHand[], int deck[][FACES]); void dealAhand(char *suitsInHand[], char *facesInHand[], int deck[][FACES]); void analyzeHand(char *straight, char *flush, char *four, char *three, int *pairs);

    int main() { char *suitsInHand[4] = {"Clubs", "Diamonds", "Hearts", "Spades"}; char *facesInHand[13] = {"Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}; int deck[4][12] = {AVAILABLE}; int i;

    srand(time(NULL)); for(i = 0; i < 10; i++) dealAhand(suitsInHand, facesInHand, deck); system("pause"); 

    }

    void dealAhand(char *suitsInHand[], char *facesInHand[], int deck[][FACES]) { int i; for (i = 0; i < 5; i++) dealAcard(suitsInHand, facesInHand, deck); printf("\n");

    }

    void dealAcard(char *suitsInHand[], char *facesInHand[], int deck[][FACES]) { int suitIndex, faceIndex;

    suitIndex = rand() % 4; faceIndex = rand() % 13; while (deck[suitIndex][faceIndex] == TAKEN){ suitIndex = rand() % 4; faceIndex = rand() % 13; } deck[suitIndex][faceIndex] = TAKEN; printf("%s of %s \n", facesInHand[faceIndex], suitsInHand[suitIndex]); 

    }

    /* analyzeHand: Determines whether the hand contains a straight, a flush, four-of-a-kind,
    and/or a three-of-a-kind; determines the number of pairs; stores the results into the external variables straight, flush,
    four, three, and pairs.
    */

    void analyzeHand(char *straight,char *flush, char *four, char *three, int *pairs) { #define NUM_RANKS 3 #define TRUE 1 #define FALSE 0

    char *suitsInHand[4] = {"Clubs", "Diamonds", "Hearts", "Spades"}; char *facesInHand[13] = {"Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}; int num_consec = 0; int rank, suit; straight = FALSE; flush = FALSE; four = FALSE; three = FALSE; pairs = 0; // check for flush - 5 cards of the same suit for (suit = 0; suit < SUITS; suit++) { if (suitsInHand[suit] == 5) flush = TRUE; // check for straight - eg. One each of 5,6,7,8,9 // locate the first card rank = 0; while (facesInHand[rank] == 0) rank++; // count the consecutive non-zero faces for (; rank < FACES && facesInHand[rank]; rank++) num_consec++; if (num_consec == 5) { straight = TRUE; return; } /* check for 4-of-a-kind, 3-of-a-kind, and pairs */ for (rank = 0; rank < NUM_RANKS; rank++) { if (facesInHand[rank] == 4) four = TRUE; if (facesInHand[rank] == 3) three = TRUE; if (facesInHand[rank] == 2) pairs++; } if (straight && flush) printf("Straight flush\n\n"); else if (four) printf("Four of a kind\n\n"); else if (three && pairs == 1) printf("Full house\n\n"); else if (flush) printf("Flush\n\n"); else if (straight) printf("Straight\n\n"); else if (three) printf("Three of a kind\n\n"); else if (pairs == 2) printf("Two pairs\n\n"); else if (pairs == 1) printf("Pair\n\n"); else printf("High card\n\n"); } 

    }

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

    A little app or web to graph

    Posted: 31 Jul 2019 07:44 PM PDT

    Hello, everybody.

    I have a database (mysql) with these fields:

    Date, Time. And a device that sends a signal under a certain condition, then records when the signal was sent.

    Now, I would like to obtain from these fields how many times the signal was sent, e.g. how many at 1am,2am,3am, etc.

    And also how many happened in total per day.

    I know that I can export the data and do this that I ask with for example Excel. But I would like to be able to make a web that graphs this automatically instead of having to be exporting, copying, etc in excel.

    Is there a way for mysql to generate this data? Or do I have to deal with another tool? Is there anything pre-packaged open source that I can use?

    Thank you

    submitted by /u/9acca9
    [link] [comments]

    Testing & project structure questions for a Node/Express/Angular project

    Posted: 31 Jul 2019 07:34 PM PDT

    I'm currently working on a Twitch chatbot project for fun. It's all in one project that consists of:

    • Angular
      • This is where users can login and connect the bot
    • Node/Express
      • API that serves the Angular app
      • Chatbot logic

    I'm trying to write unit tests for my project and I still have a lot to learn about testing.
    I'm seeing that since I built my angular project with the CLI it already included the jasmine testing framework.

    My questions are:

    • How do I go about setting up tests for this project?
      • Should I somehow incorporate my tests for server side code with the same test structure that is pre-built for my Angular app?
    • Should I separate my project into two separate projects?
      • (Then this way I can write tests following the documentation guides for each project respectively, angular guide for front end and jasmine node guide for back end)

    P.S. I'm currently in the middle of reading 'the art of unit testing' and I deeply regret not starting this project using TDD. So I'm aware of what I should have done, but now I'm concerned with what should I do.

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

    What do I need to learn to create a decentralized video sharing platform?

    Posted: 31 Jul 2019 11:39 AM PDT

    I'm good with HTML/CSS and JS. And recently started learning ASP.NET C# and can build basic CRUD apps. What do I need to learn to create something like Dtube or lbry? This project is either gonna end up as my graduation project or a hobby project that I put on my resume.

    Thanks in advance.

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

    == operator in swith C++

    Posted: 31 Jul 2019 07:05 PM PDT

    I was wondering if you can use the logical operator == in a c++ switch statement. I tried:

    int thing1=x, thing2=x;

    switch(thing1){

    case ==thing2:

    cout<< "Thing1 is equal to Thing2!" << endl;

    break;

    default:

    cout<<"Thing1 is not equal to Thing2!" << endl;

    }

    Obviously, that was just a bad example but I tried something similar to that in Visual Studio 2019 and it did not run. I was wondering if I can get this to work some other way that's not a block of IF statements. I can do that, but would prefer not to.

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

    Need help with javascript and html interaction.

    Posted: 31 Jul 2019 12:45 PM PDT

    I want to have a blog where I can make posts and share them on a website I've made. I have a latest posts section that will (once clicked on) will open one of the 3 latest posts I've made respectively:

    <div id="latestPostsSection">
    <input type="image" id="latestPost1" src="testImage.png" onclick="grabPost(0)">
    <input type="image" id="latestPost2" src="testImage.png" onclick="grabPost(1)">
    <input type="image" id="latestPost3" src="testImage.png" onclick="grabPost(2)">
    </div>

    The problem is I don't know how to make it work. I can think of a good system to make a post, save it, and call on it once clicked. Should I make separate HTML pages for each blog post I have?

    I will appreciate everyone's help on this :)

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

    Discord Music Bot JS/Node.js UnhandledPromiseRejectionWarning

    Posted: 31 Jul 2019 06:42 PM PDT

    Hi I'm new to codeing and this is my first "bigger" projects and i got this error my code is here.

    Thank you for the help in advance.

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

    MySQL: Is there any way to batch these 2 queries join and aggregation) into one?

    Posted: 31 Jul 2019 06:36 PM PDT

    Example is in php though the SQL code is the focus, dialect is MySQL:

     public function respondAllCoupons() { global $wpdb; // join a coupons table to a targets table $couponsTargets = $wpdb->get_results(" SELECT * FROM coupons c left join targets t on c.couponId = t.fk_coupons_targets "); // do a per url count of how many hits each url received $urlCounts = $wpdb->get_results(" SELECT urlVisited, count(*) as 'totalHits' FROM visits group by urlVisited "); wp_send_json([ 'couponsTargets' => $couponsTargets, '$urlCounts' => $urlCounts ]); } 

    targets.targetUrl could inner join to visits.urlVisited and cleanly drop the totalhits column in, saving me the task of having to program/sync it up on the front end with an expensive looping method.

    But MySQL doesn't allow with clauses so I don't know of a stepwise way of running one SQL query and then mutating it with another join.

    Can that even be done? If not is there a good one step approach for this?

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

    No comments:

    Post a Comment