12 November 2018

Install Linux on Mac with broken internal CD/DVD

I could finally install Linux Mint XFCE on an iMac 20" 2006 (iMac 5,1) with broken internal CD/DVD reader.

Here is what you need:

1. rEFInd ISO image (mine was refind-cd-0.8.7.iso);

2. one USB drive stick;

3. an external USB CD/DVD device;

4. Mattgadient’s Linux Mint DVD iso image (BTW, thanks to Matt Gadient);

5. a blank DVD media;

6. USB keyboard and mouse.

7. not mandatory, an Internet connection with an Ethernet cable or a tethering cell phone connection via USB cable.


Proceed as follows:

a. write the rEFInd onto the USB stick (I used “USB Image Writer” Linux application, which makes a bootable USB stick);

b. burn the Linux iso image onto the blank DVD;

c. attach both the USB stick, the USB DVD reader and the USB keyboard to the USB ports of the Mac;

d. boot the Mac;

e. after a while, the boot screen of rEFInd will appear. Select the DVD media as your boot device;

f. be patient: give the Linux installer the time it needs;

g. start the installation process and be *very* patient: the complete startup will take some time. Roll a spliff!;

h. choose the standard installation (Mint will install the Linux partition on /dev/disk0s2);

i. after the installation is finished, reboot your system;

l. when the rEFInd boot screen appears, choose your internal HD as boot device.


It’s done!

Now you have to activate the WiFi hardware. Open “Driver Manager” application of your brand new installed Linux. You’ll see that the network controller Broadcom Limited BCM4321 is disabled by defaut. Activate it by clicking the checkbox… Done!

As for the iSight webcam, I could make it work perfectly following the instructions here:
http://www.howtoeverything.net/linux/hardware/making-isight-work-ubuntu-linux-mint-and-skype

To reduce the startup grey screen time, the instruction you find above, right in this page, are ok. Remember to verify your Linux partition with the terminal command “diskutil list”. In my case the fix command was:

bless –device /dev/disk0s2 –legacy –setBoot –verbose



… One more thing… In order for this method to work, you need to format your Mac’s internal Hard Drive, first. In other words, the internal HD must be empty, with no OS at all, otherwise rEFInd won’t see the installer DVD. Strange, but true.



An extra trick that could be useful: boot the installer in safe mode.



Via.

09 November 2018

Generate rows with random data in SQL Server

IF OBJECT_ID('tempdb..#tmp') IS NOT NULL
 DROP TABLE #tmp


SELECT   TOP 1000 
    IDENTITY(INT, 1, 3) AS ID
  , RAND(CHECKSUM(NEWID())) * 30000 + CAST('1945' AS DATETIME) AS randomDate
  , ABS(CHECKSUM(NEWID())) AS randomBigInt
  , (ABS(CHECKSUM(NEWID())) % 100) + 1 AS randomSmallInt
  , RAND(CHECKSUM(NEWID())) * 100 AS randomSmallDec
  , RAND(CHECKSUM(NEWID())) AS randomTinyDec
  , RAND(CHECKSUM(NEWID())) * 100000 AS randomBigDec
  , CONVERT(VARCHAR(6),CONVERT(MONEY,RAND(CHECKSUM(NEWID())) * 100),0) AS randomMoney
INTO #tmp
FROM master.dbo.syscolumns sc1, master.dbo.syscolumns sc2, master.dbo.syscolumns sc3


SELECT *
FROM #tmp