Slavi 94 Master Poster Featured Poster

Okay .. so Here we go with my latest essay ...

I got repair disk on my usb and I ran it .. it worked well.

Then when I restarted, it was GRUB the default loader

where I get option to go to Kali or go to Win8

I went to Win8, it took me to easyBCD boot menu .. selected win8, went in made a new entry for easyBCD, restarted.
Once again grub was the first loader to appear, I clicked win8 went to easyBCD configuration, clicked Linux entry, still got my error message there ..

Restarted again using GRUB's menu now chose to go to Kali
It took me to command mode ... I clicked ctrl-alt-f7 to switch to gui mode and screen just went black. Restarted, while loading Kali I got into an error message .. like this so i followed what the guy in the commends said fsck /dev/sda1 and then i got prompted with many things saying that some stuff got corrupted others got changed etc and if i wanted them to be fixed .. I clicked yes ... after a reboot I got into GUI mode and it seems to be working as in I am able to boot into it

Well but now a bit weird that I get grub as default loader, and easyBCD still doesn't detect that grub loader. Not sure if i should just give up at this point as it works or not :D

Slavi 94 Master Poster Featured Poster

.

Slavi 94 Master Poster Featured Poster

Hey Mike,
I have no clue why is it saying ext2, here is gparted configuration, it is ext4 ...
ed3103e54aa269fef4fb24df9e7a088b

Also I am inside Kali now using the super grub, if you want me to show you something let me know, I will read through the guide you linked in a few, thank you

Slavi 94 Master Poster Featured Poster

Thanks Gri, downloading it!

Slavi 94 Master Poster Featured Poster

added repository then this

Kali@Slavi:/home/Kali$ sudo apt-get install -y boot-repair && (boot-repair &)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package boot-repair

But anyway, not sure how would this fix it really if a completely new boot loader didn't work. Also I am kind of thinking that all of this was caused by some of the updates that I did today before the restart, as mentioned on the original post I had about 100 new ones to upgrade maybe that influenced easyBCD and grub2 but I thought making a new grub and then new entry would completely fix it ... I guess I'll give it a try when sourceforge is up.

On the other hand, could that error now be because I am trying it on Kali instead of Ubuntu? Guess could give it a try from LiveUbuntu as well, or maybe install grub from live ubuntu following Mike's steps again?

Slavi 94 Master Poster Featured Poster

Tried sudo grub-install /dev/sda1 --force as Mike proposed, it installed no errors, made new entry still no success(Same error). This now makes no sense to me, should've worked well with a new grub

Slavi 94 Master Poster Featured Poster

Oh, I see ... Thank you
well, sudo grub-mkconfig didnt do it, will try the force now:)

Slavi 94 Master Poster Featured Poster

Still didn't work :p Here is my EasyBCD configuration ..

This is the entries (Usually Windows is not default but deleted the old Linux entry that got broken)
7438ba221ff0ec63ecf5ee2cdf370743

and this is how the Linux one was configured

4452945b0c89a5d453efadc68163ea64

Slavi 94 Master Poster Featured Poster

I haven't done anything to the placement of the harddrive, just restarted my laptop and got the error..

Um, here I tried this and an error

Kali@Slavi:/home/Kali$ sudo grub-install '(hd0,0)'
/usr/sbin/grub-setup: error: no such partition.

then I tried also

Kali@Slavi:/home/Kali$ sudo grub-install --root-directory=/mnt/ /dev/sda1
/usr/sbin/grub-setup: warn: Attempting to install GRUB to a partitionless disk or to a partition.  This is a BAD idea..
/usr/sbin/grub-setup: warn: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.

Now tried this and will go to Windows make new entry and see if it works

Kali@Slavi:/home/Kali$ sudo grub-mkconfig
Generating grub.cfg ...
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root fef413f9-48f6-46fc-a0c4-861f65478662
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos1)'
  search --no-floppy --fs-uuid --set=root fef413f9-48f6-46fc-a0c4-861f65478662
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN …
Slavi 94 Master Poster Featured Poster

Tried using grub legacy, didn't work either. But I can still get into my Kali using super grub disk. Not sure what to do now, perhaps get my live Ubuntu and install grub, perhaps new installation might help easyBCD to connect to it?

Slavi 94 Master Poster Featured Poster

I tried upgrade and it went fine, went back to Windows deleted the boot entry of Linux, then made a new Linux boot entry for using Grub2, tried to boot in same error. Just plugged in the drive again to see what it finds and I get This , it says grub has the entries not grub2, so i am wondering whether the Linux entry in easyBCD has to be grub legacy instead?

Slavi 94 Master Poster Featured Poster

