Snow Leopard – Enable 64 bit

To enable the 64 bit kernel, hold the 6 and 4 keys while booting. Likewise, to enable the 32 bit kernel (if it is not your default), hold down the 3 and 2 keys while booting. By default, Snow Leopard has the 32bit kernel enabled to provide better application support until developers have ported their applications over to 64bit.

To permanently make the 64bit kernel your default enter the following from a Terminal session.

Update:
This didn’t work for me.
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.Boot ‘Kernel Flags’ ‘arch=x86_64′

However, this did:
nvram boot-args=”arch=x86_64″

To verify the kernel you are running, click on the Apple symbol in the top left corner and client “About this Mac.” Then, click “More Info…” and then Software. Look for the following:

64-bit Kernel and Extensions: Yes

If running the 32-bit kernel, it would read the following:

64-bit Kernel and Extensions: No

MacOSX – Burn a DMG or ISO image to disc.

Bring up the Disk Utility in Applications/Utilities.
Drag and drop the image file to the left window pane. The image file will be listed along with your other disk drives.
Click on the newly listed image file to select it in the Disk Utility.
Click on the Burn icon on the top toolbar.

MySQL Commands

I intend to add to this as I have time.

To display the schema of a table:

mysql> desc tablename;

To restore a database from backup:

mysql -u root -p
mysql> create database databasename;
mysql> use databasename;
mysql> source databasebackupfile;
Note: I back my databases up to a file name of databasename.sql.

To update all records in a column of a table:

mysql> update tablename set columnname=’value‘;

To update one record in a column of a table. Note: othercolumnname needs to be unique to the record.:

mysql> update tablename set columnname=’value‘ where othercolumnname=`somevalue‘;

To create an account:

GRANT ALL PRIVILEGES ON databasename.* TO ‘username‘@’hostname‘ IDENTIFIED BY ‘password‘;
GRANT ALL PRIVILEGES ON databasename.* TO ‘username‘@’localhost’ IDENTIFIED BY ‘password‘;
FLUSH PRIVILEGES;

To make mysqld listen only localhost:

vi /etc/my.cnf

bind-address=127.0.0.1

To count the number of rows in a table:

SELECT COUNT(*) FROM tablename;

To remove formatting and heading from a SELECT statement and delimit using a TAB character:

mysql mydatabase -N -B -u myuser -p -e “myselect statement;”

How to convert timestamp to date from a SELECT statement:

SELECT row1,DATE_FORMAT(FROM_UNIXTIME(`row2`), ‘%b %e %Y’) AS ‘date_formatted’ FROM tablename;

How to get the time an hour ago:

SELECT TIME(DATE_SUB(NOW(), INTERVAL 1 HOUR));

To access a MySql database from a script without having the password stored in the script:
Add the information to the .my.cny file in the user’s home directory that the script will run under.

Edit or create the file:

# vi ~/.my.cny

Protect the file:

# chmod 600 ~/.my.cny

Sample file contents:

# cat ~/.my.cny
[client]
user=mysqlusername
password=mysqlpassword
database=defaultdatabase

Then, to use it:

# mysql < mysqlscript > my.output

Configure Finder to display the hidden files and directories.

From a Terminal session, type in the following:

To display hidden files:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

To hide hidden files:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Updated my blog to use Yourls plugin.

This looks like is could be a pretty interesting plugin. We will see.

Well, my first attempt at this did not work so well. I have my own domain (tyni.info) and I am now trying to use it.

Well, at least I got yourls to work. However, I still having trouble getting the twitter plugin to work.

All right, I got this to work. The version I installed today worked fine with my yourls installation using my own shortened url. Cool stuff.

I used the the version 1.2.1 of the plugin (http://planetozh.com/blog/yourls-wordpress-to-twitter-a-short-url-plugin/). This is the one that worked for me.

I downloaded and installed yourls from http://code.google.com/p/yourls/downloads/list.
I downloaded and installed t he yourls WordPress plugin from http://planetozh.com/blog/yourls-wordpress-to-twitter-a-short-url-plugin/.

Sed to remove first or last character in a string.

To remove the first character in a string:
echo $STRING |sed ‘s/.\(.*\)/\1/’

To remove the last character in a string:
echo $STRING | sed ‘s/\(.*\)./\1/’

To remove the last five characters in a string:
echo $STRING | sed ‘s/\(.*\)…../\1/’

To remove all whitespace at the end of the line:
echo $STRING | sed ‘s/[ ]*$//’

Using hping to send a upd ping.

hping2 –udp -p portnumber ipaddress -d packetbodysize

Example:
I used the following to verify a DNS listening.

hping2 –udp -p 53 192.168.0.1 -d 50

Linux as print server for Tru64.

I used the following configuration to use a CentOS 5.3 server as a print server for Tru64. Note: I used this solution for testing purposes, because some Tru64 print jobs were stopping in the middle of the job, when the job was sent directly to the printer.

On the CentOS server, I had a printer set up and working via CUPS. I started cups-lpd by using ntsysv and service xinetd reload.

On the Tru64, I created an /etc/printcap entry similar to the following:

printname:\
:lf=/usr/adm/printernameerr:\
:lp=:\
:rm=remoteprinterserver:\
:rp=remoteprintername:\
:sh:\
:sd=/usr/spool/remote/printername:

Example:
myprinter:\
:lf=/usr/adm/myprintererr:\
:lp=:\
:rm=mylinuxprintserver:\
:rp=mylinuxprinter:\
:sh:\
:sd=/usr/spool/remote/myprinter:

New look

This week I decided to tackle changing the look to the site. Basically, I am still using the Connections theme developed by vanillamist. I just decided to make it my own. I am not quite done, but so far I like it. Maybe someday, I will try create my own. I just very rarely have time for something that would require that much time, especially, with my lack of strong php and graphics skills.

Bash: Input from multiple files.

exec 3<$1 4<$2

while read file1 <&3 && read file2 <&4
do
code
done

Return top

INFORMATION