RSS
 

Archive for the ‘Operating Systems’ Category

Installing LAMP stack on OSX 10.6 Snow Leopard

18 Sep

I’m setting up a new machine and found a great tutorial written by Josh Lockhart on getting a PHP web development environment up and running on Snow Leopard.  This goes through almost everything to be up and running for a typical LAMP stack with unit testing using all of the default services.

Josh’s instructions include everything that I need except mcrypt.  Luckily Michael Gracie has provided a walk-through for installing mcrypt on Snow Leopard which involves re-compiling some things, but isn’t as tough as it first appears.

After getting PHP and mcrypt going, the last step for me is setting up MySQL which has some caveats on OSX.  The main problem is that the MySQL installer places the mysql.sock file in a non-standard place and so you have to either create a link or alter your php.ini file before PHP will be able to talk to MySQL.  (If you get “Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’” or  “No such file or directory” when calling mysql_connect, then this is the problem)

Read the rest of this entry »

 
7 Comments

Posted in MySQL, OSX, PHP

 

PHP on OSX: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'

07 Jan

When installing PHP and MySQL on OSX  you may get the error Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’.  Or you may also get “No such file or directory” when calling mysql_connect from a PHP page.  This occurs because PHP is looking for the file mysql.sock in it’s typical installation location of /var/mysql/mysql.sock. However the MySQL OSX installer actually puts the file in /tmp/mysql.sock. There are two easy ways to solve the problem.

Read the rest of this entry »

 
8 Comments

Posted in *NIX, MySQL, OSX

 

TortoiseSVN for Apple OSX

06 Jan

tortoise_on_osx

TortoiseSVN is my personal favorite SVN client, unfortunately it’s only fully supported on Windows.  With a little bit of hacking, though, TortoiseSVN is usable on OSX.  You can checkout, commit, update view the repo, etc.  At this point there are no overlays or Finder contextual menus.  These instructions are not for the novice user, but chances are if you’re using SVN it shouldn’t be a problem.

Read the rest of this entry »

 
3 Comments

Posted in OSX

 

Monitor Log Files in Realtime with LogFileMonitor

28 Oct

In order to more easily monitor some web services that we have running, I whipped up a quick .NET app to monitor log files in real-time.  I got a little bit carried away and wrote more than I needed, but I think this app will save a lot of time in the long run.

The app is called LogFileMonitor and it’s available at google code.  You can download a Windows binary or the full source (GPL3) at http://code.google.com/p/logfilemonitor/.  A screenshot and feature list are on the google code page.

If you’re a software developer and have any interest in participating, drop me a line.  It would be nice to have a Mono port so the app can run on any OS.  Currently it only runs on Windows.

 
 

Binding Flex TextInput UI Controls to a DataProvider

16 Sep

In Flex when you bind data to a UI control like a DataGrid, the grid cells refresh every time the dataSource changes. The reverse is also true if the DataGrid is enabled for editing. That is, the dataSource is also updated when you edit a cell.

The TextInput can be bound as well so that when the dataSource changes, the value of the TextInput will automatically update. However, unlike the DataGrid, changing the text of the TextInput will not automatically update the dataSource. Take the following code for example (assuming “source” is a String variable):


When the TextInput is changed, the value of source remains the same. It’s only bound one-way. If you want the value of source to be updated when TextInput changes, it’s actually easy, but there are at least five (5) different ways to do it of which I know. For the most straight-forward two-way binding, you could update the TextInput code like so:


Technically source is not bound to the TextInput, but it does produce the desired result. source is updated manually whenever the valueCommit event fires. The valueCommit event fires when the TextInput text has been changed onBlur (ie when when TextInput loses focus). If you prefer source to be updated on every key stroke, you can change valueCommit to change instead and the update will occur on every keyUp. If I’m updating a database or making a service call, I prefer valueCommit so the back-end code only fires once after the user is finished updating the field. If the TextInput is an ajax-style auto complete or lookup, the change event might be more desirable so the application can react after each key stroke.

As I mentioned there are five methods to do this. You can bind controls using Flex’s binding features in either MX code or ActionScript. Depending on your application one may be better than the rest as far as keeping your code clean and consistent. For the most part they all achieve the same result. Attached is source code that demonstrates all five techniques:

Download TextInputBinding.zip

If you know of any other ways to bind data to UI Controls, please post a comment.

 
12 Comments

Posted in *NIX, AIR, Flex