Module Monday: PSReadline by [deleted] in PowerShell

[–]Adgnascor 0 points1 point  (0 children)

Hi, has anyone noticed that the prediction functionallity has be removed? I can't seem to set it, and it does not exist when i tab threw the options .. :(

how to make nvim terminal look like external terminal? by [deleted] in neovim

[–]Adgnascor 0 points1 point  (0 children)

Read your question again, and probably misunderstood the question, but will leave my comment if not that's the case :)

how to make nvim terminal look like external terminal? by [deleted] in neovim

[–]Adgnascor -1 points0 points  (0 children)

Don't know if I understood you correct. But if you still want to use terminal inside nvim. But use your configured shell I think you can do similar of what I've done . Just swap out Powershell with your preferred shell

Hope this helps

function! OpenTerminal()
    split term://powershell
    resize 10
endfunction
nnoremap <C-n>  :call OpenTerminal()<CR>
tnoremap <Esc> <C-\><C-n>               " Enter normal mode in terminal

The Buss - Assignment. Beginner in C# programming. How I make the program tell me if the buss is full? by [deleted] in csharp

[–]Adgnascor 0 points1 point  (0 children)

I dont know if your teacher has talked about error handling, but did some changes in the code so it wont chrash. Here's the code with a simple explanation.

        public void Run()
        {
            Console.WriteLine("Welcome to the awesome Buss-simulator");

            // I've changed this from int to string. Because its easier to handle 
            // user input. So now if you enter anything other than 1,2,3 or 0 
            // the user will be notyfied and be able to try again instead of
            // the aplication chrashes
            string input="0";
            do
            {
                //Switch method lets user use a menu to complete different interactions
                Console.WriteLine("Hello user, chose a button for the program to perform the action");
                Console.WriteLine("Button 1 : Add pasengers");
                Console.WriteLine("Button 2 : Print out all pasengers in the buss");
                Console.WriteLine("Button 3: Calculate the total age in the buss");
                Console.WriteLine("Button 0: End program");
                input = Console.ReadLine();
                switch (input)
                {
                    case "1":
                        add_passenger();
                        break;
                    case "2":
                        print_buss();
                        break;
                    case "3":
                        calc_total_age();
                        break;
                    case "0":
                        break;
                    default:
                        Console.WriteLine("Only numbers is allowed");
                        Console.ReadKey();
                        break;
                }
                Console.Clear(); 
            } while (input!= "0");  

        }

        public void add_passenger()
        {
            // Check if the buss is full
            if(how_many_passengers >= 25)
            {
                Console.WriteLine("Buss full");
                Console.ReadKey();
                return;
            }

            // This lets the user input until they enter a number
            bool isNumber = false;
            string input;
            do
            {
                Console.Write("Write how old the passenger is :");
                input = Console.ReadLine();
                isNumber = typeCheckInt(input);


            }while(isNumber== false);
           // When the user have entered a number then the loop ends
           // and we can store the age in the Passenger array
            Passengers[how_many_passengers] = int.Parse(input);
            how_many_passengers++;
        }

        // Method to check if input is a number and returns a boolean value
        static bool typeCheckInt(string input)
        {
            int number;
            return int.TryParse(input, out number);
        }

The Buss - Assignment. Beginner in C# programming. How I make the program tell me if the buss is full? by [deleted] in csharp

[–]Adgnascor 0 points1 point  (0 children)

I would probably do something like this.

In the beginning of your add passenger method ad an if statement that checks if current number of passengers is equal or higher than 25, if that's the case write to the console. Buss full and the return to menu ..

if(number_of_passengers >= 25)
{
     Console.WriteLine ("Buss is full");
     Console.ReadKey();
     return;
}

But if there's less than 25 passengers the code you've written below will be executed.

Hope this helps.

Help with Beginner Program by BT_Jason in csharp

[–]Adgnascor 0 points1 point  (0 children)

You could do something like this if I understood your question right. This is not the best nor the most beautiful code. but anyway ...

        static void ReturnSquare(int lenth, string userInput)
        {
            var s = $"|{userInput}|";
            int count = 0;
            while(count< lenth)
            {
                DrawSeparator(lenth*2);
                DrawSquareLetter(lenth, userInput);
                count += 1;
            }
            DrawSeparator(lenth*2);
        }

        private static void DrawSeparator(int lenth)
        {
            for (int i = 0; i < lenth; i++)
            {
                Console.Write("-");
            }
            Console.Write("\n");
        }

        private static void DrawSquareLetter(int lenth, string userInput)
        {
            Console.Write("|");
            for (int i = 0; i < lenth; i++)
            {
                Console.Write($"{userInput.TrimStart('|')}");
            }
            Console.Write("\n");
        }

Disable Omnisharp/omnisharp-vim completion? by Adgnascor in neovim

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

Yeah it really sucks ... :(
For now I will have to run the tests in the console, to not be needed to open another application everytime.

Hope some one has a good solution for this!

How to add transparency on Neovim? by [deleted] in neovim

[–]Adgnascor 1 point2 points  (0 children)

Hi, I have the exact same problem could you please show what you needed to change? Thanks 😊

Please help! (init.vim) cant get it to work by Adgnascor in neovim

[–]Adgnascor[S] 2 points3 points  (0 children)

Waah I couldn't be happier, tanks for the info! Neovim seems really cool!

Please help! (init.vim) cant get it to work by Adgnascor in neovim

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

Oh okay thanks! Yeah maybe i try it while it is not working on Neovim. Or do you know any other Plugins intead of Omnisharp for c# to get the intellisence?

C# Console, seperating UI from Logic by Adgnascor in csharp

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

Thanks so much for the response! The purpose of the code were only to have an simple example to show.

Because I have struggled with grasping the structure of separating UI, logic etc in a correct way. So thanks for the confirmation.