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. Like
    madknight3 got a reaction from bcredeur97 in Python Question   
    This is why most programmers have a good editor. Linters catch these kinds of things for you so you don't have to waste your time on simple typos you missed.
     
    For example using PyCharm, it puts an indicator at the end of that line with the message ',' or ')' expected
     

  2. Agree
    madknight3 got a reaction from alex_read in Visual Basic: "Yay", "Nay" or "Blech!!!"?   
    I have to work with Visual Basic .NET on a daily basis and it isn't that bad of a language to work with. The syntax is a bit too verbose for my liking but you get used to it (I'm sure some people out there even like it). I can understand why some beginner classes pick it for their language. I consider C# to be a better option these days for .NET development though. Without getting into language differences, C# is simply more popular and more of a priority for Microsoft and other developers. Many tools/platforms support C# exclusively (or at least better than VB).
     
    When it comes to performance, for many applications the performance of VB should be just fine. You wouldn't want to use VB for performance critical tasks, but then you probably wouldn't be using C#, Python, Java, or a number of languages for it either. When you need performance you generally go with C, C++, or something like that. It's certainly possible that improving your code would increase performance but you may also be able to improve performance through the compiler settings. Compiling in release mode with optimizations enabled might help if you've only been using debug mode. You could also try native compilation.
     
    The Visual Studio IDE is generally considered to be a really good IDE for Windows. I don't know what version you're using but usually it's best to stick with the current version unless you have a reason not to (like you're working on a project from an older version that you can't upgrade). If you have to work with multiple versions, then you can install multiple versions side by side. I have both VS 2012 and VS 2015 on my computer at the moment and used to have some older versions installed too. It's certainly not ideal but it's never caused me any issues either.
     
    I can't speak to what it's like to develop in C++ with Visual Studio and Microsoft's compiler. Whenever I use C++ I use a text editor or the CLion IDE with g++ as my compiler.
  3. Agree
    madknight3 got a reaction from lubblig in Visual Basic: "Yay", "Nay" or "Blech!!!"?   
    I have to work with Visual Basic .NET on a daily basis and it isn't that bad of a language to work with. The syntax is a bit too verbose for my liking but you get used to it (I'm sure some people out there even like it). I can understand why some beginner classes pick it for their language. I consider C# to be a better option these days for .NET development though. Without getting into language differences, C# is simply more popular and more of a priority for Microsoft and other developers. Many tools/platforms support C# exclusively (or at least better than VB).
     
    When it comes to performance, for many applications the performance of VB should be just fine. You wouldn't want to use VB for performance critical tasks, but then you probably wouldn't be using C#, Python, Java, or a number of languages for it either. When you need performance you generally go with C, C++, or something like that. It's certainly possible that improving your code would increase performance but you may also be able to improve performance through the compiler settings. Compiling in release mode with optimizations enabled might help if you've only been using debug mode. You could also try native compilation.
     
    The Visual Studio IDE is generally considered to be a really good IDE for Windows. I don't know what version you're using but usually it's best to stick with the current version unless you have a reason not to (like you're working on a project from an older version that you can't upgrade). If you have to work with multiple versions, then you can install multiple versions side by side. I have both VS 2012 and VS 2015 on my computer at the moment and used to have some older versions installed too. It's certainly not ideal but it's never caused me any issues either.
     
    I can't speak to what it's like to develop in C++ with Visual Studio and Microsoft's compiler. Whenever I use C++ I use a text editor or the CLion IDE with g++ as my compiler.
  4. Agree
    madknight3 got a reaction from alex_read in Visual Basic: "Yay", "Nay" or "Blech!!!"?   
    Part of your problem is that you're using WinForms which is very inefficient at rendering controls. WPF is a better UI framework and is much more efficient so if you ever have the chance to use it over WinForms then I would take it.
     
    Anyway, I'll continue on with suggestions for WinForms in case you can't switch. One option for improving performance is to limit how many times the form/controls need to render for a given action. You can visually see how many rendering calls are made by adding in the following methods to Form1, setting breakpoints in them, and going through the programs execution in debug mode.
    Protected Overrides Sub OnPaint(e As PaintEventArgs) MyBase.OnPaint(e) End Sub Protected Overrides Sub OnPaintBackground(e As PaintEventArgs) MyBase.OnPaintBackground(e) End Sub Every time something changes, like the visibility of a control, either OnPaint or OnPaintBackground (or both) will fire. This is why you see the flickering when you're in a game and click the menu button. All those control changes make a lot of paint calls.
     
    One way to reduce that is to group items inside a panel. For example you could have all the game items reside in a single panel. Then you switch the visibility of the panel(s) on and off and reset the state of the other controls when the panel is hidden. This way, there doesn't need to be any calls to the paint events for each control inside the panel.
     
    Example
    Function menu_state() As Single ' First set the panel visibility to False GamePanel.Visible = False ' Now since nothing is displayed on screen, set everything else 'Makes the instructions invisible Instructions.Visible = False 'Makes the display text and value for score invisible Label_Score_Number.Visible = False Label_Score_Text.Visible = False ' etc End Function Function game_state() As Single ' Set everything before displaying panel 'Makes the instructions invisible Instructions.Visible = False 'Makes the display text and value for score visible Label_Score_Number.Visible = True Label_Score_Text.Visible = True ' etc ' Now set the panel at the end of the function GamePanel.Visible = True End Function You should notice a performance improvement and much less flickering with this simple change.
     
    Another thing to comment about is that as the application grows, the form designer gets very cluttered and hard to work with. Your application form is already pretty cluttered with your game controls over your menu controls and what not. So you should also split the UI up across multiple files like with other forms or custom user controls.
  5. 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.
  6. Like
    madknight3 got a reaction from SSL in Triple Level text encryptor/decryptor   
    I've always read that the protected data should still be secure even if the attacker knows the method of encryption being used. Basically, don't rely on security through obscurity. It probably doesn't hurt as an extra layer on top of proper security practices, but it shouldn't be what you rely on to keep things safe.
    With that said, it's a common practice to repeat an algorithm multiple times when hashing data (like passwords).
  7. Informative
    madknight3 got a reaction from alex_read in Visual Basic: "Yay", "Nay" or "Blech!!!"?   
    To go along with my above post, here's a couple other things I wanted to mention about your code.
     
    If you're using Function, it should return a value. If you don't need the method to return a value (think of a void function from other languages) you should be using Sub instead.
    Public Function MyFunc() As Single ' Do some stuff Return 1.5 ' or whatever End Function Public Sub MySub() ' Do some stuff ' Doesn't return a value End Sub When it comes to logic, you should be aware of the difference between And/AndAlso and Or/OrElse. Usually you'll want to use AndAlso over And, and OrElse over Or. AndAlso and OrElse will only continue evaluation of the other conditions if it needs to. This is known as short circuit evaluation. Example
    If Instructions.Visible = False And instructionsAvailable = True Then ' ... End If ' The above code will check if Instructions.Visible is false and then check if instructionsAvailable is True. ' However because And will only run the code if both conditions are True, we only need to check the second condition ' if the first condition is True. If the first condition is False, then the result of the expression will be false no ' matter what the second condition is. If Instructions.Visible = False AndAlso instructionsAvailable = True Then ' ... End If ' Now the above code will only check the second condition if the first condition is True. ' In this specific example it doesn't seem important, but in many cases you'll be doing something like If something IsNot Nothing AndAlso something.Func() = "whatever" Then ' Do something End If ' In this case, if you used And instead of AndAlso, the second condition would throw an exception. ' OrElse is the opposite. If one of the conditions are true, then it can stop checking the other conditions. Also, when you're using the Boolean type, you don't need to explicitly state equality. Example
    If Instructions.Visible = True Then ' the above can be simplified to If Instructions.Visible Then ' and the following If Instructions.Visible = False Then ' can be simplified to If Not Instructions.Visible Then I would also recommend turning Option Strict On for any VB projects you work on. This setting can be found in the compile tab of your projects properties. With Option Strict Off, VB will do a lot of things for you at compile time (like type conversion). As a beginner, I think it's more valuable to know how to do these things yourself as. Once you get more experienced, it's your choice to have it on or off. Personally I still like to have Option Strict On to get more help from the compiler. In your code, turning Option Strict On will make you change a few small things. You may also want to treat all warnings as errors as well for the same reason. This setting is also found in the compile tab of your projects properties.
     
    Finally, the last thing I wanted to mention is your use of Console.WriteLine in the GUI app. If you're only using it to help you debug your program, consider using Debug.Print instead. Debug.Print statements only execute when running the application in Debug mode. This way, when you run your code in Release mode, you don't have the extra Console.WriteLine calls being executed when no one is going to see them anyway.
     
    That should be plenty of information to process for now. If you have any questions about what I've written, you can send me a message or post here and I can help further.
  8. Agree
    madknight3 got a reaction from fizzlesticks in Can I get some advice on a new programming language   
    You just have to take it for what it is, an introduction showing you some syntax and language features. It's no different than using Codecademy to get your feet wet and then moving on to some better material later. It's not my first choice, but plenty of people start out that way.
  9. Like
    madknight3 got a reaction from LukeTim in A request for Database design advice   
    When it comes to the User table, you may need something for password resets (like another table or some extra columns). Temporary password/reset token, expiry date, or whatever you need for however you implement it. You may choose to also record if an email is verified or not.
     
    I'm not very familiar with horse racing/betting so it's hard for me to make any suggestions in that domain. Any use in keeping track of the riders info (if possible)?
  10. Informative
    madknight3 got a reaction from Arcapse in VB Tie System?   
    What you have looks like it will work. You just need to finish the else block in sub 2 with another loop
    draw = false Sub 1: For counter = 1 to 5 If score(counter) > winnerscore Then winnerscore = score(counter) location = counter Else If score(counter) = winnerscore Then draw = true Else End If Next Sub 2: If draw = false Then lstoutput.items.add("The winner was " & name(location) & " with a score of " & winnerscore) Else if draw = true Then lstoutput.items.add("There was a tie. The winners with a score of " & winnerscore & " are:") For counter = 1 to 5 If score(counter) = winnerscore Then lstoutput.items.add(name(counter)) End If Next End If edit: Also, just a couple notes
    If draw = False Then ' is equivalent to If Not draw Then ' and If draw = True Then ' is equivalent to If draw Then You don't have to do the equality check for the Boolean type. You also don't need an empty else block (like in Sub 1) if you aren't doing anything with it.
     
  11. Agree
    madknight3 got a reaction from alex_read in Building a webstore - what exactly do I need.   
    Sounds like you have your languages figured out. I would recommend starting with ASP.NET MVC over Web Forms as it's a better technology.
    You could even start with the latest version of ASP.NET (currently in release candidate). It's a big revamp of the ASP.NET platform as it goes cross platform (although there will be overlap with the older version). Until recently it was called ASP.NET 5 but it's now being called ASP.NET Core 1.0. Just wanted to mention in case you are looking for information on it. A lot of information/tutorials will still be under the old name.
    So to summarize, the latest versions are
    ASP.NET 4.6 with MVC 5 ASP.NET Core 1.0 with MVC 6
  12. Agree
    madknight3 got a reaction from ColdDigital in Python Not Operator   
    It helps to understand operator precedence (link to the Python docs).
    Let's apply operator precedence to one of the questions
    bool_two = not 3**4 < 4**3 So according to the order of operations, exponentiation is applied first.
    bool_two = not 81 < 64 So we only have two operations left. The less than, and the not. The less than operator gets applied next.
    bool_two = not False And finally the not operator is applied.
    bool_two = True  
  13. Agree
    madknight3 got a reaction from spenser_l in doing html web programming in high school   
    Sounds like you should start from the basics to get a better understanding of things.
    So What Does a Web Developer Actually Do? Introduction to the Front End HTML & CSS 101  
  14. Agree
    madknight3 got a reaction from Philosobyte in Learning Java   
    Codecademy is likely too basic for you at this point. Have a look at Must-reads for Java Developers: From Beginner to Professional
  15. Agree
    madknight3 got a reaction from alex_read in Multiple Programming Languages   
    It's very common to learn multiple languages, then only actually use some of them for a long time. You'll likely continue getting better with those specific languages, as well as many general programming concepts, however you're going to get rusty in the languages you don't use. How fast you'll be able to shake off that rust can vary based on your previous experiences. In many cases you're merely just refreshing your memory on the syntax and libraries, and perhaps the "language x" way of doing things.
  16. Agree
    madknight3 got a reaction from irazorx1 in Practical Learning Resource for Programming   
    This site seems decent but it feels a little lacking when compared to other similar sites. There's not a lot of challenges available for every language and they don't all have the same amount. Here are the number of problems for some languages.
    Python - 55 C++ - 34 Java - 36 Go - 72 Haskell - 70 F# - 34 OCaml - 19 It would be nice to be allowed to submit through their website since all you're doing is submitting a single code file. Currently you only have their command line tool (which works fine and some people may prefer anyway). It would also be nice to see tests run against submitted code but at least they give you some test cases to run yourself.
    Still, if you're into these kinds of sites, it's another one you can add to your list.
  17. Informative
    madknight3 got a reaction from alex_read in Learning Java   
    Codecademy is likely too basic for you at this point. Have a look at Must-reads for Java Developers: From Beginner to Professional
  18. Like
    madknight3 got a reaction from CGameDev in Triple Level text encryptor/decryptor   
    I've always read that the protected data should still be secure even if the attacker knows the method of encryption being used. Basically, don't rely on security through obscurity. It probably doesn't hurt as an extra layer on top of proper security practices, but it shouldn't be what you rely on to keep things safe.
    With that said, it's a common practice to repeat an algorithm multiple times when hashing data (like passwords).
  19. Like
    madknight3 got a reaction from vanished in Triple Level text encryptor/decryptor   
    I've always read that the protected data should still be secure even if the attacker knows the method of encryption being used. Basically, don't rely on security through obscurity. It probably doesn't hurt as an extra layer on top of proper security practices, but it shouldn't be what you rely on to keep things safe.
    With that said, it's a common practice to repeat an algorithm multiple times when hashing data (like passwords).
  20. Like
    madknight3 got a reaction from alex_read in How do learn proper programming not web design?   
    You could. You could also go with C++, Java, C#, Python, Ruby, or any number of languages and be just fine too. There's no one best language to start with as should be obvious by the various recommendations. Dynamic languages, like Python and Ruby, are typically considered easier for beginners to learn than static languages, like the others mentioned above.
     
    Here are some resources for a variety of languages.
  21. Like
    madknight3 got a reaction from Ryokeen in Just Starting to Learn JS -- Looking for Solid Online Resources!   
    Sounds like you should just focus on getting through the FCC material, especially if your mentor has anything to do with you getting the job you mention.
     
    I believe you only need to actually complete the following four sections for the Front End Dev Cert*
    Basic Front End Development Projects Intermediate Front End Development Projects Beginner Algorithm Scripting Intermediate Algorithm Scripting * might want to double check I'm right
     
    The above projects sections have you building websites and the above scripting sections have you solving code challenges. They are there to help you apply your knowledge. These sections can be very challenging and time consuming for some people.
     
    Most of the other lessons on FCC are just there to teach you, by example, the different topics (HTML, CSS, JavaScript, Bootstrap, jQuery, etc). I can understand if their style isn't your preferred way of learning these topics. I don't see why you couldn't use other resources as well. You'll certainly need to go elsewhere for the Elm/Elixir/Phoenix stuff since FCC doesn't teach them.
  22. Like
    madknight3 got a reaction from PaincakesX in Quick Java Help.   
    Store the result in a variable and add 8 to the variable each time you roll an even number?
  23. Like
    madknight3 got a reaction from as96 in Adventure log of a lazy programmer!   
    Not lazy enough, needs more Haskell
  24. Like
    madknight3 got a reaction from trag1c in Help me with my project in C++   
    Come on now, it's your homework, not ours. We can help but we're not here to finish it for you. How about you start by telling us what requirement you're currently working on and what about it is giving you trouble.
     
    Also, please use code tags. You can add them in by using the <> icon above where you type your posts, or with your text like so
    [code]Code goes here[/code]
  25. Like
    madknight3 got a reaction from Nuluvius in Help me with my project in C++   
    Come on now, it's your homework, not ours. We can help but we're not here to finish it for you. How about you start by telling us what requirement you're currently working on and what about it is giving you trouble.
     
    Also, please use code tags. You can add them in by using the <> icon above where you type your posts, or with your text like so
    [code]Code goes here[/code]
×