Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

madknight3

Member
  • Content Count

    1,786
  • Joined

  • Last visited

Reputation Activity

  1. Agree
    madknight3 got a reaction from jslowik in Best Book to Learn Android Development   
    If this is your first language and you've never done any programming before then you'll probably want to just focus a little on Java first. You don't need to become an expert in Java before you move on, but it'll help to know the basics. You'll be diving into Android before you know it.
     
    Here are some Java resources to get you started.
    Head First Java (book) Java Tutorial for Complete Beginners (video course) More stuff (also includes an Android section)
  2. Agree
    madknight3 got a reaction from MatazaNZ in More C# Help ( YAY! )   
    Create some fields for your class to store the results.
    public partial class form_MulchCalc : Form { private double totalCubitFeet; private double totalCubicYards; private double totalPrice; // ... } Then add the results to these fields each time before displaying them.
  3. Agree
    madknight3 got a reaction from Nineshadow in Need help with making something O(logn)   
    I think he means that because the result can only be a 1 or a 2 then you can just choose one to output every time. Basically, return 1;
     
    edit: After reading the comment over again, I'm assuming you already understood what he meant so now I feel stupid for posting. Oh well, maybe it'll help someone else who doesn't get it... 
  4. Funny
    madknight3 got a reaction from prolemur in Need help with making something O(logn)   
    I think he means that because the result can only be a 1 or a 2 then you can just choose one to output every time. Basically, return 1;
     
    edit: After reading the comment over again, I'm assuming you already understood what he meant so now I feel stupid for posting. Oh well, maybe it'll help someone else who doesn't get it... 
  5. Like
    madknight3 got a reaction from alex_read in Need help with VB project   
    When it comes to string conversions, there's more than just the Convert.To methods as well which you alluded to but I'll explain below.
     
    The Convert.To methods (on strings) are simply adding a null check to the Parse methods.
    // Implementation of Convert.ToInt16 given a string (using dotPeek) // Sorry about the C#. dotPeek doesn't generate any VB code at this time public static short ToInt16(String value) { if (value == null) return 0; return Int16.Parse(value, CultureInfo.CurrentCulture); } public static short ToInt16(String value, IFormatProvider provider) { if (value == null) return 0; return Int16.Parse(value, NumberStyles.Integer, provider); } If this is the functionality you want, then go ahead and use it. If not, you'll want to choose another method. If you know the value can never be null, then just go ahead and use Parse. If you need to know the difference between input that is a valid, like "0", vs a null input, then Convert.To isn't what you want either.
     
    Since both Convert.To and Parse can throw exceptions on invalid input you'll need to handle those exceptions as well. One option is to wrap them in a Try/Catch. This can be useful if you need to handle specific exceptions in different ways, but many times you do the same thing no matter which exception is raised and the TryParse methods are specifically optimized to handle this task.
     
    tl;dr: In many cases you'll probably want to use TryParse over any other string conversion method.
  6. Agree
    madknight3 got a reaction from alex_read in Give me some ideas!   
    For algorithms, there are so many websites that will provide you with more than enough practice. Here's a list of them. There are of course more sites out there that aren't mentioned on the list (like CodeAbbey, Advent Of Code, etc) so feel free to look around for more (not that you'll need more).
     
    As for projects, there was a list of ideas done up on the forum here. Here is another big list of ideas.
     
    Since you're working with C#, and given your experience, you can probably learn the language, the .NET framework, and a UI framework at the same time.
    If you have any interest in web development you can learn the new ASP.NET version (was called ASP.NET 5 and now is being renamed to ASP.NET Core 1.0) or stick to ASP.NET 4.6 and MVC for the more traditional experience. If you want to work on Windows desktop apps you can go with the Windows Presentation Foundation (WPF). If you want to build cross platform apps you can look into the Universal Windows Platform and Xamarin. Or you can stick to the console app if you'd rather just focus on the language and .NET framework alone first.
  7. Informative
    madknight3 got a reaction from fizzlesticks in First N factorial numbers using recursion C   
    Look at your loop. Look at the variable you're passing to fact(). "n" never changes, it's "i" that changes.
  8. Like
    madknight3 reacted to Nineshadow in First N factorial numbers using recursion C   
    Better now?
    int n , factorial = 1; void fact(int i) { factorial*=i; printf("%i ",factorial); if(i<n)fact(i+1); } int main() { scanf("%i",&n); fact(2); }
  9. Agree
    madknight3 got a reaction from Nineshadow in First N factorial numbers using recursion C   
    That's fair. He gave you an example in C++, not C, so if you're not familiar with the C++ syntax I can understand the confusion.
     
    We are telling you how to do it.
     
    I hope that is clear enough for you. You literally only have to change 1 letter.
  10. Informative
    madknight3 got a reaction from D14RAP in Payment Required for Software   
    Go through a merchant company like Paypal, Moneris, etc. Have them store/process the payment info so you don't have to worry about the security/legal issues with it.
  11. Agree
    madknight3 got a reaction from PlutoNZL in Do i need pathfinding for this?   
    Start with recursion.
  12. Informative
    madknight3 got a reaction from MisterWhite in Do i need pathfinding for this?   
    Start with recursion.
  13. Agree
    madknight3 reacted to PlutoNZL in Do i need pathfinding for this?   
    Because your hero can only move right or down, the number of valid paths at any square is equal to the number of valid paths from the square below your hero plus the number of valid paths from the square to the right of your hero.
     
    That is:
    P(x, y) = P(x+1, y) + P(x, y+1)
     
    For example, lets say that we have to below grid of squares:
    @ 6 + + + 4 + + X X + X + + + + + + X + + X + + X + + + + $ And suppose that we know that the square at (1, 0) has 6 valid paths and the square at (0, 1) has 4 valid paths (6 and 4 are completely made up). The hero can either go down one square and have 4 valid paths, or he can go right one square and have 6 valid paths. Therefore, he has 10 valid paths from point (0, 0).
     
    In other words, do what @madknight3 said.
     
  14. Agree
    madknight3 got a reaction from DarkBlade2117 in More C# Help ( YAY! )   
    Create some fields for your class to store the results.
    public partial class form_MulchCalc : Form { private double totalCubitFeet; private double totalCubicYards; private double totalPrice; // ... } Then add the results to these fields each time before displaying them.
  15. Agree
    madknight3 reacted to fizzlesticks in Programming job in while in college?   
    I would love to hear why you think it isn't useful.
  16. Informative
    madknight3 got a reaction from JFischer00 in International question about programming   
    There are so many resources out there for you to continue learning on your own. Books, video courses, written tutorials, official documentation, etc. Also, start working on your own stuff in your free time. You need to practice and apply what you're learning to fully understand it. You can also build up a portfolio of things you've done to show future employers which can go a long way to helping you get a good job when the time comes.
     
    In terms of books, check out Must-reads for Java Developers: From Beginner to Professional. The Java books will give you a deeper understanding of the language along with some general programming knowledge that will apply to other languages. Pretty much everything else teaches you general skills that you can use in many different languages. They are about improving your skills in writing software in general, not in using a specific language so they will introduce you to so many different topics that you probably wouldn't have ever thought about.
     
    Here is a list of more resources that cover multiple languages/topics. Also if you have any interest in Computer Science, check out Open Source Society University. It's a collection of free online courses that cover a variety of CS topics.
     
    Finally, just have fun with it. There's a lot to learn, but you don't have to learn it all at once. No one expects you to either. It's knowledge you'll build over years, not days, so just take it a step at a time. 
  17. Agree
    madknight3 got a reaction from Remixt in Can anyone help me decipher this?   
    Sorry if I'm incorrect but I think it's referring to this. Simple right? Well, I understand if that's also confusing so I'll try to explain it as I understand it.
     
    Lets use an easy example (using pseudocode).
    // Lets assume you're storing a set of boolean values // The set of all boolean values is {False, True} // So the characteristic vector would be vec = [0,0] // and here's your currently empty set set = {} // vec[0] denotes false // vec[1] denotes true // So if you have your own set object and you add false to it. // Then you change the false location to 1 // Now you have set = {false} vec = [1,0] // Now if you add true to your set you have set = {false, true} vec = [1,1] // if you try to add true or false to your set, you know they already exist // because the characteristic vector has a 1 in those spots // Now if you remove false from your set you have set = {true} vec = [0,1]  
    Lets take something a little bigger but still easy.
    // Lets assume you're storing a set of integer values in the range of 1 and 10 inclusive // The set of all values is {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} // So the characteristic vector would be vec = [0,0,0,0,0,0,0,0,0] // vec[0] denotes 1 // vec[1] denotes 2 // etc // and here's your currently empty set set = {} // So if you have your own set object and you add 5 to it. // Then you change the 5th location to 1 // Now you have set = {5} vec = [0,0,0,0,1,0,0,0,0,0] // if you try to add 5 to it again you know it already exists // because the characteristic vector has a 1 in that spot The same concept can be applied to ASCII characters, or anything that can be represented uniquely by a natural number. Hopefully you are getting the idea.
  18. Like
    madknight3 got a reaction from Willjonesneedzhelp in Python and notepad   
    I don't understand what you're asking. Notepad is simply a text editor and doesn't interact with the Python interpreter. It can be used to write python scripts. It can be used to create a file that contains data, which can be read by a python script.
  19. Agree
    madknight3 got a reaction from alex_read in Clear text inside label   
    You can clear it by setting it to the empty string. Here's a few different ways to write it but it all basically does the same thing.
    Textbox1.Text = ""; Textbox2.Text = string.Empty; Textbox3.Text = String.Empty;  
  20. Informative
    madknight3 got a reaction from 8enjicraf2 in Python Help   
    Both are accepted by the interpreter because parentheses are a valid way to group expressions and modify the order things are executed. Putting everything inside one set of parentheses is valid but redundant.
     
    Whether or not someone think it aids code readability is more personal preference than anything. Personally, I don't think it adds any benefit to readability in the above example and would leave them out. This difference of opinion is why programmers in a team are often required to follow coding style guidelines. It helps keep the code more consistent.
     
    Some teachers will give style guidelines but I expect most wont. If the class wasn't informed of style expectations then it seems unfair to have marks taken away for something like the above example (at least on the first offence).
     
    There are certainly many languages that require the parentheses however there are also many languages that don't. Ex: Python, Ruby, Lua, Go, Swift, Rust, VB.NET, F#, Haskell, Elm, Perl (version 6), etc.
     
    I expect it'd be valid code in most of them to use parentheses as well, but it doesn't mean that's how you should write them.
     
    Not in python because its easy it was a language design choice to exclude them.
  21. Agree
    madknight3 got a reaction from Oliver24x in C# Checking if keyboard keys are pressed   
    Stack Overflow - Capture combination key event in a Windows Forms application
  22. Agree
    madknight3 got a reaction from Philosobyte in C# Program Help   
    You need to learn to give yourself starting points. It's very unlikely you'll ever find a book/tutorial that shows you how to make the specific piece of software you're working on. First you need to think about the problem and its requirements, then break it down into smaller pieces. Once you've done that you can then decide on how you tackle those smaller pieces. You can write the program in many different ways depending on how you choose to implement those smaller pieces. 
     
    That way, if you are stuck on a smaller piece, it's much easier to find/ask for information. No longer are you asking general questions like "How do I start making program X", you're asking more specific questions like "One thing that program X needs to do is to store information. I chose to use a plain text file for this but I don't know how to read text files yet. How do I read a text file in C#?". Now that's a simple thing to Google for if you don't know it. Then you move onto the next small piece. Eventually you'll build up a full program that fills all the assignments requirements.
     
    So lets take the Latin translator. Here are some steps that you can break it down to. You can get even more specific if you wish.
    Need a place to enter/store a list of Latin words and their translations. Need a place to store, or a way to retrieve, the mappings between the Latin words and their translations. Need a way to retrieve the translation from a given Latin word. Depends on step 1 and 2 Need a way for the user to select a Latin word to retrieve and display the resulting translation. Depends on application type chosen (Console, WPF, Web, etc), the interface you'll build, and the above steps. etc An example implementation of the above may look like
    Two text files, one for the latin words and one for the translations Load the text files into two arrays so that index 0 of the Latin array maps to index 0 of the translations array. Index 1 maps to index 1, etc. Loop through the Latin array until the word is found. Use the index of that location to retrieve the translation from the translation array. etc This is just one example, and there are other ways to do it. Steps 2 and 3 could be improved by using a Dictionary. Steps 1, 2 and 3 could be changed to use a database and SQL. Everything could be hard coded into the program so nothing interesting is actually happening. etc
  23. Like
    madknight3 got a reaction from DarkBlade2117 in C# Program Help   
    You need to learn to give yourself starting points. It's very unlikely you'll ever find a book/tutorial that shows you how to make the specific piece of software you're working on. First you need to think about the problem and its requirements, then break it down into smaller pieces. Once you've done that you can then decide on how you tackle those smaller pieces. You can write the program in many different ways depending on how you choose to implement those smaller pieces. 
     
    That way, if you are stuck on a smaller piece, it's much easier to find/ask for information. No longer are you asking general questions like "How do I start making program X", you're asking more specific questions like "One thing that program X needs to do is to store information. I chose to use a plain text file for this but I don't know how to read text files yet. How do I read a text file in C#?". Now that's a simple thing to Google for if you don't know it. Then you move onto the next small piece. Eventually you'll build up a full program that fills all the assignments requirements.
     
    So lets take the Latin translator. Here are some steps that you can break it down to. You can get even more specific if you wish.
    Need a place to enter/store a list of Latin words and their translations. Need a place to store, or a way to retrieve, the mappings between the Latin words and their translations. Need a way to retrieve the translation from a given Latin word. Depends on step 1 and 2 Need a way for the user to select a Latin word to retrieve and display the resulting translation. Depends on application type chosen (Console, WPF, Web, etc), the interface you'll build, and the above steps. etc An example implementation of the above may look like
    Two text files, one for the latin words and one for the translations Load the text files into two arrays so that index 0 of the Latin array maps to index 0 of the translations array. Index 1 maps to index 1, etc. Loop through the Latin array until the word is found. Use the index of that location to retrieve the translation from the translation array. etc This is just one example, and there are other ways to do it. Steps 2 and 3 could be improved by using a Dictionary. Steps 1, 2 and 3 could be changed to use a database and SQL. Everything could be hard coded into the program so nothing interesting is actually happening. etc
  24. Informative
    madknight3 got a reaction from alex_read in Switch question   
    First, please use code tags when posting code on the forum.
     
    To answer your question, if you're not allowed to assume that the input is always correct, then you can use a try/catch to handle what happens if a = sc.nextInt(); throws an exception.
  25. Agree
    madknight3 got a reaction from HelplmChoking in What editor are you using right now?   
    I mainly use a mix of the following.
    Visual Studio 2012 Ultimate Visual Studio 2015 Community Linqpad 4 and 5 Visual Studio Code Notepad++
×