• Breaking News

    Wednesday, November 27, 2019

    A very good comprehensive tutorial to learn python learn programming

    A very good comprehensive tutorial to learn python learn programming


    A very good comprehensive tutorial to learn python

    Posted: 27 Nov 2019 02:51 AM PST

    The link below serves as a quick crash course both on the Python programming language and on the use of Python for scientific computing.

    Python Tutorial

    There is also a jupyter notebook version where you can directly run and play around with code.

    Jupyter Notebook Version

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

    When switching workspace projects don’t load ECLIPSE

    Posted: 27 Nov 2019 09:52 PM PST

    Hey all, when I copied all of my projects to my usb and then when losing that workspace on another computer the projects don't show up. I never swap workspace before so I don't know what to do, searched in google and they say to export it but I'm not at home and wondering if there's another way to do it when it's already on my usb.

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

    Steam sale: Programming games, can they really be helpful?

    Posted: 27 Nov 2019 07:07 AM PST

    At the moment there is a big Steam sale going on and I had my eye on a couple of programming games.

    At the moment I am learning Java and for a couple of months really try to challenge myself daily learning it, writing some code, .. ect but for some day's now I feel discouraged to start and can't grasp any of the material. It feels like my brain is taking a little holiday to the coast of Mexico, sipping on margaritas and I might have bored him too much.

    I was thinking it might help to add some more fun to it, and try a few games which say are about programming and might improve some logical thinking skills while having fun. Do you think this could be of help or a waste of time and money?

    I have my eye on the following games:

    • Hacknet
    • Shenzen I/O
    • While True: learn()
    • Exapunks
    • hackmud
    • TIS-100
    • Rogue Bit
    • SpaceChem

    Does anyone has experience with them?

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

    Wondering if there's another way of extracting info separated by delimiters

    Posted: 27 Nov 2019 08:53 PM PST

    Currently, i'm getting the information like this,

    string result=John,25,Engineer

    string[ ] StrArr=result.spilt(',');

    string name=StrArr[0];

    Not sure if this way of coding is the best, and just want to see if there are any other alternatives for doing this

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

    Build 2 native apps or use Flutter?

    Posted: 27 Nov 2019 10:29 PM PST

    Hey tech lovers,

    We are a startup that heavily relies on the mobile app we are going to release. We have not yet started the development of our apps and are having a difficult time deciding on which of these options to choose:

    1) build native apps in both Android and iOS, using Java and Swift (2 codebases) 2) use Flutter to build one cross platform app (1 codebase)

    Our priorities(descending): 1) beautiful, fast, great ui for the users 2) fast release

    This means that we value most the ui and performance of the app but still dont want the development to take long.

    We have a group of 2 developers in total (excellent software engineers).

    We want to have the apps ready for release in 2-3 months.

    UI prepared by the designer is ready.

    Taking these points in consideration, what path do you recommend us to follow?

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

    Should I try learning programming and a new operating system at once?

    Posted: 27 Nov 2019 10:04 PM PST

    I'm trying to learn programming on linux, however I'm still not very knowledgable about linux. Should I just start on windows and gradually move to linux so I can focus on learning some programming rather than trying to learn some programming and linux at the same time?

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

    What's more important as a student: Personal projects or preparing for coding-interviews?

    Posted: 27 Nov 2019 09:06 AM PST

    I'm a CS student in my second year, and I've been thinking about how I should spend my time outside of class developing my skills. My free time is pretty limited, so I want to spend it wisely and put my best foot forward. Should I put most of my development-time into the code-questions employers are inclined to ask or pursue a project? If I'm honest, I much prefer developing something meaningful rather than grinding away on leetcode samples, but I understand the place they have in the industry. My peers are also heavily into competitive programming which has coloured my viewpoint quite a bit.

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

    HOW TO POPULATE 2D Array USING DATA FROM FILE TXT? (JAVA)

    Posted: 27 Nov 2019 08:57 PM PST

    I'm using for loop for the rows and column. I can't seem to figure out what to put in my inner for loop. Help please I've tried searching in google and watching YT videos nothing seems to help.

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

    Udemy MERN Full Stack Course is 94% Off Right Now - Questions

    Posted: 27 Nov 2019 02:13 PM PST

    Has anyone taken the MERN Full Stack course on Udemy?

    Is there a better Web Development course on Udemy? They are all 94% off it seems because of Black Friday.

    I already know/familiar with HTML, CSS, some JS, C#, some python.

    Its currently 94% off which makes it much more appealing. React, NodeJS seem to both be pretty high priorities when checking out local Web Development job postings. Express and MangoDB seem less so. But if I have a decent and, now affordable, way of learning I am considering it. Just wondering if anyone here has tried it. I've generally avoided paid online 'courses' before as I'm decent and learning on my own via free resources. At this point I'm ready for a one stop shop to learn.

    https://www.udemy.com/course/react-nodejs-express-mongodb-the-mern-fullstack-guide/

    At the very least, maybe this will serve as a PSA that udemy courses are highly discounted at the moment!

    Thanks!

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

    Inheritance and pointer to a member variable

    Posted: 27 Nov 2019 11:29 PM PST

    Hello so I have this assignment and I am stuck at one point.

    Basically they want me to create 3 classes Author, Book and Library. (language C++)

    Author only contains one string member for author name.

    class Author{ public: string name; Author(string n) { name = n; } }; 

    Book contains 4 members one of which needs to be a pointer to the real author.

    class Book: public Author{ public: string title; string Author::*name = &Author::name; // problem is here string isbn; int edition; Book(string t, string a, string i, int e) { title = t; name = Author(a); // problem is here isbn = i; edition = e; } Book() { name = NULL; isbn = "INVALID"; } }; 

    So, once the user creates a Book im guessing that author should be automatically be created with the input they give as a string, but I am keep getting errors that I wasnt able to construct it or that "no function call for author", I kinda get the problem but have no idea how to solve it.

    Edit: Fixed formatting and explained a bit more about my problem.

    Thank you!

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

    Learning Java Graphics and Hit a Wall with Tutorial code

    Posted: 27 Nov 2019 10:36 PM PST

    I was going along with the tutorial i was reading, I was putting in the code it told me and reading its explanation of what the code did and at the end of the first section of the tutorial my code was like this

    public class Start extends Canvas { public static void main (String[]args) { JFrame frame = new JFrame("Sup brother"); Canvas canvas = new Start(); canvas.setSize(400, 400); frame.add(canvas); frame.pack(); frame.setVisible(true); } public void paint(Graphics g){ g.fillOval(100,100,200,200); } } 

    The funny part was that at this point the tutorial said that if I ran my code a circle would appear in the middle of my frame. This was odd as the method that would make the circle was never called in the main method, but i tried it and guess what no circle, there was a frame but it was empty. I realized if i wanted to run the method i would need a graphics object to use it but the only 2 object i had were a canvas and a jframe and neither worked for running the method. Could i create some sort of other graphics object to run this? Failing that could I modify the paint method some how so that i could just call it an it will make a circle?

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

    I need a little help with Python

    Posted: 27 Nov 2019 06:44 PM PST

    So I am pretty new to programming and I'm currently under going my first project. It's a text adventure game and i'm following a video but there are some errors that are happening for me but not for the guy in the video. Any idea what I'm doing wrong?

    Here's my code:

    import time answer = input('Would you like to play Deepest Depths? (yes/no)')if answer.lower().strip() == "yes": answer = input('You are in a pitch black cave, you have a torch and a map.''Would you like to light the torch or read the map? (light torch/read map)').lower().strip()if answer == "light torch":answer = input ("The torch reveals a troll sneaking up behind! Do you run or fight? (run/fight)")if answer == "run":print("Smart decision, as you go deeper into the cave you see a locked door.")else:print ("You try and fend the troll off, but it smashes you with it's club.")time.sleep(3)print ("You lose!") elif (error here) answer == "read map"print("You can't read a map in the dark! A thunk sound occurs and with it your head fly's away!")time.sleep (3)print ("You lose!") else: (error here) print("Invalid choice you, lost sorry!") else: (error here) print("That's too bad!") 

    Here is the link to the video: https://www.youtube.com/watch?v=DEcFCn2ubSg

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

    Why are binary searches 'fast' considering you have to compare the target to values, and uses indexes anyway?

    Posted: 27 Nov 2019 05:55 PM PST

    Please help me understand why binary searches are viewed as so good and efficient (compared to a linear search), the issue I do not understand is say we have a simple list like 1,2,3,4,5,6,7,8,9,10 and our target is 7.

    When it does its first search and sees that 7 is higher than 5 what exactly went on here, did it count everything UP TO five? If it did not how exactly did it know where 5 was in the list, or that 7 is higher than it? Did it do some sort of pseudo-index?

    I suppose my confusion stems from that as I understand it .index() is a linear search, so how is doing a binary search which RELIES on indexes not also end up linear?

    Thank you.

    Edit: I am aware the binary searches only work on sorted lists. I suppose my question is more like what is actually happening in the computer when it accesses a value in a list via its index, compared to a index() call. Esp if you had a wonky list like [1,2,3,4,1000,5000,1000000,9999999999] how would the computer 'know' what the value is you are comparing without having to know the whole list at least up to that index?

    submitted by /u/EX-FFguy
    [link] [comments]

    learnjavaonline.org any good for an absolute beginner?

    Posted: 27 Nov 2019 08:59 PM PST

    Like I have no idea on even the basics of programming so will it help if I start from that site?

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

    Static variables [language C]

    Posted: 27 Nov 2019 05:04 PM PST

    void ler_ficheiro_txt (INFO *info, char *file) { FILE *fp; /* fp - file pointer */ char file1[20]; char a; int i=0,conta_espaco=0,conta_espaco1=0; int j=0,conta=0; int k; info[j].num_porta=0; if(file==NULL) { printf("Indique o nome do ficheiro de texto: "); scanf("%s", file1); } fp = fopen(file1,"r"); if(fp==NULL) { printf("Impossivel abrir o ficheiro\n"); exit(1); } else while((a=fgetc(fp))!=EOF) { if(conta==0) { info[j].bi=0; info[j].num_porta=0; } if(i<11) { if(a!=' ') info[j].ident_geog[i]=a; else { info[j].ident_geog[i]='\0'; i=10; } } if(i>=11&&i<20) { if(a!=' ') info[j].bi = info[j].bi*10 + (a - '0'); //converter caracter para inteiro// else i=19; } if(i>=20&&i<80) { switch(a) { case ' ': conta_espaco=conta_espaco+1; if(conta_espaco==2) info[j].nome[i-20-1] = '\0'; else info[j].nome[i-20] = a; break; default: conta_espaco=0; info[j].nome[i-20] = a; } if(info[j].nome[59]==' ') info[j].nome[59] = '\0'; } if(i>=80&&i<140) { switch(a) { case ' ': conta_espaco1=conta_espaco1+1; if(conta_espaco1==2) info[j].morada[i-80-1] = '\0'; else info[j].morada[i-80] = a; break; default: conta_espaco1=0; info[j].morada[i-80] = a; } if(info[j].morada[59]==' ') info[j].morada[59] = '\0'; } if(i>=141 && i<=148) { if(a!=' ') info[j].num_porta = info[j].num_porta*10 + (a - '0'); if(i<149 && a==' ') i=149; } if(i>=151&&i<159) info[j].cod_posta[i-151] = a; if(a=='\n') { i=0; j++; conta=0; } else { i++; conta=1; } } for(k=0;k<j;k++) { info[k].nome[60]='\0'; info[k].morada[60]='\0'; info[k].cod_posta[8]='\0'; } fclose(fp); printf("Ficheiro lido com sucesso\n"); } In main() i have declared a array of structures INFO info[6000]. 

    The code above is responsible for opening a text file and for each caracter of information it reads, stores it on a particular variable (stores it in info which is a array of structures).

    Each line of the text file has a distinct coordinate, ID number, name, street name, door number, and zip code.

    1.1.9.1 5555169 example name1 example street1 14 7259-627

    My problem is that i need to read and save 23040 of those lines. My program can run if i decide to read 600 lines but if i try 23040 the program just crashes. It is said "that the total information of this program is such that the variable may easily burst with the partition of memory "call stack" by being declared inside of a function (usually main) [by variable i think it refers of info?]. I must consider that variable as static to use in partition "data segment" ".

    What does any of that mean? What should i do?

    Edit: So i just wrote "static INFO info[23040]" on main and it appears to read and store everything without crashing ..

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

    [C++11]Can someone breakdown the logic behind private/protected/public inheritance?

    Posted: 27 Nov 2019 09:28 AM PST

    I understand how each keyword works as far as what their children will be able to access and see. However, what is the programming logic behind using private/protected/public. Is it to defend against black hats? Hackers? Plagiarism?

    What is the thought process a programmer would go through to say "(private/public/protected), this inheritance is the best one for this child".

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

    Most in demand languages/frameworks for jobs?

    Posted: 27 Nov 2019 08:43 PM PST

    What are the most in demand languages and frameworks that would apply to the majority of jobs? I know not all jobs are the same in terms of languages and frameworks being used but I'm wanting to learn some that will make me most competitive for the majority of jobs. I appreciate the input.

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

    [C++] Need some help. Tried a bunch of if else statements but won't work.

    Posted: 27 Nov 2019 08:37 PM PST

    //constant header cout<<"Welcome to 66!"<<endl; cout<<"Turn "<<turn<<endl; //display cards for player 1 cout<<endl; cout<<p1name<<" (n): "; srand(time(0)); while (CardNum > 13) { int RCard = rand()%CardNum; //generate a random number based on number of cards left in deck string DrawCard = Cards.at(RCard); // access vector syntax: vector.at(place_value); // remove cards from vector so they cant be called twice Cards.erase(Cards.begin() + RCard); //erase vector element syntax: to erase the 6th element = myvector.erase (myvector.begin()+5); CardNum--; //lower available cards cout << DrawCard <<" "; } cout<<endl; cout<<"Select Card to Play: ",cin>>PlayedCardP1; //display cards for player 2 cout<<endl; cout<<p2name<<" (n): "; srand(time(0)); while (CardNum > 0) { int RCard = rand()%CardNum; //generate a random number based on number of cards left in deck string DrawCard = Cards.at(RCard); // access vector syntax: vector.at(place_value); // remove cards from vector so they cant be called twice Cards.erase(Cards.begin() + RCard); //erase vector element syntax: to erase the 6th element = myvector.erase (myvector.begin()+5); CardNum--; //lower available cards cout << DrawCard <<" "; } cout<<endl; cout<<"Select Card to Play: ",cin>>PlayedCardP2; cout<<endl; //result if (PlayedCardP1 > PlayedCardP2) score1=score1+PlayedCardP1, cout<<"Player 1 Wins (Score: "<<score1<<"\b)"; else score2=score2+PlayedCardP2, cout<<"Player 2 Wins (Score: "<<score2<<"\b)"; 

    //result

    if (PlayedCardP1 > PlayedCardP2) score1=score1+PlayedCardP1, cout<<"Player 1 Wins (Score: "<<score1<<"\b)";

     else score2=score2+PlayedCardP2, cout<<"Player 2 Wins (Score: "<<score2<<"\\b)"; 

    ^^In the game, if I select a KS (which stands for a king of spades) and win the turn, the score displays K when it should really display 13 (which is the King's Value). I've tried various variations of if else for hours now to try to get something else to display but can't get anything to work.

    For reference J = 11 Q = 12 K = 13 A = 14 

    TLDR: How do i get the value of K(13) to display instead of K itself?

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

    Is there a general best practice for archiving states/information in databases?

    Posted: 27 Nov 2019 07:58 PM PST

    In my previous job, it was important that we were able to track every action an employee performed on every data instance because sometimes errors were made by users that could not be caught by checks (because they were thematic errors of the usage domain) and where the old state should be retrieved. I achieved this by creating an ARCHIVE
    schema with an archive table for each production schema table. Each of these archive tables logged the type of change (INSERT, DELETE, UPDATE) as well as the timestamp and the whole instance state (i.e., all column values of the instance).

    Now I want to create my very first end-to-end web application with authenticated users using a Postgres DB. I was wondering about what kind of actions/information should be archived in a database and if there is some general guideline for it.

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

    CSV .txt file will loop until last entry

    Posted: 27 Nov 2019 07:43 PM PST

    My Code works until the very last entry reads it then reads one more line and gives me an error at line 46--NoSuchElementException--sFirstName;. I think somehow it's not registering that it doesn't have a next line. Or is somehow stuck in an infinite loop.

    Edit: Java, btw!

    Code in question:

    /** * */ package uniProj; import uniProj.*; import java.util.ArrayList; import java.util.Scanner; import java.io.*; /** * @author ... * */ public class UnivDriver { private static Scanner keyboard = new Scanner(System.in); /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<Student> sArray= new ArrayList<Student>(); ArrayList<University> uArray = new ArrayList<University>(); System.out.println("What is the name of the file you want to input?(include extension"); String inFileName = keyboard.nextLine(); System.out.println("What would you like the output file to be named?(include extension)"); String outFileName = keyboard.nextLine(); Scanner inputStream = null; try { inputStream = new Scanner(new File(inFileName)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } PrintWriter outputStream = null; try { outputStream = new PrintWriter(outFileName); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } int index =0; inputStream.useDelimiter(",|\\r"); while(inputStream.hasNextLine()) { inputStream.nextLine(); String sFirstName = inputStream.next(); String sMiddleName = inputStream.next(); String sLastName= inputStream.next(); int sAge = inputStream.nextInt(); char sGender = inputStream.next().charAt(0); String sStreet = inputStream.next(); String sCity = inputStream.next(); String sState = inputStream.next(); int sZip = inputStream.nextInt(); String sPhone = inputStream.next(); String sUni = inputStream.next(); int sCredits = inputStream.nextInt(); boolean sInState = inputStream.nextBoolean(); boolean sHealthPlan = inputStream.nextBoolean(); boolean sFoodPlan = sHealthPlan; // ?? char sFoodOption = inputStream.next().charAt(0); boolean sLateFees = inputStream.nextBoolean(); sArray.add(new Student(sFirstName, sMiddleName, sLastName, sAge, sGender, sStreet, sCity, sState, sZip, sPhone, sUni, sCredits, sInState, sHealthPlan, sFoodPlan, sFoodOption, sLateFees)); outputStream.println(sArray.get(index)); index++; } inputStream.close(); outputStream.close(); } } 

    There are 100+ entries in the file but here's the first few if anyone cares to try the code out for themselves.

    File:

    101

    Martha,Lee,Washington,20,F,8776 Valley,Lincoln,LA,70912,3385476395,George Mason University,13,false,true,B,false

    Nancy,Juanita,Gibson,30,F,37 Harbor,Washington,AK,99716,2705968117,University of Louisiana,9,true,false,D,true

    Justin,John,Smith,29,M,6125 Lincoln,Cooltown,MA,02708,6272486106,University of Washington,14,true,true,B,false

    Grant,David,Smith,19,M,5456 Hoover,Madison,MN,55260,6761653002,Oklahoma State University,8,false,true,B,false

    Rachel,Maria,Smith,29,F,1864 Baxter,Nome,GA,31233,2587935221,University of Washington,4,false,true,A,false

    Hamilton,Lee,Fender,19,M,3628 Eighth,George,SC,29864,4408027223,University of Louisiana,17,false,false,A,false

    Justin,Joey,Jackson,17,M,6837 Fifth,Nome,VT,05417,2011102918,Gonzaga University,11,true,false,C,true

    Sarah,Gladys,Mallard,27,F,5443 King,Fremont,DE,19782,4404553097,Ohio State University,10,false,false,D,true

    Thank you!

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

    Make HTML page editable for users?

    Posted: 27 Nov 2019 06:58 PM PST

    I'm learning to program/ code on my own. I know how to make html pages, but how do I make them editable for people?

    I am on one of the sites where you can sell the templates/ page. How do I make the pages editable?

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

    Need Help With Dice Roll Program

    Posted: 27 Nov 2019 06:42 PM PST

    I have already completed this dice roll program but my instructor wants me to put the array into main. I attempted to do it but the program stopped running correctly. Any help?

    #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <iostream> #include <ctime> #include <math.h> void calculations(int dice[100000] = { 0 }, int rolls[6] = { 0 }) { float sdsum = 0.0; int sum = 0; float avg = 0.0; int i; int totalrolls = 0; printf("How many rolls do you want to simulate? "); scanf("%d", &totalrolls); printf("\n"); printf("Results of %d rolls:\n", totalrolls); for (i = 0; i < totalrolls; i++) { dice[i] = (rand() % 6 + 1); rolls[dice[i] - 1]++; sum += dice[i]; } for (i = 0; i < 6; i++) { printf("%d was rolled %d times (%f%%).\n", i + 1, rolls[i], rolls[i] / (float)totalrolls * 100); } avg = (float)sum / (float)totalrolls; printf("Average is %f \n", avg); for (i = 0; i < totalrolls; i++) { float squarediff = (dice[i] - avg) * (dice[i] - avg); sdsum += squarediff; } sdsum = (float)sdsum / (float)totalrolls; sdsum = sqrt(sdsum); printf("Standard deviation is %f \n", sdsum); } int main() { srand(time(NULL)); int dice[100000]= {0}; int rolls[6] = {0}; printf("Name\n"); printf("Programming Assignment 3\n"); printf("\n"); printf("This program will simulate a user-specified number of rolls of a fair die and print out \n"); printf("various statistical information about the rolls. \n"); printf("\n"); calculations(); } 
    submitted by /u/Yuiyfilyfuif
    [link] [comments]

    How can I configure IntelliJ to accept MOOC courses?

    Posted: 27 Nov 2019 02:48 PM PST

    I'm learning Java using MOOC from the University of Finland, and I want to configure IntelliJ IDEA to be able to run them (since the plugin that they provide doesn't work very well). How can I set it up so I can run the .java files they provide for learning purposes? Every little applet has its own directory with an SRC folder. Sorry if this isn't enough info

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

    Where to 'store' modal code?

    Posted: 27 Nov 2019 02:46 PM PST

    I am creating a page that works as a visual programming tool/node builder/flow chart builder. A consequence of this is that each node type requires a modal to show when it's being edited. Because of this there will be close to 100 unique modals (or just the form within the modal) that I need to be able to show.

    What is the best way to "store" the code for each modal, or just each form? Seems hard to manage if I just have the html for each modal/form type in the page's html. Suggestions appreciated!

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

    No comments:

    Post a Comment