16 March 2010

apt-get install yum install on MAC OS X


The reason we bought a mac in the first place was:

1. We get the benefits of Linux
2. With a usable windowing system
3. And it's sexy

So we do a little searching and find out that our little dream is shattered as we have no apt-get install, nor any yum-install.

It's not all that bad. There is good news. There is software called Macports, where the good open sourrce folk have ported a lot of the Linux software to Mac/Darwin. This includes good ol utilities such a rsync, postresql, postfix, mysql and friends...

Unfortunately, it's not just as simple as downloading the MacPorts .dmg file and installing it. Because apt-get and yum typically download source code and compile it for your system, macports needs to do this too. By default, the GCC compiler doesn't come with your mac, and the ONLY way I've found so far to get it on your system, is to install X-Code, which is pretty the best part of a gigabyte.

Fortunately, xcode is free software and ships with your OS, so stick in your OS X cd and install X-Code. If you lost your OS CD, you can create an ADC (Apple Developer Connection) account, and download X-Code here:

http://developer.apple.com/technologies/xcode.html

Once installed, GCC, Make and related tools will be automatically installed and configured.

Then it's a simple matter of downloading and installing MacPorts. Get the DMG here:

http://www.macports.org/install.php

You may want to run a quick update to make sure everything is set up correctly:

sudo port -v selfupdate

And apart from that, it works just like yum or apt-get.

sudo port install ...

Enjoy the best of linux on your machine, free of charge. Be sure to also check out WINE (Windows Emulator) for a lot of fun running Windows software on your Mac, free, without a copy of VMWare, Windows, nor Parallels!

04 February 2010

How to Install PHP on MAC OS X Snow Leopard - The Easy Way

Installing PHP5 on Snow Leopard is easy. It's already there. The only thing is that most web sites say "uncomment" the line, but I didn't see the line at all.

You can make sure that the module is there before enabling it. Mine was in:

/usr/libexec/apache2/libphp5.so

So, I just added one line to:

/etc/apache2/httpd.conf

and that was:

LoadModule php5_module /usr/libexec/apache2/libphp5.so

then I restarted apache by typing:

sudo apachectl restart

If something is wrong, use the -t directive to troubleshoot.

sudo apachectl -t

I'll try and answer any questions you have if you post them here...

01 December 2009

Now you can Write Mobile Apps on Your Mac

Did you know that you've been able to write mobile J2ME applications on a Mac for quite a while, but very few people have known that.

When you download Netbeans (In my case 6.7.1) for Mac OS X, you don't actually have an opportunity to download a version that has the Java ME view.

Fortunately, this is easily overcome by selecting Tools | Plugins | Available Plugins from Netbeans and looking for 'Visual Mobile Designer' and 'Mobility'. Note: Names differ slightly between platforms.

This will allow you to create new "Java ME" Projects -> Don't get too excited yet - you still need to integrate it with an Emulator - else, the IDE is going to moan like mad.

