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

# madknight3

Member

1,786

## Reputation Activity

1. madknight3 got a reaction from fizzlesticks in programming "bible"?
I don't think you're going to find a single book to cover what you're interested in, and even if you did, I can't imagine it would cover it all very well. Instead you'll probably want to build that knowledge over time from multiple sources.
2. madknight3 got a reaction from lubblig in Recursive method C#
Get the nth Fibonacci number

Get the ____ in a data structure (array, list, tree, etc)
Where _____ can be sum, product, number of items, max value, etc
Implement a basic mergesort and quicksort

Find the number of correct paths in a maze

Solve a Sudoku puzzle

Any problem in the dynamic programming section of challenge sites.
3. madknight3 got a reaction from lubblig in Recursive method C#
All recursive algorithms can be written iteratively and all iterative algorithms can be written recursively. The point of the simple examples like Fibonacci, factorials, etc isn't to tell you that doing them recursively is better, it's just to give you practice in doing things recursively. Once you know how to write things recursively, then you add another technique to your skill set. You can then choose to use which ever technique makes the most sense for the task at hand. Sometimes one way is easier than the other.
4. madknight3 got a reaction from jslowik in Is Java going to die soon?
Java isn't going away anytime soon. It's still in active development, Java 9 is expected to be released later this year, and it's very widely used across multiple platforms (desktop, web, mobile). It also has a very rich ecosystem (many libraries, tools, learning/support resources, etc). Even if people were to stop using Java for new projects, there will still be a large number of Java applications that will still need to be maintained.

The JVM is also a pretty popular platform to develop on as well. Scala, Groovy, Clojure, Kotlin, etc are all using the JVM.

The speed argument is used for pretty much anything that isn't C/C++ but that doesn't stop people from using other languages. The reality is not every application needs that level of performance and many people would rather work in other languages.
5. madknight3 got a reaction from MisterWhite in Is Java going to die soon?
Java isn't going away anytime soon. It's still in active development, Java 9 is expected to be released later this year, and it's very widely used across multiple platforms (desktop, web, mobile). It also has a very rich ecosystem (many libraries, tools, learning/support resources, etc). Even if people were to stop using Java for new projects, there will still be a large number of Java applications that will still need to be maintained.

The JVM is also a pretty popular platform to develop on as well. Scala, Groovy, Clojure, Kotlin, etc are all using the JVM.

