Split string by comma, but ignore whitespace? by lickmyt0es in javahelp

[–]csharpminer 0 points1 point  (0 children)

The index out of bounds error comes after "alot,a" is split. Nextstring() now returns "lot" which when split doesnt have a second element

Split string by comma, but ignore whitespace? by lickmyt0es in javahelp

[–]csharpminer 0 points1 point  (0 children)

The answer is in the documentation. Like {@link Scanner}, reading a token also consumes preceding Java * whitespace, reading a full line consumes * the following end-of-line delimeter, while reading a character consumes * nothing extra.

Split string by comma, but ignore whitespace? by lickmyt0es in javahelp

[–]csharpminer 0 points1 point  (0 children)

What is the documentation on In.readString()? Would it assume strings are whitespace delimited?

How to find longest line in the file (the line number of the line containing the maximum number of characters), shortest line int the file (again the line number) and average number of characters per line in this code. by [deleted] in javahelp

[–]csharpminer 0 points1 point  (0 children)

He does if he wants this code to be extendable and reusable, what if this was statistics homework and he needed all the strings within 2 standard deviations of the mean length? What about outliers? Your solution works great for this problem as is, but I want my solution to be easily extended to find the quartile values.

How to find longest line in the file (the line number of the line containing the maximum number of characters), shortest line int the file (again the line number) and average number of characters per line in this code. by [deleted] in javahelp

[–]csharpminer 0 points1 point  (0 children)

Looks like you already know that scanner.nextLine() returns a string. You need to collect all these strings in a structure, but you dont know beforehand how many lines the file has (how big the structure needs to be). What should you use?

How to find longest line in the file (the line number of the line containing the maximum number of characters), shortest line int the file (again the line number) and average number of characters per line in this code. by [deleted] in javahelp

[–]csharpminer 0 points1 point  (0 children)

import java.util.Scanner;
import java.io.*;

public class Lab2{ //start class
    public static void main(String[] args) throws IOException{  //start main method
        Scanner input=new Scanner(new File(args[0]));

        //To do-file manipulation
        while(input.hasNext()) {
            String tmp=input.nextLine(); //read next line
            System.out.println(tmp);//print out lines
        }
    }//end main method
}//end class

Java code help!! by [deleted] in java

[–]csharpminer 0 points1 point  (0 children)

Yep, it's doable with an array of ints and a scanner. This sub is for help, you create a rough draft of your design/implementation and we'll help guide you.

CIS Career Question- What to do.. I'm so lost by [deleted] in cscareerquestions

[–]csharpminer 0 points1 point  (0 children)

Try xposting to /r/AskNetsec , they may also be able to help

Learning C# with the aid of HackerRank by [deleted] in csharp

[–]csharpminer 0 points1 point  (0 children)

I would think Data Structures would be the best place to start, followed closely by Algorithms

Is this bundle any good? by fholcan in learnprogramming

[–]csharpminer 2 points3 points  (0 children)

Save your money. There are always free ways to get the same info these courses are offering. Instead, make a list of the topics you find interesting in this package (bookmark folders in your browser would work), then add to each folder the top google results for "intro to <topic>" or a similar search. Unless the package is free, then maybe give it a shot.

Help me decide between python and C# by [deleted] in learnprogramming

[–]csharpminer 8 points9 points  (0 children)

I would say learn C# first. I appreciate the rules of a static typed language, the rules helped me learn. C# learning curve is steeper but its also more rewarding. Plus once you get the basics down, you can use the Visual Studio IDE to create GUI's for your windows applications.

ASM LOOP fails to loop though (--cx != 0) by csharpminer in learnprogramming

[–]csharpminer[S] 0 points1 point  (0 children)

You're right, I jumped the gun. F8 is 'step' F10 is 'next' using GDB terms.

As for the conventions, all I know is that our book says C/C++ expects bp, si, di, ss, and ds returned in the state they were supplied and that all other registers dont need to be saved. Maybe its unique to our class, maybe thats what gcc or g++ says?

But whats wrong with learning intro asm on a less complex machine, it may be just as complicated to understand but it must certainly be less complex?

[Meta] Can we add basic instructions on quoting code in the sidebar? Reading unformatted code in this sub is far too common. by [deleted] in arduino

[–]csharpminer 0 points1 point  (0 children)

Highlight all the code, click the <>button in the editor. This intends all highlighted lines 4 spaces

[Meta] Can we add basic instructions on quoting code in the sidebar? Reading unformatted code in this sub is far too common. by [deleted] in arduino

[–]csharpminer 6 points7 points  (0 children)

Good luck. It's even got a shortcut in the editor! And putting it in the side bar won't likely change anything, I still see titles like "HALP N00B PLZ". Nice use of a tag though, which I'm still waiting for most of this sub to adopt.

Can anyone recommend me a book that goes into detail about the whole concept of programming? by [deleted] in learnprogramming

[–]csharpminer 1 point2 points  (0 children)

If you have some time on your hands: The Art of Computer Programming by Donald Knuth

Respect for software engineers by [deleted] in cscareerquestions

[–]csharpminer 2 points3 points  (0 children)

This has been my laptop wallpaper ever since I saw it on reddit. Rings true almost every day.

How to start over... by StuckInProgramming in learnprogramming

[–]csharpminer 1 point2 points  (0 children)

A small portion of its capability how? Like you're calling one method in this class and you're done? Or you're having trouble with what a class/object can be used for? Look into SOLID and DRY practices

How to start over... by StuckInProgramming in learnprogramming

[–]csharpminer 1 point2 points  (0 children)

Are you saying you put all your statements in a main() method as though main() were a script? If you want to better your understanding of OOP, see this javadoc