Upgrade to PHP 5.6 or 5.5 on Mac OSX 10.10 Yosemite

Too easy. Follow the links and so on found here.

Upgrade on Yosemite

Just substitute 5.6 in place of the 5.5 or 5.4 they mention.

Then also adjust your .profile, or .bash_profile to reflect the new path.

Of course – the next release of OSX 10.10 may just wipe out all your hard work … but hey, easy to fix again.

Posted in OSX | Leave a comment

Postfix and Dovecot on Yosemite.

After spending ages working on the various setups related to Postfix and Dovecot, I just about have it into a neat tutorial, on how to set it up on Yosemite and be able to manage your own mail server, without having to install Apple’s Server. Which is nice, but has a lot of things the individual user will have no need of.
However, in the case where you may be hosting a number of Virtual Domains, and you need mail services for them, then it’s nice to be able to handle it On Site.

Updates.
For starters.

Postfix comes installed on Yosemite. So don’t go installing from macports or downloading sources until you know what you are doing. It could probably use updating, but leave it for now. It’s pretty straight forward, so should update naturally as Yosemite is updated. I hope? If you want the bleeding edge stuff – caveat utility… I haven’t put the download links for Postfix here, because I don’t want you to accidentally go and grab it by mistake.

It’s easy to find out your current version with:
$ postconf -d mail_version

gives you …
mail_version = 2.11.0 at least on my GM3 version of Yosemite. Be aware that updates to Yosemite may well wipe out all your hard work.

Handy Postfix Wikis…
Postfix main.cf configuration
Virtual Mail Server

Dovecot does NOT come installed on Yosemite. And if you want IMAP mailboxes, which most Apple mail clients seem to want by default, then you will need it. Download it here. If you are doing Virtual Mail Boxes for Web Hosting and so on, you will need it.
Stable releases. Try and get the latest one…. or at least a late one. Currently – macports is about 1.7. Way old… don’t use it.

Download v2.2.13 sources. [PGP signature] [changes].

and READ the Wiki for Dovecot.. IMPORTANT. Everything yo need to know about Dovecot is here.

And … In which case you will also need – because the doveconf mail and install won’t install unless you have it.

libiconv – which also does not come ready installed. Look at it here for downloading.

Expand it into it’s own directory in Downloads and do a
./configure
make
sudo make install

….. then go back to Dovecot, and do the same.
./configure
make
sudo make install

Now, you will want to know where everything is right.

$sudo find / -name “*dovecot*” -print

Will list out lots of stuff.

To start them up – you will need LaunchDaemons … I’ll do them later.

enough for now.

Posted in OSX | Leave a comment

Now running Yosemite OS X 10.10 here

I am also trial running Mailserve for Yosemite, http://cutedgesystems.com/software/MailServeForMavericks/ and it’s working as well. Let me rephrase that. It runs on Mavericks – but still has issues on Yosemite – the map poor Dovecot part doesn’t seem to be handling the mail delivery.

or is it the Apple Mail.app – can’t work it out.

Mail goes and gets my gmail stuff. But, it won’t pick up mail for the local user on this machine. i.e.. me.

$mail robert
Subject: Sunday …
Hello world
.

$You have mail

works – but no way can I convince Mail to pick it up.

Posted in Default Category | Leave a comment

Source Code now on sale

The source code for the iOS apps created by me, is now coming on sale. You will find it here at ShanghaiTimes

Posted in iOS | Leave a comment

Old Felixstowe Weather Station. Arduino + Weather Display

The whole thing needs a bit of work still, but it is working. Weather Display software is commercial software, but the writer of the software has generously added Arduino weather station capability to it for us. weather-dsiplay.com will find that.

My weather station is here.
I’m pulling in the transmission from a LaCrosse TX13 outdoor transmitter station – Rain, Wind, Temp, and a BMP180 Pressure and indoor temp sensor set up on the ASK Weather Receiver board on the Freetronics Uno.
All the code is here on this site, and although I’ve had to tweak it a little from the original, for the rainfall bit, not much really has changed.
It compiles on either Windows or Mac.

Weather Display unfortunately only runs on Windows and Linux …
The Old Felixstowe Weather Station is here and should give you a good idea of what it’s doing.

Posted in Weather | Leave a comment

Weather Display and Arduino USB Weather Station

Weather Display, here is now able to read Arduino weather based stations. It’s still ongoing work, but it’s working ok for me, based on a LaCross TX13 transmitter. Arduino Code available on this site, and some twiddling. Weather Display costs a fair few bucks, but it’s a fairly serious piece of work that recognises a lot of weather stations, so is probably worth it to the enthusiast.

Posted in Weather | Leave a comment

Quartz 2D code snippet, reformatted.