I would recommend downloading both mPowerPlayer (http://mpowerplayer.com/sdk) which is a little more reliable and the new Wireless Toolkit (WTK) for Mac. It's name has changed to Java ME SDK 3.0 (http://java.sun.com/javame/downloads/sdk30_mac.jsp) - it's an early access release, but it does work - a bit.

mPowerPlayer does not have an intaller, just unzip it somewhere and leave it there. The Sun Java ME SDK will install somewhere fine.

Now you need to integrate Netbeans with these buggers. Fortunately, Netbeans does all the autodetection required. Simply go to Tools | Java Platforms | Add Platform, navigate to the root folder of each installation respectively, and Netbeans will do the rest.

It's buggy, but at least you can now develop mobile applications on your beautiful Mac.

Enjoy!

SparkySpider

06 March 2009

Ubuntu 8.10 vs Fedora 10

At first I was really impressed by Ubuntu.

Installation was simple and fast, Printers were a breeze, Synaptics Package Manager really worked for me.

After a while, I started changing my mind.
  • Wireless network support would not work for me out the box
  • VI had keyboard character encoding bugs in it
  • There was no default support for my wireless network card
  • Dictionary was useless, it didn't support pluarals, etc.
  • No support for dual monitors on my ATI Radeon
I then installed Fedora, and am really enyoying it a lot more. All the above problems worked out of the box.

22 January 2007

Downloading and Activating Photoshop CS3 BETA

Good News!

Adobe has released Adobe Photoshop CS3 Beta for download to already existing CS2 customers.

You can register and download a copy for both Mac or PC using the link below:

https://www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5Fphotoshop

According to a post I read on the photoshop web site, some users serial numbers from CS2 have been accidentally left of the list. Should your valid serial number be invalid, they metntioned you can simply rename the c:\program files\adobe\photoshop CS3\AMT\application.sif to something else and restart photoshop.

Sparky

09 January 2007

C#.Net Debugging to the Output Window

Finally I discovered that I can actually debug by outputting text to a window in VS.Net

To get your C#.Net script to output to the console, simply add:

System.Diagnostics.Debug.WriteLine("Hello!");


Do the Debug > Attach to Process > aspnet_wp.exe and visit the page.

Here is a screenshot of the results:

11 December 2006

Javascript: Convert DMS to DD

Hi Guys,

Here is a little object to convert decimal degrees (dd) to degrees minutes and seconds (dms) and the same in reverse. I've tried to optimise it to be as fast as possible to use with Google Maps when dragging over coordinates. Post your questions and comments and I'll try to assist you.

Next post I have an exciting script that allows you use a Google Sattelite Map interface to find your house and drag a marker over it to get the coordinates.

/* Written by Sparky Spider (http://sparkyspider.blogspot.com) */

function Coordinates() {

// Properties

this._latitude = 0;
this._longitude = 0;

this.LATITUDE = 0;
this.LONGITUDE = 1;

// Constuctor

this.latitude = new DMSCalculator(this.LATITUDE, this);
this.longitude = new DMSCalculator(this.LONGITUDE, this);

// Methods

this.setLatitude = function setLatitude(lat) {
this._latitude = lat;
};

this.setLongitude = function setLongitude(lng) {
this._longitude = lng;
}

this.getLatitude = function getLatitude() {
return this._latitude;
}

this.getLongitude = function getLongitude() {
return this._longitude;
}

// SubClasses

function DMSCalculator (coordSet, object) {

var degrees = new Array (0, 0);
var minutes = new Array (0, 0);
var seconds = new Array (0, 0);
var direction = new Array (' ', ' ');
var lastValue = new Array (0, 0);
var hundredths = new Array (0.0, 0.0);

var calc = function calc(object) {

var val = 0;

if (coordSet == object.LATITUDE) {
val = object._latitude;
} else {
val = object._longitude;
}

if (lastValue[coordSet] != val) {

lastValue[coordSet] = val;

if (val > 0) {
direction[coordSet] = (coordSet == object.LATITUDE)?'N':'E';
}
else {
direction[coordSet] = (coordSet == object.LATITUDE)?'S':'W';
}
val = Math.abs(val);
degrees[coordSet] = parseInt (val);
var leftover = (val - degrees[coordSet]) * 60;
minutes[coordSet] = parseInt (leftover)
leftover = (leftover - minutes[coordSet]) * 60;
seconds[coordSet] = parseInt (leftover)
hundredths[coordSet] = parseInt ((leftover - seconds[coordSet]) * 100);

}
}

this.getDegrees = function getDegrees() {
calc(object);
return degrees[coordSet];
}

this.getMinutes = function getMinutes() {
calc(object);
return minutes[coordSet];
}

this.getSeconds = function getSeconds() {
calc(object);
return seconds[coordSet];
}

this.getDirection = function getDirection() {
calc(object);
return direction[coordSet];
}

this.getHundredths = function getHundredths() {
calc(object);
return hundredths[coordSet];
}

this.getSecondsDecimal = function getSecondsDecimal() {
calc(object);
return seconds[coordSet] + (hundredths[coordSet] / 100);
}

this.setDMS = function setDMS (degrees, minutes, seconds, direction) {
var val = degrees + (minutes / 60) + (seconds / 3600);
if (direction == 'W' || direction == 'S') {
val *=-1;
}
if (coordSet == object.LATITUDE) {
object._latitude = val;
}
else {
object._longitude = val;
} // if
} // this.setDMS
} // DMSCalculator
} // Coordinates

It's really easy to use too. Here are 2 examples:


function test() {
var coords = new Coordinates();
coords.longitude.setDMS(33, 46, 16.68, 'S');
coords.latitude.setDMS(18, 44, 24.19, 'E');

alert (coords.getLatitude() + ' ' + coords.getLongitude());

coords.setLatitude (-33.7713);
coords.setLongitude (18.7400527778);

DMSStringLat = coords.latitude.getDegrees() + ' ' + coords.latitude.getMinutes() + ' ' + coords.latitude.getSecondsDecimal() + ' ' + coords.latitude.getDirection();
DMSStringLng = coords.longitude.getDegrees() + ' ' + coords.longitude.getMinutes() + ' ' + coords.longitude.getSecondsDecimal() + ' ' + coords.longitude.getDirection();

alert (DMSStringLat + ' ' + DMSStringLng);
}


I'd love to hear if you have any improvements. Please post them here.