fdisk -l gave me this, I am thinking wouldn't grub-install '(hd0,0)' be equavalent to udo grub-install --root-directory=/mnt/ /dev/sda1? Only asking because I gave away my live Ubuntu, would be easier if executed from inside Kali

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   716802047   358400000   83  Linux
/dev/sda2   *   716802048  1230469119   256833536    7  HPFS/NTFS/exFAT
/dev/sda3      1230471166  1250263039     9895937    5  Extended
Partition 3 does not start on physical sector boundary.
/dev/sda5      1230471168  1250263039     9895936   82  Linux swap / Solaris

EDIT: Sorry didn't see your previous post, will try upgrade-grub2 first :) thank you 1 sec trying it :p

Slavi 94 Master Poster Featured Poster

Hey Mike!
I actually looked into that super grub disk, I actually got into my Kali with it! I could probably just execute those commands from inside my Kali to create new grub yes?

Slavi 94 Master Poster Featured Poster

There was a pop up system needs to restart, do now or do later, had to enter password to restart as well(Did now).

It is using grub2 yes, what other information would you want me to provide? I did software update today as well had to install around 100 packages so all should've been up to date. Kind of seems the same problem as that one that grub has been overwritten or something. The usual case is upon start up EasyBCD provices me with the 2 boot options, if I choose Linux it takes me to grub boot leader, if I choose windows takes me straight to it

In that thread they are using super grub disk and try to boot in it with that one, easyBCD still detects the Linux partition (On windows currently) and I can make more entries of it in the boot loader but I tried and all result in the same error

Slavi 94 Master Poster Featured Poster

Hey guys,
I just installed skype on my Kali, and after installation I restarted the computer because it is 64bit, and the installation was multiArch, so I had to fix dependancies, followed this guide Click Here. After restart, I can't back on ... all I see is the bootloader EasyBCD coming with entries 1. Linux 2.Windows 8.1 , and if I select Linux, all i can see on my screen is Try (hd0,0) ext2. Completely stuck on this can't get back in now ... any ideas?

Edit: This i found that the problem was solved under fedora, but not sure if the commands on debian would be the same, anyone knows?

Slavi 94 Master Poster Featured Poster

Hey James,
I didn't know about that! Sounds pretty good, will have a look at it myself!

Slavi 94 Master Poster Featured Poster

This is for buttons but I did implement it before and it works pretty good

Slavi 94 Master Poster Featured Poster

Can you show us your currect full code?

Slavi 94 Master Poster Featured Poster

By move validing you mean this method?

bool ticTacToe::checkmove()
{
}
Slavi 94 Master Poster Featured Poster

Oh wait, why are you using && operator? i cannot be 2 and 9 at the same time ... did you mean ||?

#include <iostream>
using namespace std;
int main()
{
    int i;
    for (i = 1; i <= 12; i++)
    {
        if ((i == 2) || (i == 9)){
            cout << " \n";
        }
        else {
            cout << i << '\n';
        }
    }
    return 0;
}
Slavi 94 Master Poster Featured Poster

cout << " \n"; doesn't include it because it's printing only an empty line on that statement?

Slavi 94 Master Poster Featured Poster

and python section too^

Slavi 94 Master Poster Featured Poster

Tea and nuts xD

Slavi 94 Master Poster Featured Poster

Nope, let's take a look at it

For(int i = 0; i<AnyVariableOfYourChoice; i++)
basically says, for the integer i which is 0, as long as i is less than AnyVariableOfYourChoice, increment i by 1 after the code inside the loop has executed

So in your case it would be

for(int i=0; i<sum; i++)
     {
      System.out.println("Sum is " + sum);
     }

so you create a variable i and set it to 0, lets say your sum is 5. It checks the condition is i<sum? yes it is, so the code inside the loop executes, where it prints the sum and at the end after all the code inside the loop has been executed, it increases the value of i. Then for the next iteration i is 1 and it checks again and so on ... At the point when i is 5, the loop won't execute, however it will have executed 5 times already since i starts at 0

Slavi 94 Master Poster Featured Poster

This is a guide of how loops work with examples by Oracle Click Here

Slavi 94 Master Poster Featured Poster

At Action as you want it to change the image only after a button that holds one is pressed, but I think an approach of getting which button was pressed could be using the event object that you are passing, if I recall(been using JavaFX over swing for awhile) it was someting like
event.getSource().setIcon(image); //as the source of the event is a button

Slavi 94 Master Poster Featured Poster

The problem that you need to solve now is how do you know which button to set the Icon of :)

Slavi 94 Master Poster Featured Poster

Okay, i just saw what James replied to your previous post, is this what you want:

If sum is 5 it will print

Sum is 5
Sum is 5
Sum is 5
Sum is 5
Sum is 5

If this is what you want, use loop as he said on your other thread, for loop will do it

