Category Archives: Uncategorized

PHP on Mac no longer able to connect to MySQL

It’s been a while since I did web development on my Mac, and MySQL ceased to work. Could be related to that one time that I accidentally removed a bunch of dot-files from my home directory, could be related to MySQL upgrade. In any case, it no longer worked.
What I figured out was that the /var/mysql/mysql.sock UNIX domain socket was no longer generated. The /var/mysql folder was missing. When just creating it and assigning it to user _mysql (chown _mysql /var/mysql) did not help, I knew something was wrong with configuration.

MySQL tries to read configuration from /etc/my.cnf. To get its UNIX domain socket where PHP expects it, this needs to be contained in this configuration file:

[client]
port = 3306
socket = /var/mysql/mysql.sock


[mysqld]
port = 3306
basedir = /usr/local/mysql/
socket = /var/mysql/mysql.sock
; datadir = /servers/raiddrive/databases/

Please read the manual for details, and this is not administration advice; I’m not sure if this opens security holes, but I only use MySQL for development purposes. (Because you should know better than letting programmers near mission critical production servers.)

Testing for presence of Apple platform in C/C++/ObjC code

Are we running on an Apple platform?
#ifdef __APPLE__
#endif
Prerequisite for other tests
#ifdef __APPLE__
// let Apple define 
// various TARGET_OS_ 
// constants
#include  
#else
// not on Apple platform
TARGET_OS_MAC 0
TARGET_OS_IPHONE 0
#endif
Are we running on Mac OS X?
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
….
#endif
Are we running on an iOS device?
#if TARGET_OS_IPHONE
….
#endif
// updated on Oct13 2010, previous method was flawed. sorry everyone!

Half Life 2: "Failed to load the launcher DLL"

All of a sudden, without touching anything (in fact, without booting Windows during last few days) I got this upon trying to launch Half Life 2:

Failed to load the launcher DLL: 


The specified procedure could not be found. 




Verifying files did not help me. The solution (for me)? I went to:


C:\Program Files\Steam\steamapps\ivucica\half-life 2\bin


and I moved all the .dll files away. Then I relaunched the game. Steam happily recreated all .dlls, and the game now works. I safely removed old copies of the DLLs.


Since I didn’t think of making a screenshot, image from http://www.hl2world.com/bbs/-vp666240.html

Apache 403 — one cause on Mac (and other Unixes)

Things suddenly broke, without installing web-server-related stuff, without touching apache config?

It’s probably permissions.
No really, you checked out permissions, and it looks ok. Really, “Sites” (or “public_html”) looks ok. However, the entire path needs to be fixed.

Check if each directory in full path to the file you want to serve contains at least executable permission for the web group, or “other” group. That is, on Mac this helped me:

chmod o+x /Users
chmod o+x /Users/ivucica
chmod 755 /Users/ivucica/Sites

What went wrong for me? I suspect Mac OS X 10.6’s disk check, or perhaps one other disk utility I recently used, messed up the executable permission flag of /Users/ivucica. I have no other explanation.

This tip would probably help under GNU/Linux too.

Steam Mac: Proxy error when accepting gifts

Getting the following error on Steam Mac when attempting to accept gift by clicking on link in the email?

Unable to connect to HTTP Proxy. Your proxy may be misconfigured or offline. -336

Unable to connect to HTTP Proxy. Your proxy may be misconfigured or offline.

Woah! But you don’t use a proxy, do you? Solution is simple. For all your Internet connections (just to be safe), in System Preferences, disable Auto Proxy Discovery. Click on screenshots to enlarge.

This worked for me, but your mileage may vary. Now, let’s report this on the Steam Mac forum…

What HTML5 needs to replace Flash?

Much is today said about HTML5. What is HTML5 precisely? HTML5 is Web 3.0. It’s integrated web video, it’s canvas, it’s SVG, it’s CSS3, it’s do-sickening-things-with-CSS3. It’s more Javascript technology and numerous Javascript objects than particularly interesting new HTML tags. (Apart from various special input element types.)

Yet, in this context, let’s consider HTML5’s potential for the so-called “rich content” — that is, let’s just consider how we could create animations and toons similar to what can be done with Macromedia Adobe Flash.

Flash is currently ubiquitous. Not because people love having another plugin in their browser; those aware of a concept of plugin don’t like having yet another plugin. Especially not the one that slows page loading; let’s remember Java applets. User doesn’t like browsers that crash; Flash Player can cause that to happen. User doesn’t like slow speeds that Flash Player delivers.

So who actually likes Flash? Content producers. Flash is an extremely likeable tool once you get to know it, and animation production is very rapid. It’s the RAD tool of web animation. Combine a true artist, skill in a pixel-based art tool (GIMP, Photoshop, PhotoPaint) and Flash, and you get one of those truly artistic movie web sites. Personally I hate the experience of those sites, but I admire the artists and designers who created the experience*. It’s a lot of work, and a lot of talent, all possible because you don’t have to have a geek programmer in the team, all possible because you don’t have one who’d say “Yeah, sorry, I can’t do that in Javascript that easily.”

That’s the key thing. You don’t need a geek to implement the animation. With Javascript animation, one could see a lot of cool stuff, “proving” that HTML5 is as good for animation as Flash. In fact, one can already find Smokescreen, a really awesome piece of engineering work that implements a Flash player with Javascript.

However, apart from Smokescreen, which again plays with Flash, every single Flash-like animation was tediously coded by a geek programmer. JQuery may make stuff simpler, but it’s not designer-material!

HTML5 animation needs proper authoring tools.
There is a market for HTML5 animation authoring tools.
Layers, tweens, reusable “symbols”, grouped “symbols”, vector elements, bitmap elements, at least basic early-Flash-style event handlers .. Give designers that, and they may jump on the Flash-less train.

In fact, even a geek like me will prefer using Flash, because doing HTML5 animation is tedious. Flash, despite being ruined compared to its early days, reigns as a creation tool.

I’m even willing to privately pay for an HTML5 animation tool. Not too much, but I’m willing.  Someone out there to snatch my cash? (Apart from Adobe, I don’t like them as a company.)

* I admire Flash artists — except those that create ads, I hate Flash ads passionately

Image courtesy of GretemanGroup.com/blog and FlashInYourFace.com