• Breaking News

    Thursday, February 27, 2020

    I made a game, check it out. learn programming

    I made a game, check it out. learn programming


    I made a game, check it out.

    Posted: 26 Feb 2020 08:14 AM PST

    Hi people, check this game i made with HTML CSS and Javascript. All opinions are welcome, any remarks on the code are most welcome. Enjoy 😊

    The code

    The game

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

    Surprised myself

    Posted: 26 Feb 2020 12:16 PM PST

    I've been learning JavaScript for about 2.5 months now. I started with FCCs curriculum and found it stressful and frustrating doing their arrays, objects and algorithms sections. To the point I thought "I'm just too stupid to get this".

    But I've seen from other success stories and people I follow on IG/ YouTube that it can be done as well as some advice that consistency and repetition will make you better at any skill.

    So I've been doing at least 3-4 hrs a day during the weekdays and giving myself at least 1 day off at the weekend. (I work sporadic shifts in a supermarket right now). And have been learning on things from YouTube and The Odin Project and Udemy. One thing I learned was to really read the docs on certain ideas and things I couldn't grasp and sit in a code pen or replit and just play with it.

    Yesterday I revisited the sections on FCC I couldn't do and the questions just felt intuitive to me.

    "Do this so this happens" oh okay so that would be this and then this... etc. Like I just get it now and even though it still takes some thinking I understand what tools I need to solve the problem.

    I know not the most exciting story and far from a "success" story, well, maybe a mini-one. Basically I've surprised myself and I can vouch that turning up every day even if it's just baby steps will get you where you're going. Eventually hoping those baby steps gets me to a job!

    Keep at it!

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

    Going to help teach some middle schoolers to code. No idea what I’m doing, advice?

    Posted: 26 Feb 2020 08:09 PM PST

    I've never really taught coding, I'm a pretty junior level dev but I figure I know plenty to teach these kids (let's hope).

    I'm kind of going back and forth between condingame and code combat. This would be for a science club so I imagine some of them might be interested in other languages aside from Python/JS. Who knows, it's just going to be for an hour or so but I want to spark as much interest as I can. I plan to prepare examples of code being used in other areas of science, so even if they aren't interested in coding itself they can see how it's important to what they're interested in.

    Ideas? Feedback? Please let me know, thanks!

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

    Trouble with learning

    Posted: 26 Feb 2020 10:28 PM PST

    I really love programming and I am doing this for a few years now (I'm 21 y/o), few years of school and had some jobs besides my school. Currently I am studying CS I like it but it is really hard. Some students in my class understands everything really fast while I'm sitting here like what is going on... Is this normal that I have to need a lot more time to understand something than others? What is your opinion about it?

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

    A Student. Don't need help with homework but do need some help.

    Posted: 26 Feb 2020 08:14 PM PST

    Hello,
    I'm a 1st-year student trying to figure out my way through java. I've always been fascinated by the idea that I'll be able to make something from scratch if I learn how to code. I've never actually tried to code before I got in my course, so everything is pretty foreign to me, I thought it would just click in my brain but it hasn't yet and I'm kind of struggling. I've posted on this sub before but people always stopped replying after I say I'm in uni because they think I'm asking for help with individual assignments which is understandable, I should be doing this on my own and I have resources in the uni to help me with these stuff. The problem is I'm not really good at knowing what I need to know or what I should ask to figure out the problem at hand. So talking to the people in help desk bearly helps. I'm also really short on time. every week there's a new chapter and new work. I get the concepts but can't really figure out how to apply it into my code. I'm struggling every day and it's taking a toll on me. So, if you don't mind helping someone out it would be immensely appreciated. Even just direct me to a way would be helpful at this point.

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

    Looking for resources or pointers to understand the Javascript framework as a whole

    Posted: 26 Feb 2020 10:00 PM PST

    Sorry about the title. I am not sure how to exactly describe my problem. I am new to Javascript and try to write a web app. I created 1 js file that is consumed by an html, everything works fine. There are several classes so I decided to separate them into different files to make my code cleaner. That's when my confusion starts. Apparently, I can't use the import keyword if the type is "text/javascript", a quick search points me to use type="module" instead. Then I got a cross-origin error. A few more searches, and words like bagel, webpack, node.js shows up. Look them up, and got a vague idea of what they are but something still doesn't click in me. I guess I can't do these kind of structure with pure html and javascript? and node.js acts as a runtime for the modules? Webpack is the old way of doing imports? Is there any resources that I can look into for better understand how Javascript work as a whole?

    Thanks

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

    Can a beginner rely on android apps?

    Posted: 26 Feb 2020 09:42 PM PST

    Hey guys, Just a quick and random question, I've been using SoloLearn and Programming Hub on Android for about 1.5 months. I'm clearly learning but in general, is it a good way to learn?

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

    struggling with c#

    Posted: 26 Feb 2020 09:27 PM PST

    im new to programming and we are learning c# after just learning some python. We are working in visual studio and i am supposed to write a program that returns how many of each quarters, dimes, etc after the console prompts the user for the total change, this is what i have so far and i can't seem to get the console to appear to prompt the user for input.. any ideas?

    int quarters;

    int dimes;

    int nickels;

    int pennies;

    int totalChange;

    Console.WriteLine("Enter total change: ");

    totalChange = Convert.ToInt32(Console.ReadLine());

    quarters = totalChange / 25;

    dimes = totalChange % 25 / 10;

    nickels = totalChange % 25 % 10 / 5;

    pennies = totalChange % 25 % 10 % 5;

    Console.Write("Quarters: " + quarters);

    Console.Write("Dimes: " + dimes);

    Console.Write("Nickels: " + nickels);

    Console.Write("Pennies: " + pennies);

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

    Istantiation and instances

    Posted: 26 Feb 2020 06:27 PM PST

    Need help understanding instantiation and instance in JAVA.

    So I know that an object can be an instance of a class.

    Can a variable be an instance of a class? Anything that exists in a class just means it's an instance or does it need to be instantiated?

    For objects -

    Is Dog lassie = new Dog(); This is both instantiation and declaration right? so new Dog() is the instantiation?

    For variables

    int x; this is declaration?

    x = 0; this is instantiation?

    int x = 0; is both instantiation and declaration?

    Edit: specified for JAVA language

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

    How to make the mind perform the best?

    Posted: 26 Feb 2020 03:58 PM PST

    Hi guys. Aspiring programmer here. Sometimes I notice I cant concentrate well, I dont see trough the codes as well or see the bigger picture but sometimes I feel like I could write anything. So my question is how do you guys achieve the clear mind state. I drink a few cups of coffee a day and I noticed I cant focus as well anymore.

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

    Calculating the sum of squares in a sequence using recursion?

    Posted: 26 Feb 2020 10:29 PM PST

    Hey so I'm writing a program thats supposed to calculate the sum of squares in a sequence using recursion. I'm writing two functions, one that calculates it going from 1 to N and one that calculates it going from N to 1, and outputting the process. The below code is the function that I wrote for N to 1, but I'm having a lot of trouble with going from 1 to N. I don't know how to properly write out the base case and get to that base case without adding a second argument to the function (the assignment specifies one argument). If anyone could help me out, that'd be awesome!

    Edit: I wrote out a bunch of different attempts at the 1 to N function but ended up scrapping them all when I realized that I had no idea how to do it. I'm expecting it to output something like (1*1) + (2*2) + (3*3) = 14, but I've been either getting (2*2)+(3*3)+(1+1) = 14, no output, or a jumbled mess.

    int SeriesToOne(int n) { if (n == 1) { cout << "(" << 1 << "*" << 1 << ") = "; return 1; } cout << "(" << n << "*" << n << ") + "; return (n * n) + SeriesToOne(n - 1); 
    submitted by /u/rborens
    [link] [comments]

    Do you guys begin over complicating code the longer you work on it without taking breaks?

    Posted: 26 Feb 2020 03:52 PM PST

    I'm new to programming and I have already found that the longer I work on something (debugging usually) without taking a break (and by break, I mean like 24 hours or more), my logic becomes so illogical. When I go back to my code after taking a break from being so exasperated, my code looks like it was written by a crazy person and I'm thinking "what the hell was I doing?" . Usually, I'm able to quickly figure out what was wrong in the first place, fix it, and also simplify my code at the same time.

    To ppl that have been programming, does this still happen to you? As a professional with a 9-5 job, how are you able to consistently keep your mind fresh and not so hyper-focused to the point of irrationality? Does it get better with experience? If not, how are you able to handle it in order to remain productive?

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

    hi

    Posted: 27 Feb 2020 12:56 AM PST

    i would like to learn programming

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

    Determining unknown time stamps

    Posted: 27 Feb 2020 12:54 AM PST

    Hi there,

    This question is partially related to programming eventually so I apologise in advance for if this is the wrong place but I can't figure out where best to put this.

    For background there is an Android application that I am currently writing a program to parse out the information it uses mostly just to further my coding but also as a "fun" little project.

    There is a tool out there that can already parse some of the information from within this application, and it decodes 3 timestamps. The issue I am having is I can't figure out what kind of timestamps these are to start.

    The first timestamp is:

    0xFC 00 00 01 70 1A D1 C2 ED

    The program mentioned that can parse some data shows this as 2020-02-06 14:05:19 (UTC).

    The second is:

    0xFC 00 00 01 6F F5 A9 D2 70

    Again the program mentioned parses this as 2020-01-30 08:55:45 (UTC+0).

    From viewing it the '0xFC 00 00 01' appears to be just a header. Leaving a 10 character hex timestamp...

    I've thrown Decode & MFT Stampede at these in all sorts of combinations yet I can't get the expected results that the other program parses out. Does anyone have any form of idea what kind of timestamps these are?

    submitted by /u/Final-Break
    [link] [comments]

    Reference to parent object in classes/functions JavaScript?

    Posted: 26 Feb 2020 06:53 PM PST

    Hello everyone,

    Currently I am working on a JavaScript game application, and I was having my first shot at JavaScript class syntax, but now I ran into an issue I've dealt with before. There hasn't been any sort of real solution so far, just quick rearrangements and patch-ups. Is it really necessary to sacrifice elegant syntax for an easy solution? I have never been super prominent in clean code, but be that as it may, I am trying to improve. Here is a basic representation of the problem I am dealing with:

    First, I define a JavaScript class foo with some positional arguments and a constructor.

    I also have a parent object attribute; so far so good:

    class foo(){ constructor(x,y,parent){ this.x = x, this.y = y, this.parent = parent; } } 

    Now I also have another class bar that extends from foo, for the sake of accuracy:

    class bar extends foo(){ constructor(x,y,parent){ super(x,y,parent); this.arr = []; } } 

    I add a certain method to this extended class. This is where the problem occurs:

    class bar extends foo(){ constructor(x,y,parent){ super(x,y,parent); this.arr = []; } makemore(){ this.arr.push(new foo(50,227,this.arr)); } } 

    Of course, this is not going to work. I am accessing this.arr, which contains a foo that also has a property containing that array. If I do this, bar contains an array of foos, which all have a property containing bars, which contain a property containing more foos, which all have a property containing bars..... Ad infinitum. This will probably result in something similar to maximumcallstacksizeexceeded . Objects are copied by reference, correct? What could I do to only 'refer' to the parent object from the 'child' and access a property that concerns the child? At the moment, I want foo to be self delete-able. Here is an updated foo class to show what I mean:

    class foo(){ constructor(x,y,parent){ this.x = x, this.y = y, this.parent = parent; } delete(){ this.parent.splice(parent.indexOf(this),1); } } 

    Of course, this is just an example using an array as a parent. Other object types would have different methods. So really, this is the main goal I hope to accomplish is deleting an object from the inside out.

    Any ideas?

    Thanks

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

    Getting InvalidAccountIdInAccountReportScope Error in Bing Ads Api python

    Posted: 27 Feb 2020 12:40 AM PST

    I am developing a python script to get the AccountPerformance report of a Bing Ads Account of a client. I am successfully getting the account id and customer id as per the docs. But i am getting the following error when requesting the report:

    suds.WebFault: Server raised fault: 'Invalid client data. Check the SOAP fault details for more information' 

    When i checked the response i found out that this error is happening due to this:

    <ErrorCode>InvalidAccountIdInAccountReportScope</ErrorCode><Message>The specified account report scope contains an invalid account id, listed in the Details field. Please submit a report request with valid scope and ids.</Message> 

    It will be helpful if someone guide me in this issue.

    Thanks in advance.

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

    So few SQL repos on GitHub?

    Posted: 26 Feb 2020 06:39 PM PST

    I wanted to see what a multiline SQL code file looked like (since most tutorials teach one line commands) so I went on GH and the most popular repo had like 60 stars, which surprised me a little. I understand that SQL is very different from other languages but I'm curious about resources on writing longer SQL files or when it's done in practice. Thanks in advance

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

    C++ How to Fix error Message?

    Posted: 26 Feb 2020 06:38 PM PST

    When I compile ,error pops up:

    :sales.cpp:(.text+0xe6f): undefined reference to `Song::operator<(Song const&) const'k:/g++/bin/../lib/gcc/i686-w64-mingw32/4.8.3/../../../../i686-w64-mingw32/bin/ld.exe: C:\Users\gonza\AppData\Local\Temp\ccKlTke1.o: bad reloc address 0x16 in section `.text$_ZStoRRSt13_Ios_FmtflagsS_[__ZStoRRSt13_Ios_FmtflagsS_]'collect2.exe: error: ld returned 1 exit status

    I commented every line of code line by line and the cause is :

    if (list[j+1] < list[j])

    Located in the sortAscend Function.

    Used a bubble sort for the sortAscend function.

    Link to code:

    https://gist.github.com/sgonz837/8480dade65ecb6d0295a13f7d4e64601

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

    Inserting a linked list into another linked list == None ? (kinda advanced)

    Posted: 26 Feb 2020 06:37 PM PST

    (LL = Linked Lists)

    Hey guys i currently have a LL where i store items. And after wards store that LL into my final LL to create a LL of LL. Issue is that i'm experiencing is that my output results in None. or <__main__.SortedLList object at 0x10e5267b8>

    Was wondering if i could get some assistance

    class shipyard(): def __init__(self): self._LL_pkgs = SortedLList() self._LL_conts = SortedLList() self._container_ID = 1000 self._package_ID = 2000 def add(self,owner,desti,weight): self._container_ID += 1 self._package_ID += 1 pkg = Package(self._package_ID,owner,desti,weight) #linked list of containers cont = Container(self._container_ID, desti,weight) self._LL_pkgs.insert(pkg) self._LL_conts.insert(cont) self._LL_conts.insert(self._LL_pkgs.insert(pkg)) output ID :1001 Destination :edm Weight :100 None package id: 100(2001,go,edm) 

    Instead of the None right under the weight, package (id.....) needs to be there.

    (i'm just printing it when it was in the first LL not the second.

    Any help appreciated thanks!!!!

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

    Possible to build a biz based on an API?

    Posted: 27 Feb 2020 12:34 AM PST

    So I'm building an app using the Spotify API mostly for fun, but let's assume it did turn into something. The app is very exposed to Spotify for the ability to play music for example, and pulling in data, both of which help create its value proposition. I'd like to think that some of these things could be figured out over time via an agreement with Spotify or other music companies, or other routes may pop up as things progress (and it's def early)...still, in the back of my mind, building a product reliant on somebody else's API seems like a huge liability. I'm not sure in the music space in-particular there are many other ways to easily get started. What do you guys think? Have you built using other API's and had things blow up (or go well) over time?

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

    Question(s) about C# and C++

    Posted: 26 Feb 2020 06:36 PM PST

    So, I first started learning C# because a YouTuber made a small little video tutorial series, and that was the language he used. I'm not very far along, I can't do very much with it yet, but so far I really like it, it's interesting and fun.

    However, I have realized and noticed that C++ is a lot more common, and practically any business would want C++ rather than C# as the language. I was mainly wondering if C# is a "valid" language to learn, or just a waste of my time. To me, C# makes sense, because different actions are usually assigned keywords or phrases. For instance, to write something in the console in C#, you write

    Console.WriteLine();

    Whereas in C++, it seems you write:

    std::cout << << std::endl;

    To me, C# has a reason for what you're typing, and it makes sense. You're writing a line in the console, thus WriteLine. But in C++, it's these weird seemingly arbitrary strange strings of text are used in lieu of words or phrases. It just seems a lot harder to learn and remember, to me at least.

    So yeah, my main question is really if I can get anywhere with C#, or if I might as well scrap my knowledge so far and try to start over with C++.

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

    Desperately need help, taking data structures class

    Posted: 27 Feb 2020 12:33 AM PST

    Hey guys I'm taking Data Structures currently and this is one of the hardest courses I've taken so far.

    Everything is in c++ and I absolutely hate c++. In Junior college I was able to get by using Java and python mostly, but c++ has always been a huge pain in the ass for me.

    I've been trying to look up videos and udemy courses (actually taking one rn on c++) to try and help me get up to par and understand how pointers and classes are implemented, but honestly I'm starting to get super depressed about it.

    I really want to do well but I know just watching videos isn't going to help much, and I've tried working on problems but doing simple problems aren't helping that much either.

    anyone have any advice? I'm fucking depressed as fuck and it sucks to say but I sometimes end up crying while studying because I feel so far behind everyone else.

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

    No notification popup in older phones

    Posted: 27 Feb 2020 12:27 AM PST

    Comment: add tags to post

    No notification popup in older phones

    I have function that creates popup notification messages. It works fine on newer phones, but fails on older ones. For example Android version 6 API 23 does not show popup window, but notification exist in notification area.

    How to enable older phone show notification popup like newer phones does

    Notification function code: public void sendNotification(String title, String message) { int NOTIFICATION_ID = 234; NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); String CHANNEL_ID = "my_channel_01"; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { CharSequence name = "my_channel"; String Description = "This is my channel"; int importance = NotificationManager.IMPORTANCE_HIGH; NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, importance); mChannel.setDescription(Description); mChannel.enableLights(true); mChannel.setLightColor(Color.RED); mChannel.enableVibration(true); mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400}); mChannel.setShowBadge(false); notificationManager.createNotificationChannel(mChannel); } NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(title) .setContentText(message); Intent notificationIntent = new Intent(this, MainActivity.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent intent = PendingIntent.getActivity(this, 0, notificationIntent, 0); builder.setContentIntent(intent); 
    submitted by /u/columncolumn
    [link] [comments]

    (Java) stuck trying to loop entire game so it doesn't end after first playthrough, dont know where to put loop.

    Posted: 27 Feb 2020 12:23 AM PST

     //so ive been trying to loop the whole thing so that it doesn't terminate after first playthrough but i cannot figure it out, not sure where to put the while loop. import java.util.Random; import java.util.Scanner; public class hangManGame { public static void main(String[] args) { displayInstructions(); boolean nowPlaying = true; Scanner keyboard = new Scanner(System.in); System.out.println("Would you like to play the game? yes (y) or no (n)..."); String playGame = keyboard.nextLine(); if (playGame.equals("y")) { nowPlaying = true; } else if (playGame.equals("n")) { nowPlaying = false; System.out.println("The game will now terminate..."); break; } else { System.out.println("That is invalid... Would you like to play the game? yes (y) or no (n)..."); keyboard.nextLine(); } if (nowPlaying == true) { String newGameWord = wordPicker(); int length = newGameWord.length(); for (int i = 0; i < length; i++) { System.out.print("_ "); } int currentGuess = 0; final int TOTALGUESSES = 7; while (nowPlaying == true) { System.out.println(); Scanner userInput = new Scanner(System.in); System.out.println("please make your guess... "); String guess = userInput.nextLine(); if (guess.equals(newGameWord)) { System.out.println("WOW, you guessed correctly! With " + currentGuess + " guesses left "); nowPlaying = false; } else if (newGameWord.contains(guess)) { System.out.print(" the word does indeed contain " + guess + "... "); } else { System.out.print(" the word does not contain " + guess + "... "); } currentGuess ++; System.out.println("Guesses left " + (TOTALGUESSES - currentGuess)); if (currentGuess > TOTALGUESSES) { System.out.println("You have run out of guesses!"); nowPlaying = false; } } } } public static String wordPicker() { String[] wordList = {"hammer", "guitar", "computer", "java"}; Random randWord = new Random(); int hangManWord = randWord.nextInt(wordList.length); return wordList[hangManWord]; } public static void displayInstructions() { System.out.println("The name of the game is hangman."); System.out.println("You will have 7 guesses to get the correct letters or correct word for the random word."); System.out.println("If you run out of guesses then you lose."); } } 
    submitted by /u/DAta10019
    [link] [comments]

    No comments:

    Post a Comment