Slavi 94 Master Poster Featured Poster

You do not want to create a new button when you hit a mine but use the button at position(row,col) to set it's icon as James has shown earlier button.setIcon(icon)

Also, check whether your method containsMinesAt(row,col) actually works by printing out some string to the terminal if a mine is found at that button, unless you have done it already ;)

Slavi 94 Master Poster Featured Poster

I am confused, do you have 2 variables called sum? One decleared globally and one that is a parameter of a method? Maybe show the entire code or give more explanation

Slavi 94 Master Poster Featured Poster

What James said but I think you need to do it inside actionPerformed, so that is actually happening when a button is pressed not as a default image

JamesCherrill commented: Yes, that's what I intended +15
Slavi 94 Master Poster Featured Poster

so if you print out the content of the arraylist now you get the numbers that are in the file?

Slavi 94 Master Poster Featured Poster

The print that we are doing there is just to check whether values were read from the file and added to the arraylist ...

fix your catch statement as this:

catch (FileNotFoundException e) {
             e.printStackTrace();
         }

and then this ..

 while(input.hasNextDouble())  {
              double value = input.nextDouble();
              System.out.println("Inside while with a value of "+ value);
              weight.add(value);
          } 

so that we can see whether your file is being read or not ...
not sure why it would give you an error if the file path is with /

Slavi 94 Master Poster Featured Poster

/ and // worked no problem

Slavi 94 Master Poster Featured Poster

I just tried this, works like a charm for me

public class Test {
    static Scanner input;
    static ArrayList<Double> weight = new ArrayList<Double>();
    public static void main(String[] args){  
        try { 
          input  =  new Scanner(new FileInputStream ("C://Users//Slavi//workspace//Tests//src//DeleteMe//file.txt"));                                           
          while(input.hasNextDouble())  {                                                  
              weight.add(input.nextDouble());
          } 
         }catch (FileNotFoundException e) {
             e.printStackTrace();
         }
        for (int i = 0; i < weight.size(); i++) {
             System.out.println( weight.get(i).toString());
        } 
    }
}

the output was

2.2
3.3
4.4
Slavi 94 Master Poster Featured Poster

It was inside the catch statement, you enter it if you get an exception, but you moved it out ...
did you change \\ with // in your path ...?

Slavi 94 Master Poster Featured Poster

try
System.out.println(input.nextDouble());
right after the while loop

oh and change \\ to //

Slavi 94 Master Poster Featured Poster

Oh, and I believe if you are running on windows machine, your path should be
// not \\

Slavi 94 Master Poster Featured Poster

Your for loop is in the wrong place, it is inside the catch statement, move it after and try again

EDIT: Well, this is what james said as well but didn't see his reply as I had the thread opened b4 that :(

Slavi 94 Master Poster Featured Poster

What are you trying to do ..?
I think what you want to do is place the if statement inside the for loop ..

Slavi 94 Master Poster Featured Poster

Yep
how do you read the file?

Slavi 94 Master Poster Featured Poster

well, try to print the array and see if it's empty

Slavi 94 Master Poster Featured Poster

He is trying to say that your loop may not execute even once, in such case your print out will be printing out 0/0. Maybe print just count and see if it ever increases to begin with?

Slavi 94 Master Poster Featured Poster

Pretty much what james said but
if round is an integer and that's what keeps count of the rounds, increasing it should work

Slavi 94 Master Poster Featured Poster

I had a course on android couple of years ago, the project was to create a hangman. It starts with a nice splash screen few animations, then you are taken to the main menu where you can select Play, Settings, Help etc, if you click Play, well you play the game. I think if you go for this one, you will learn quite a bit of how to use the things you've read about. If you are interested I guess I could get into more detail of how it was implemented(from what I remember)

Slavi 94 Master Poster Featured Poster

what is 8 puzzle program?

Slavi 94 Master Poster Featured Poster

Try checking what's the size of your numArray and show stacktrace as stultuske alrdy asked for

Slavi 94 Master Poster Featured Poster

if you have a gui you don't need to use a while, as long as the gui is opened, it will execute the proper method upon user interaction

Slavi 94 Master Poster Featured Poster

Look at this

It says ArrayList method set(int, element), the way you have it now is set(element, int)

Slavi 94 Master Poster Featured Poster

He pm'd that he thinks isValidText doesn't work, I tried this, works good for me

public class Test{

public static void main(String[] args){
    String s = "Ø";
    byte[] b = s.getBytes();
    System.out.println(isValidText(b));
}


public static boolean isValidText (byte[] test)
        {
            if (test[0] > 0 && test[0] < 127)
            {
                System.out.println (test);
                return true;
            }
            System.out.println ("Hey this false" + test);
            return false;
        }

}

result was

Hey this false[B@1db9742
false