No such file or directory - /tmp/mysql.sock

Sun Jul 11 05:02:51 2010

I've been playing around with a little Ruby on Rails recently and while trying to connect to my MAMP development databases, I came across the following error when using rake db:migrate.

No such file or directory - /tmp/mysql.sock

I have to admit that this baffled me for a while, but after reading around on the net, it suddenly hit me. 'I'd been having one of my stupid moments', I thought as I added the following line to my database.yml file

socket: /Applications/MAMP/tmp/mysql/mysql.sock

I'd been looking for a file in a place where one had no right to be. Why on earth would there be a mysql.sock when there was no sql database? All my development database reside inside MAMP, so it makes sense then that that is where I would find my mysql.sock file.

I realize that this isn't really a big problem for most, but I thought that this could be a potential blind spot for other PHP developers new to Rails and thought I'd best help out.

Smoothing Loaded Images in AS3

Wed Jun 23 06:11:51 2010

Today, there I was, sitting at my desk working hard on a project involving loading images into a ActionScript constructed gallery. I needed the images in the gallery to animate and scale, as one would expect to be able to do with rich internet content.

Herein the problem lies, because the images looked very pixelated when they did anything other than just remain still.

Now, this isn't a big problem if you know how to go about it the right way, but I would imagine that there are tons of people out there who need to do the same kind of thing in their galleries, and probably 9 times out of ten are frustrated by the quality of the images output in the flash player. After all, rich internet applications should display rich image content. Then it hit me! Why not write a little about it here and spread the message that, although the flash player can sometimes be a CPU hog, it is something special, even when dealing when dealing with images.

As you will have probably seen by now, in the top left of this post there is a .swf file playing a scaling image, which reads "I love AS3" (and I admit proudly that I do). At the bottom of the swf there is a button, which when pressed will add/remove bitmap smoothing to the image loaded. Smoothing in ActionScript 3 is surprisingly simple and can be done by setting the smoothing property of any Bitmap instance to true. Take a look at the example below.

var ldr:Loader = new Loader();
addChild(ldr);
ldr.scaleX = ldr.scaleY = 5;
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
ldr.load(new URLRequest("myImage.jpg"));

function imageLoaded(event:Event):void{
   var contentToSmooth:Bitmap = event.target.content;
   // contentToSmooth.smoothing = true;
}

If we were to compile this code as it, assuming we've entered the correct URL to the image, we should see our image scaled by 5x and looking quite pixelated depending on how high the quality is of the image used. Now all we have to do to see the effects of smoothing is uncomment line 9 by removing the // from the beginning and recompile. This time you should notice a much less pixelated image displayed, even at 5x the size.

If you're interested in the example at the top left of this post, you can download the source code below.

Download BitmapSmoothing source code

Sequal Pro - Impressive!

Mon May 24 01:11:56 2010

I've been working a lot in PHP lately and almost always to connect to a mySQL database. I'm used to working in Terminal and the command line to create, read, update and delete (CRUD) my web pages and for people just starting out with mySQL, there is of course the more user-friendly phpMyAdmin. However, I've been mooching around the net and stumbled upon something I now don't know why I hadn't searched for before - Sequal Pro.

So what does it do?

Sequal Pro is a database management software and it's quite quite slick, let me tell you. There is virtually no wait time for pages of information to reload/refresh, as opposed to using phpMyAdmin, and it's more visually convenient than using the command line as it has a really easy to use GUI which allows you to view databases, tables and their contents with a few clicks of the mouse. The best thing of all is that it's free. You can check it out here on the Sequal Pro web site.

I am so impressed with this little gem that I wanted to post a recommendation here to urge everyone who uses mySQL to at least try it out.

Loading Fonts at Runtime with latest Flex 4 SDK

Tue May 11 03:27:29 2010

I wrote a post a while back about loading fonts at runtime. Nothing there has really changed, but I did want to clarify one thing on here. I just discovered that when embedding fonts with the lastest Flex 4 SDK, I got an error with the following

[Embed(systemFont='OCR A Std', 
fontName="OCR",
mimeType="application/x-font",
unicodeRange="U+0041-U+005A")]

The error read:
Error: exception during transcoding: Cannot embed local font 'nameOfFont' as CFF. The CSS @font-face 'local()' syntax is not supported. Please specify a path directly to a font file using the 'url()' syntax. For [Embed] syntax the 'systemFont' attribute is not supported. Please specify a path directly to a font file using the 'source' attribute.

I found that adding the following solved this problem.

[Embed(systemFont='OCR A Std', 
fontName="OCR",
embedAsCFF='false',
mimeType="application/x-font",
unicodeRange="U+0041-U+005A")]

" No transcoder registered for mimetype 'text/fxg' " Error

Sat May 8 17:43:39 2010

Well, this has really bugged me for a while now... I've been using an older version of the Flex 4 SDK until recently and have never had this problem. When I downloaded the latest nightly, I was struck with the fear that I would never again be freely able to use FXG the way I had previous. I just couldn't understand why the Flex 4 SDK wouldn't be able to transcode Adobe's shiny new toy - FXG. It just didn't make sense. I actually wrote another rather popular post about how to embed FXG in ActionScript which showed the following method of using FXG.

The following doesn't seem to work using the latest Flex 4 SDK releases


[Embed(source='Flower.fxg')]
private var Flower:Class;		
private var flower:Sprite = new Flower();

But why wouldn't something that worked before, work now? For a moment, I thought it was a way to make you buy software that supported this feature, but that didn't make sense either, since the SDK is free as well as having an open source version.

Then it hit me. I'd remembered watching a video that someone from Adobe (at least he said he was) had posted online. The video showed something along the following lines

This seems to works fine!


import Flower;
var flower:Flower = new Flower()
addChild(flower);

I could never get this to work in the older versions of the Flex 4 SDK but that's right folks! What was pretty simple before has become even simpler! Now just treat the FXG graphic as you would any other class and the magic is retained. In the words of David Bowie, "Wham bam thank you mam!"

Most recent posts

  1. Rain or Shine - Weather Forecast Available Now!
  2. Getting around Apple's silly rules for iOS 10
  3. Localising App Names for iOS and Android
  4. Today - Powerful To-Do App Now Available on iOS & Android
  5. New app 'Gem Plinko' Released on iOS

Search site:

Apps by Ubacoda.com

Click the app icons to see more info


Archives

Categories