The speed argument is used for pretty much anything that isn't C/C++ but that doesn't stop people from using other languages. The reality is not every application needs that level of performance and many people would rather work in other languages.
6. madknight3 got a reaction from lubblig in C# class function return error
You can throw an exception and have the calling code handle it with a try/catch
public void SetValue (int a, int b) { if (a==1) { throw ...; } //continue with other code }
7. madknight3 got a reaction from Sergio45 in C# Program issue
You don't need to check both a == b and b == a so your if statements can be simplified a little.
if (a == b || a == c || b == c) { // at least two match // ... if (a == b && a == c && b == c) { // all three match } } else { // No matches } Just in case it's not clear, replace a, b and c with fruits[0], fruits[1], and fruits[2] respectively.
8. madknight3 reacted to HPWebcamAble in C# Program issue
Same as
if (a == b && a == c) Transitive property
9. madknight3 got a reaction from Sergio45 in C# Program issue
Damn it, that's what I meant to write. I guess I need to pay better attention. Oh well, good catch.
10. madknight3 got a reaction from Fyfey96 in Java Help Please
Your method isn't returning a value. Add the return statement.
public String simpleMessage(String name){ //this is taking the varible sent from the call method name = name +(" Is a god"); return name; } Note that you can shorten it to
public String simpleMessage(String name) { return name + " Is a god"; // brackets also aren't doing anything so I removed them too }
11. madknight3 got a reaction from Cruorzy in Insecure about coding
Many popular frameworks provide authentication functionality (among other things). Some PHP information on the topic here. You might want to consider going with one of them as it'll likely be more secure than doing everything from scratch yourself. For PHP, Laravel is a popular option these days (source) and I've seen it recommended before so I would probably give that a try first. It certainly doesn't hurt to give the other popular options a try either and see which you like best but that's up to you.
12. madknight3 got a reaction from naza98m in [VB.NET] Remote inventory server?
It sounds like you're going to want to use a database like Sql Server or another popular option (MySQL, PostgreSQL, etc). It can go up on a server and your application can connect to it remotely or get data access through another service (like a web service). Also in case it becomes necessary, SQLite is a nice option for when you need a local database for your app.

If you're new to this stuff you'll want to learn a bit about SQL and database design. You can use the basic ADO.NET library for working with databases in .NET or you can go with a micro/full ORM like Dapper, Entity Framework, etc.

13. madknight3 got a reaction from jslowik in Java might be getting local-variable type inference
Many languages already have local-variable type inference and it looks like Java may finally be getting there too. JEP 286 has the proposal details. There's also a survey you can take to go with it to give them some feedback about the proposal. One thing the survey asks about is the preferred syntax for the feature. Options are
//A: var only (like C#) var lib = getMusicLibrary(); var artists = lib.getArtists(); var personCount = artists.size(); var works = lib.getTracks(); var workCount = works.size(); //B: var/val (like Scala, Kotlin) val lib = getMusicLibrary(); val artists = lib.getArtists(); var personCount = artists.size(); val works = lib.getTracks(); var workCount = works.size(); //C: var/let (like Swift) let lib = getMusicLibrary(); let artists = lib.getArtists(); var personCount = artists.size(); let works = lib.getTracks(); var workCount = works.size(); //D: let only let lib = getMusicLibrary(); let artists = lib.getArtists(); let personCount = artists.size(); let works = lib.getTracks(); let workCount = works.size(); //E: auto only (like C++) auto lib = getMusicLibrary(); auto artists = lib.getArtists(); auto personCount = artists.size(); auto works = lib.getTracks(); auto workCount = works.size();
It's small, and there's still a lot more that can be done to reduce boilerplate, but I expect many people who use Java will support this proposal (and as always, many people will probably hate it for some reason too).
14. madknight3 got a reaction from DKL in Java might be getting local-variable type inference
Many languages already have local-variable type inference and it looks like Java may finally be getting there too. JEP 286 has the proposal details. There's also a survey you can take to go with it to give them some feedback about the proposal. One thing the survey asks about is the preferred syntax for the feature. Options are
//A: var only (like C#) var lib = getMusicLibrary(); var artists = lib.getArtists(); var personCount = artists.size(); var works = lib.getTracks(); var workCount = works.size(); //B: var/val (like Scala, Kotlin) val lib = getMusicLibrary(); val artists = lib.getArtists(); var personCount = artists.size(); val works = lib.getTracks(); var workCount = works.size(); //C: var/let (like Swift) let lib = getMusicLibrary(); let artists = lib.getArtists(); var personCount = artists.size(); let works = lib.getTracks(); var workCount = works.size(); //D: let only let lib = getMusicLibrary(); let artists = lib.getArtists(); let personCount = artists.size(); let works = lib.getTracks(); let workCount = works.size(); //E: auto only (like C++) auto lib = getMusicLibrary(); auto artists = lib.getArtists(); auto personCount = artists.size(); auto works = lib.getTracks(); auto workCount = works.size();
It's small, and there's still a lot more that can be done to reduce boilerplate, but I expect many people who use Java will support this proposal (and as always, many people will probably hate it for some reason too).
15. madknight3 got a reaction from Shoob in Java might be getting local-variable type inference
Many languages already have local-variable type inference and it looks like Java may finally be getting there too. JEP 286 has the proposal details. There's also a survey you can take to go with it to give them some feedback about the proposal. One thing the survey asks about is the preferred syntax for the feature. Options are
//A: var only (like C#) var lib = getMusicLibrary(); var artists = lib.getArtists(); var personCount = artists.size(); var works = lib.getTracks(); var workCount = works.size(); //B: var/val (like Scala, Kotlin) val lib = getMusicLibrary(); val artists = lib.getArtists(); var personCount = artists.size(); val works = lib.getTracks(); var workCount = works.size(); //C: var/let (like Swift) let lib = getMusicLibrary(); let artists = lib.getArtists(); var personCount = artists.size(); let works = lib.getTracks(); var workCount = works.size(); //D: let only let lib = getMusicLibrary(); let artists = lib.getArtists(); let personCount = artists.size(); let works = lib.getTracks(); let workCount = works.size(); //E: auto only (like C++) auto lib = getMusicLibrary(); auto artists = lib.getArtists(); auto personCount = artists.size(); auto works = lib.getTracks(); auto workCount = works.size();
It's small, and there's still a lot more that can be done to reduce boilerplate, but I expect many people who use Java will support this proposal (and as always, many people will probably hate it for some reason too).
16. madknight3 reacted to fizzlesticks in Here we go again...
Ah yes that's a mighty fine lookin problem you've got there.  And I have no idea how to solve it.

But my brute force method got 30% so that's something.
17. madknight3 got a reaction from jslowik in Programming Brevity and Style
The goal isn't the least number of lines. Readability and consistency are bigger factors. Style guides can be useful for keeping everyone in sync so you don't have to worry about these little details. Sometimes reducing the number of lines can help readability, sometimes it can hurt it (complex one liners, etc).

Your example is pretty trivial so I don't think it really matters much although I don't think you gain anything with option 1. I personally prefer option 2. Given how verbose Java can be, I can understand why it might look pretty ugly to one line it. In C#, which is still more verbose than many languages, you get to use var keyword to help shorten things but Java has no such luck.
// Java HashMap<String, String> map = new HashMap<String, String>(); // C# var map = new Dictionary<string, string>(); It's still not too bad when you're looking at it in an editor with syntax highlighting though so I still probably wouldn't break it up across two lines.

If you have a large/complex method where things are declared all over the place, it might be useful to have the declarations grouped together somewhere but chances are you have bigger issues if that's the case.

Stick to a style you like and be consistent. When working with a team it's useful to use a style guide as mentioned above.
18. madknight3 got a reaction from devilirium in Need help with a program
Python should be pretty simple. You have plenty of options to choose from to help you out.
BeautifulSoup Scrapy lxml
19. madknight3 got a reaction from alex_read in Programming Brevity and Style
The goal isn't the least number of lines. Readability and consistency are bigger factors. Style guides can be useful for keeping everyone in sync so you don't have to worry about these little details. Sometimes reducing the number of lines can help readability, sometimes it can hurt it (complex one liners, etc).

Your example is pretty trivial so I don't think it really matters much although I don't think you gain anything with option 1. I personally prefer option 2. Given how verbose Java can be, I can understand why it might look pretty ugly to one line it. In C#, which is still more verbose than many languages, you get to use var keyword to help shorten things but Java has no such luck.
// Java HashMap<String, String> map = new HashMap<String, String>(); // C# var map = new Dictionary<string, string>(); It's still not too bad when you're looking at it in an editor with syntax highlighting though so I still probably wouldn't break it up across two lines.

If you have a large/complex method where things are declared all over the place, it might be useful to have the declarations grouped together somewhere but chances are you have bigger issues if that's the case.

Stick to a style you like and be consistent. When working with a team it's useful to use a style guide as mentioned above.
20.
new is so 1998.
auto m = make_unique<map<string,string>>(); C++ really forces the second style for most stuff since
map<string, string> map; isn't just declaring something.

Though I'm a fan of Python's way of declaring variables

21. madknight3 got a reaction from alex_read in Need help with a program
Python should be pretty simple. You have plenty of options to choose from to help you out.
BeautifulSoup Scrapy lxml
22. 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)
23. 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.
24. 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...
25. 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...
×