This code goes with the previous post – The Quartz2D transformer. Formatted properly.

- (void)drawRect:(NSRect)rect
{


    NSString* imageName = [[NSBundle mainBundle]
                           pathForResource:@"Gauge_mph_322x322" ofType:@"png"];  // The gauge image name, carried now in Resources
    NSImage* imageOfGauge = [[NSImage alloc] initWithContentsOfFile:imageName];
    
    [imageOfGauge drawInRect: rect
             fromRect: NSZeroRect
            operation: NSCompositeSourceOver
             fraction: 1.0];
    [imageOfGauge release];

    
	// Obtain the current context
    CGContextRef ctx = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
	// Draw the image in the context
	IIDrawImageTransformed(image, ctx, NSRectToCGRect(self.bounds));

	// Draw the view border, just a simple stroked rectangle
	CGContextAddRect(ctx, NSRectToCGRect(self.bounds));
	CGContextSetRGBStrokeColor(ctx, 1.0f, 0.0f, 0.0f, 1.0f);
	CGContextStrokePath(ctx);
    


    
    
}

Quartz 2D Transformer

Last Revision:
Version 1.2, 2010-04-12
Builds for 64-bit, fixed image orientation code.
(Full Revision History)
Build Requirements:
Mac OS X 10.4
Runtime Requirements:
Mac OS X 10.4
Shows how to use Quartz 2D to rotate, scale and move an image using the CTM (coordinate transformation matrix) and how to use Image I/O to load and save an image.

Posted in OSX, Weather | Leave a comment

Do your own gauges in – Quartz 2D Transformer – Apple MacOSX code sample

So, for those interested, there is an excellent code example in the Apple Development Docs section. It’s right HERE And as you can see – the upshot is that it gives you the base code to use Your Own gauge designs. The blue gauge, ok, I copied it from somewhere else, as well as the orange needle.

now note. BOTH images are 322×322. The orange needle is actually a transparent image, with just the orange needle drawn on it. That’s how the Transform/Rotate stuff works in Quartz 2D.

The interface is running in the New Xcode Version 6.0, released September 2014, on Mac OSX. This code will most likely not run on iOS. It’s OSX.

The only changes I had to make to the Apple code were.

1. I replaced their “demo”.png file permanently with my own, orange_needleBy322x322.png file. I hard coded that in, to replace their spaceship !!!

I added the following code in the ImageView.m class, to put the background gauge face in.


- (void)drawRect:(NSRect)rect
{
NSString* imageName = [[NSBundle mainBundle]
pathForResource:@"Gauge_mph_322x322" ofType:@"png"]; // The gauge image name, carried now in Resources
NSImage* imageOfGauge = [[NSImage alloc] initWithContentsOfFile:imageName];

[imageOfGauge drawInRect: rect
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0];
[imageOfGauge release];
// Obtain the current context
CGContextRef ctx = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
// Draw the image in the context
IIDrawImageTransformed(image, ctx, NSRectToCGRect(self.bounds));

// Draw the view border, just a simple stroked rectangle
CGContextAddRect(ctx, NSRectToCGRect(self.bounds));
CGContextSetRGBStrokeColor(ctx, 1.0f, 0.0f, 0.0f, 1.0f);
CGContextStrokePath(ctx);

}

@end

 

Be careful of the code above. The section [imageOfGauge drawInRect: rect

Is formatted differently than it shows here.

 

The result is this nifty little gauge, that you can fiddle with.

My end desired result is to have that gauge vary according to wind speed … So al lI need do really is replace the rotation-dial that moves the needle with my own input stream of wind speed. Cool huh.

 

MyGauge

Posted in OSX, Weather | Leave a comment

MAX 3232 and the WS3600 – How To

This most excellent idea comes from Al Testani. And is now implementable thanks to a Sparkfun MAX3232 Breakout board. A little bit of solder, and not much else.

As always – these images open in full screen mode

MAX3232 and WS3600

 

Now that should be fairly easy – coupled with this nifty little device. Available from Sparkfun, in the UK, here.

 

MAX3232Schematic

MAX3232 Schematic

 

Posted in Weather | Leave a comment

Why would I write data to a binary data file? It’s all about speed and space.

NSKeyedArchiver in a Nutshell

The NSKeyedArchiver class accepts data objects from your application and stores them on disk. It stores the objects in a file as binary data.

Encoding Diagram
You can open a binary data file in a text editor, but it’s quite hard to make any sense of the contents that way. Binary files are designed to be easily read by the computer, not a person. As a result, binary files take up less space on disk than plain text files and can be loaded by an application very quickly.

Interface Builder, for example, typically stores NIB files in a binary format.

Extracted from this excellent article:

 

Posted in Default Category | Leave a comment