Archive for the ‘Mac’ Category
Convert DVD to ISO on Mac
Another faculty member asked me how to convert a DVD to an ISO on his Mac. Here are the instructions for everybody.
He needed to convert it because he wanted to deploy it on a Netbook from a USB drive. We all know you shouldn’t do this unless you’ve paid for the license and are only installing it on a single machine, like the Adobe license specifies.
The only tricky part to this is the last command-line step, which I borrowed from Mac OS X hints.
1. Open Disk Utility on your Mac OS X. It’ll look something like this:
2. Click the New Image icon in the tool bar, and save it as a compressed file. This writes it as a .dmg
file, which is an Apple format .iso
file.
It’ll take a while to write. The length of time is relevant to the size of the image on the DVD.
3. This is the first of two tricky steps. They’re tricky because you need to use the command-line. If you followed the instructions, you’ve saved the .dmg
file on the Desktop. Now, you need to convert the .dmg
formatted file to an .iso
formatted file. You open Terminal, which is found in your Applications folder. Once launched follow the steps below. Change the directory to the Desktop
or the folder where you put the file. You must do this before running this command because I’ve used relative file syntax (more or less only the file name). Alternatively, you could provide fully qualified file names.
MacPro:~ mclaughlinm$ cd Desktop MacPro:Desktop mclaughlinm$ ls *.dmg Acrobat9.dmg MacPro:Desktop mclaughlinm$ hdiutil convert Acrobat9.dmg -format UDTO -o Acrobat9.iso Reading Acrobat9 (Apple_ISO : 0)… ............................................................................................................... Elapsed Time: 27.655s Speed: 22.2Mbytes/sec Savings: 0.0% created: /Users/mclaughlinm/Desktop/Acrobat9.iso.cdr |
4. Before you copy it to your Windows USB, you need to remove the trailing .cdr
from the file name. The syntax at the command-line is:
MacPro:Desktop mclaughlin$ mv Acrobat9.iso.cdr Acrobat9.iso |
5. Open Finder, and copy the .iso
to your USB drive, and delete the temporary copy.
Hope this helps some folks.
VMWare Locked Files
Working on my stuff today, and the Belkin Flip DVI KVM Switch (product discontinued as of 2012) went nuts. First, I lost the keyboard, and then video. After a couple fruitless minutes, I did the unthinkable and opted for the 7 second to oblivion restart while two VMWare instances were up and running. By the way, I disconnected the Belkin Flip DVI KVM Switch because that was the last straw. For those looking at the product, I’d advise against it because infrequently the device transmits haze or golden flashing pixels. Also, this wasn’t the first time the keyboard disconnected itself without rhyme or reason.
All my VMs were locked when I rebooted. It didn’t matter whether they were running or not when I did the forced shutdown. This is not the image you want to see when you’re short on time against a fixed deadline.
The fix was simple. You go to the directory where each VM is located and find if you have locked files. You can run this command to find them:
$ ls *.lck |
If they’re locked you’ll see something this:
564df021-1de5-dec0-942a-37635b35361b.vmem.lck: M00680.lck Windows XP Professional 32-bit.vmdk.lck: M25400.lck Windows XP Professional 32-bit.vmx.lck: M47433.lck |
You need to delete all three files, I used this command:
$ rm -rf *.lck |
When you restart VMWare Fusion, everything will be fine. Hope this helps a few folks.
Reluctant Print Sharing
About 8 months ago I published how to set up a shared network printer in Windows XP, using VMWare Fusion on a Mac OS X. Recently, I went to follow my own instructions and found they failed with an older Windows XP media – OUCH!
When I checked whether or not the version of Windows XP knew about my much newer printer, the problem became clear. If you want to set up a newer printer than Windows recognizes, you’ll need the vendors media.
Here are the steps to install a printer when Windows can’t recognize the network printer:
1. First make sure you navigate to Virtual Machine on the VMWare Fusion menu, choose CD/DVD and then Connect CD/DVD to proceed.
2. Insert the disk that came with your printer. My disk is for my HP 2420 duplex printer on Windows XP, 32-bit. If you’re installing to a 64-bit version of Windows, the installer will die and the complexity rises as you download the media from HP and manually install the driver files.
The screen shots are those for configuring a printer because I neglected to capture the driver install shots earlier and didn’t have the time to do so. When I have to setup another similar version, I’ll add those. The first screen shot after the welcome screen and choosing your language follows. Click the Next button to continue.
3. Choose the Add an additional printer on printer driver radio button, then click the Next button to proceed.
4. Choose the Connected via the network radio button, and then click the Next button to continue.
5. Choose the Basic network setup for a PC or server (recommended) radio button, and then click Next button to continue.
6. Choose a method to search by enabling the Search from a list of detected printers (recommended). This choice fails from the normal process that adds a printer because it can’t detect newer printers. Click the Next button to continue.
7. This next screen is a progress bar, and it takes enough time that you’ll notice it. Click the Next button to continue.
8. Hopefully, you’ll find your printer. Click the Yes, install this printer. Click the Next button to continue.
9. The following confirms the settings. Unless you’ve manually assigned the Network Interface Card for the printer to a fixed IP address, I’d leave these settings alone. Click the Next button to continue.
10. If you’ve manually installed the Post Script driver you may want to enable it here. As to the HP LaserJet Toolbox, I would definitely leave it alone. Click the Next button to continue.
11. This is where you can rename your printer if you have a desired name. Enter any change from the default, and then click Next to continue.
12. Generally, it’s a very bad idea to share a printer from a virtual machine instance. The only time I’d even think about it would be if I were trying to replicate a problem with a nested virtual machine. Therefore, I’d suggest you choose Not Shared, and then click Next to continue.
13. Here you can put a location in for the printer and any comment you’d like to have for it. Click the Next button to continue.
14. Everything to here as been choosing the configuration. Click the Install button to install the printer.
15. This progress bar fills four times, so take a break. When it is done, click Next to continue. Don’t click that Cancel button when it hangs for bit because it may do that. You’ll need to be patient, after all it is Microsoft’s operating system and most likely an HP driver.
16. You’ve now completed the installation, click the Finish button to complete the process.
Hopefully, this helps a couple folks that are configuring a Windows XP printer inside a 32-bit Windows XP installation.
Native Mac Oracle 10gR2
I noticed today working with my students on downloads for the new term that Oracle finally released Oracle Database 10g Release 2 for Mac OS X Intel. That’s awesome until you see what it doesn’t include. You can find the installation instructions along with a list of unsupported products here. The real instructions are inside the zip file that you download.
If you’re like me, you’re asking: “When does Oracle Database 11g Release 1 for Mac OS X Intel ship?” However, I’m downloading it right now to test.
VMWare and Fedora 10
It sometimes gets tiresome to sort the VMWare compatibility issues with Linux release-by-release but at the end of the cycle it’s fine. I downloaded the current Fedora 10 Live release because it is so much smaller than the install disk. It uses a kernel of 2.6.27.5-117.fc10.i686. I encountered a critical errors when I tried to install the VMWare Toolkit from VMWare Fusion, version 2.0.3 (156731). The only error guidance you’ll get is that there isn’t any make file.
There’s a twist here if you’re most familiar with Ubuntu and sudo
command execution. You need to su
to the root
account and run everything as root
user. An alternative would be to edit the /etc/inittab
file to allow the root
user to boot the instance. The default is 5 (X11). You enable the root
user by changing it to 3 (full multiuser mode). Don’t forget to change it back, you really shouldn’t log in as the root
user. Anyway, you’ll have to do it to run the VMWare Toolkit successfully as shown later in the post.
You fix the incompatibility of the VMWare Fusion Toolkit by downloading the following two missing RPMs. You should be able to find them here. As to why they’re not in the Live DVD distribution, who knows.
binutils-2.18.50.0.9-8.fc10.i386.rpm gcc-4.3.2-7.i386.rpm glibc-2.9-2.i686.rpm glibc-devel-2.9-2.i386.rpm glibc-headers-2.9-2.i386.rpm kernel-devel-2.6.27.5-117.fc10.i686.rpm kernel-headers-2.6.27.5-117.fc10.i386.rpm libgomp-4.3.2-7.i386.rpm |
You can’t run some of them through the RPM utility, so you should probably run them all at the command line. The command line syntax and sequence for these packages is:
rpm -ivh kernel-headers-2.6.27.5-117.fc10.i386.rpm rpm -ivh kernel-devel-2.6.27.5-117.fc10.i686.rpm rpm -ivh binutils-2.18.50.0.9-8.fc10.i386.rpm rpm -ivh libgomp-4.3.2-7.i386.rpm rpm -ivh glibc-headers-2.9-2.i386.rpm rpm -ivh glibc-devel-2.9-2.i386.rpm rpm -ivh glibc-2.9-2.i686.rpm rpm -ivh gcc-4.3.2-7.i386.rpm |
As the root
user, you can now install the VMWare Toolkit. While running the installation, you’ll receive a prompt to confirm the /usr/src/linux/include
. Don’t accept the default path because it won’t work unless you created a symbolic link. The kernel header files require you to enter the following path:
/usr/src/kernels/2.6.27.5-117.fc10.i686/include |
Everything should work finxs e when you compile the modules. Hope this helps a couple folks.
Localhost WordPress on MAMP
There’s so much energy that goes into blogging with big blog pages, I figured it was time to setup WordPress on my MacBook Pro MAMP (Mac, Apache, MySQL, and PHP) installation. That way, the world doesn’t need to know when I mess up a <div> tag.
The biggest benefit of creating a local blog becomes obvious when you start building your own plugins, templates, and themes. You also have the benefit of a built in backup if you post your work locally before moving it to your blog. Likewise, you can work on your blog when not connected to the network. By the way, thanks to Joel for pointing out that I forgot to say why this was important.
Here are the setup instructions for those interested in doing it too.
1. Download the software from WordPress.org by clicking their button or this one. If you need the tar.gz
, click on the web site link.
2. When you download it, you’ll be prompted to open it. Choose to save it.
3. You’ll find it in your downloads folder, where you can double click it to launch the unzip process into a file folder. Mine happens on the desktop because it’s convenient.
4. After you’ve unzipped it into a folder. You drag it into your MAMP htdocs
folder. You can check where the htdocs
folder is by launching the MAMP application, and choosing Preferences.
In the preferences dialog, click the Apache tab, you’ll see where the htdocs
folder location is. Mine is set to the default location.
5. After you drag the wordpress folder into the htdocs
folder, you return to the MAMP application and click the Open start page button.
6. Click the phpMyAdmin link and create a database, like the screen shot.
After a moment, you should see that you’ve created a new database named WordPress.
7. Go to your /Applications/MAMP/htdocs/wordpress
folder, and open up wp-config-sample.php
file in a text editor. You should see the same lines 19, 22, and 25. The editor screen capture is from the TextMate editor.
Edit those lines to reflect your database name, and the root password. Naturally, if you’re concerned that your local host isn’t secure, you’ll need to purchase MAMP Pro to change your root password. You can’t change it in the free version.
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'WordPress'); /** MySQL database username */ define('DB_USER', 'root'); /** MySQL database password */ define('DB_PASSWORD', 'root'); |
After these changes, save the wp-config-sample.php
file as wp-config.php
in the same folder.
8. Enter the following in URL in your browser, and press the enter key.
http://localhost:8888/wordpress/wp-admin/install.php |
9. On the Welcome web page, enter your blog name and email (mine is omitted for obvious reasons). Click the Install WordPress button to proceed.
10. You’ll then be prompted with the admin
user and a password. You should print it or copy it to your buffer because you’ll need it when you first login. Then, click the Log In button to proceed. You should probably change your password to something that you’ll remember before you do anything else.
11. You now have a complete localhost
WordPress installation. Now, you can go to your real web accessible WordPress install and export your blog from the Tools menu. Then, on your localhost blog, you can import from the export file of your blog. If you’re using plugins (like anybody doesn’t), then copy the contents from the wp-content/plugins
folder from your online blog to your local one; and then, activate them. You can snag your Akismet key from your online site too, but it is unlikely anybody will see your localhost blog.
Violà, c’est fine.
You can now access WordPress on your local machine by typing in the following URL:
http://localhost:8888/wordpress/ |
Data normalization notes
I’m trying to eliminate the textbook from my database class, and wrote a data normalization blog page for my students; however, it is only done through 3NF so far. The post tries to remove the discrete math and provide clear examples. The students are checking it out for opportunities to make it clearer, if you’ve thoughts let me know.
Also, I’ve substantially update my initial blog page on SQL joins, and will put one out on set operators probably this Monday. If you’ve time to review it, I would appreciate suggestions for improvement.
The length of these blog pages has compelled me to move to a more friendly editor. I’ve opted for Blogo as my Mac blog editor. It comes from Brainjuice. My son’s experience with their customer service and product convinced me. You can find his blog post discussing customer service here.
Blogo prompts you, but beat the rush. Go to your Site Admin, select Writing under Settings in WordPress, and enable the remote XML-RPC publishing protocol. More or less like this prompt.
No code scrolling on iPhone
I wanted to have scrolling on my iPhone for code segments. It appeared simple. Change the style.css
file by adding .code { overflow-x:scroll; }
. I first tested it in Safari by setting User Agent to Mobile Safari 1.1.3 – iPhone, where it worked. Alas, it doesn’t work on my iPhone. A quick look at the iPhone simulator taught me it doesn’t work there either. It appears that horizontal scrolling is disabled on the iPhone.
That style sheet is found in the /public_html/blog/wp-content/plugins/wptouch/themes/default
directory. I’d love to have missed something. If there’s a trick to do it, let me know.
LAMPs for the Mac
LAMP the ubiquitous acronym for Linux, Apache, MySQL, and PHP, Python, or Perl has a couple cousins. They are OPAL (Oracle’s stack on Linux, and MAMP (Mac OS X, Apache, MySQL, and PHP et cetera). Perhaps another acronym on the horizon is: OPAM (Oracle, PHP, Apache, and Mac OS X). OPAM is a guess on my part. Nobody knows what Oracle’s marketing department may choose. Regardless of the acronym for it, Oracle has published instructions for configuring an Oracle/PHP stack on Mac OS X.
I generally configure the OPAL stack with Zend Core for Oracle and the Oracle database on a virtual machine running Windows XP, Windows Vista, Ubuntu, or Red Hat Linux. If you follow my posts I prefer VMWare Fusion over Parallels. The MAMP stack I use is open source and provided by Living E. It follows the pattern of Mac OS X installations, which differs from the recent posting from Oracle. It’s easy to install, as you tell from the documentation. MAMP installs PHP 5.2.6 as the current release.
It’s a great choice when you incorporate the open source Sequel Pro tool. Isn’t it ashame that Sequel Pro doesn’t work natively with Oracle. If I find some time this summer, it might make a great project to extend it to Oracle. The interface to Sequel Pro looks like this:
When you create a connection, you should know the typical values. The database value can be left blank when connecting as the superuser root
:
Host: localhost User: root Password: root Database: Socket: /Applications/MAMP/tmp/mysql/mysql.sock Port: 3306 |
Here’s the connection dialog where you’ll enter the values:
Have fun playing with the MAMP stack.
Overriding SQL*Plus ed
I was looking for a cool post to point my students to about overriding the ed
tool in SQL*Plus but couldn’t find one. A number of posts showed how to set vi
as the default editor in Linux or Unix but none showed how to replace Microsoft Notepad with something else. Instructions for both operating environments are here.
Linux or Unix:
This is simple because all you need to do is open a terminal session and type the following command:
# which -a vi |
vi
is typically a symbolic link to /usr/bin/vi
, and it points to /usr/bin/vim
in many cases, like Linux or Mac OS X. You can now add that to your SQL*Plus session interactively by typing:
SQL> define _editor=vi |
You can set this in your Oracle Database 10g or 11g home, or in the Oracle Database Instant Client. It is found in the $ORACLE_HOME/sqlplus/admin/glogin.sql
file, and example is noted at the end of this blog.
Windows:
This is actually quite easy but different releases of Windows provide different behaviors. Some of those behaviors provide alternatives that don’t work in all Windows releases. The off-beat approaches let you launch the alternate editor but they don’t always edit the active buffer. The ones I’ve chosen to show you should work in all Windows releases, but let me know if they don’t in your environment.
1. Install the editor(s) you want to use. I’ve installed and tested GVIM (a vi
editor) and Notepad++ on Windows XP and Vista with Oracle Database 10g and 11g.
2. Add the directory path to these products to your system path. This takes four steps. First, you open your System Properties dialog box. Click the Environment Variables button to set an environment variable.
In the Environment Variables dialog box, you should select the PATH
variable from the System variables list. Click the Edit button to change the PATH
variable.
Add the following in the Edit System Variable dialog box. You should note that you use a semi-colon to separate path elements in Windows (not a colon like Linux or Unix). After you add the editor path, click the OK button. You can append any number of editors if you’ve got a bunch that you like to use.
You should now click the OK button on the Environment Variables and System Properties dialog boxes in turn. Now you can open any command prompt and type the executable name to run the program, like gvim72.exe
.
3. The Oracle Database 10g and 11g expect the executable for the default or override ed
(editor) utility exists in the %SystemRoot%\System32
directory, which is the C:\WINDOWS\System32
directory. Copy only the executable, like GVIM.EXE
, to the C:\WINDOWS\System32
directory.
4. You can now interactively type the following each time you log into the database at the SQL command prompt:
SQL> define _editor=gvim |
Alternatively, you can place that command in the following file:
%ORACLE_HOME%\sqlplus\admin\glogin.sql |
It is run each time you login to the database. The file would look like this if you wanted to run gvim
as your override editor, which means when you type ed
to change the SQL buffer file. The SQL buffer file contains the last SQL statement executed. That file is named afiedt.buf
, which stands for A File Eidtor Buffer (debunked by Niall in the comment, the AFI stands for AFI Advanced Friendly Interface). As pointed to by Laurent’s comment, you should change the file extension to take advantage of GeSHi (Generic Syntax Highlighter) for your code.
5. After you’ve done all that. If you’d like to include your USER
name and TNS alias, you can run the following command interactively or put it in your glogin.sql
script. Caution, this only works for Oracle 10g forward.
SQL> SET sqlprompt _user"@"_connect_identifier> |
This sets the SQLPROMPT
to the following for a user account named STUDENT at the standard orcl
TNS alias:
STUDENT@orcl> |
The rules for setting the SQLPROMPT
aren’t intuitive. You can only use one set of double quotes. In the preceding example, the quotes surround the @
symbol between two SQL*Plus macros, which are the _USER
and _CONNECT_IDENTIFIER
. There’s no magic in that symbol and you can replace it with another. When you want text before, in between, and after a macro or two, you surround the whole thing with double quotes, and allow a white space before macros or use single quotes around string literals.
The white space example works like this:
SQL> SET sqlprompt "SQL: _user at _connect_identifier>" |
This sets the SQLPROMPT
to the following for a user account named STUDENT at the standard orcl
TNS alias:
SQL: STUDENT at orcl> |
The nested single quotes example works like this:
SQL> SET sqlprompt "'SQL:'_user at _connect_identifier>" |
This sets the SQLPROMPT
to the following for a user account named STUDENT at the standard orcl
TNS alias:
SQL:STUDENT at orcl> |
The single quotes around the SQL:
lets you remove the space between the colon and user name. I’ve never seen a way to control case for the macro return values but there may be one. Perhaps somebody will add a comment about it. If you put more than two double quotes in the descriptor passed to SQLPROMPT
environment variable, SQL*Plus raises an SP2-0735
error.
6. Here is a sample of the glogin.sql
file:
-- -- Copyright (c) 1988, 2005, Oracle. All Rights Reserved. -- -- NAME -- glogin.sql -- -- DESCRIPTION -- SQL*Plus global login "site profile" file -- -- Add any SQL*Plus commands here that are to be executed when a -- user starts SQL*Plus, or uses the SQL*Plus CONNECT command. -- -- USAGE -- This script is automatically run -- -- Define the override or default editor. define _editor=gvim -- Set the edit file to allow GeSHI highlighting. SET editfile=afiedt.sql -- Set the SQL*Plus prompt to show user and TNS Alias. SET sqlprompt "'SQL:'_user at _connect_identifier>" |
Hope this helps a few folks stuck with Windows as the operating system for Oracle.