Java code to generate sudoku puzzle

Java code to generate sudoku puzzle

Amazing post from a dear friend 🙂

Coder's Caffeine

Hi, I am going to explain to you how to make a sudoku puzzle generator in java. The algorithm followed by me is taken from Sudoku Algorithm. Though I will be explaining the code in detail it would be better if you read and understand the algorithm from the above-mentioned site.

Generating a valid: For a 9×9 grid to be a valid Sudoku grid, the following 3 requirements should be fulfilled:

  1. for each row: every number from 1 to 9 should occur exactly once
  2. for each column: every number from 1 to 9 should occur exactly once
  3. for each 3×3 square with a thicker border (there are 9 of them): every number from 1 to 9 should occur exactly once.
 public static void generate() { int k=1,n=1; for(int i=0;i<9;i++) { k=n; for(int j=0;j<9;j++) { if(k<=9){ a[i][j]=k; k++; }else{ k=1; a[i][j]=k; k++; } } n=k+3; if(k==10) n=4; if(n>9) n=(n%9)+1…

View original post 537 more words

What it takes to dual boot a Mac?

What it takes to dual boot a Mac?

“It’s high time, I need to dual boot my mac.”, that was a feeling when I heard about docker. Well, no doubt you can run docker on Mac but that is a clumsy step and it increases layer of virtualisation.
Well, without getting distracted lets talking about what it takes to dual boot your Mac.

First and foremost you need the strength to move away from voluptuous Mac OS X, hands down it’s the most beautiful operating system I have ever seen and Jobs’ creativity you can feel it while operating on one.

Second you need the courage to accept that there are things that might go wrong , Murphy’s law is something you need to be aware of  but having said that if you don’y break it , you will never know how to make it. There are things that might go wrong but there are less things that cannot be made right. In my opinion one should never be afraid of experimenting with technology specially computers because I feel it’s that sense of curiosity that helps you to grow, not only as a tech
enthusiast but also as a person.

Now, coming back to the topic you need  a boot manager in my case its rEFInd, boot manager is a tool to help you to manage booting into multiple operating system on you machine.Once you download rEFInd  and run the shell script install.sh there is nothing much to do in it. Yeah, don’t forget to restart your system.

Now, in my case I made a bootable pen drive but somehow my machine was not able to recognise it, lucky enough to have a optical drive , I went back to old school live booting. Oh yeah before all that don’t forget to go in disk utility and partition your hard disk and remember to set the format as “free”.

Final steps now, Live Boot ubuntu from the disk and now go for installation ,when installation menu appears select “something else” . Here you can see your partition , just make swap follow the normal convention swap= 2*RAM. Details steps can be found here:
https://linuxnorth.wordpress.com/manual-partitioning

After waiting for a while and hoping that everything should work fine.You will be lucky enough to see Tux beside Apple. Heads up for issues you might face but every issue has already been resolved so CRAWL wisely.

Steps to Dual Boot Mac:

Step 1: Download rEFInd and run install.sh and restart your machine

Step 2: Command + Space bar  and type disk utility, Now in disk utility go to your main disk and in sub-menu go to partition. Make the partition as per your requirement but at least 20 GB and select the format as “free”

Step 3: Now insert the live boot disk and restart your machine when its booting hold the option key, live boot it from ubuntu disk and use the option “Something else” and follow the procedure as per the above mentioned tutorial.

Step 4: Get a nice cup of coffee and enjoy Ubuntu on your mac

Issues:
1.Wifi Driver
2.Battery Life on ubuntu is way less than on Mac OS X