Salient Digital Techno Blog

Ramblings on technology with a dash of social commentary
RSS icon Email icon Home icon
  • How to Fix no acceptable C compiler found in $PATH on Mac OS X Lion

    Posted on May 16th, 2012 phpguru 2 comments

    If you have a need to compile Memcache or wget on Mac OS X Lion and are wondering why you are getting the error

    no acceptable C compiler found in $PATH

    on Mac OS X Lion, you’re not alone.

    Thanks to this post, I was able to fix my problem. Here are the steps.

    1. Run App Store
    2. Search for Xcode – it’s a free install from Apple
    3. Wait for awhile. Took 30min to download for me on a 20mbps connection
    4. Authenticate and let Xcode install. Once Xcode is installed you may be thinking you’re done. You would be wrong!
    5. Launch Xcode and run the mobile toolkit update (you can’t skip it, deal with it)
    6. Go to Xcode Preferences or press ⌘, (Command-comma)
    7. Click the Downloads tab -> Components list as shown below
      How To Fix C compiler error on Mac OS X Lion
    8. On the last row of the available downloads are the Command Line tools. Install them.

    You should be good to go after that!

  • How to use Setup Assistant to migrate to a new Mac

    Posted on May 15th, 2012 phpguru No comments

    I told you in a recent rant on this blog that I bought myself a new MacBook Pro.

    It truly is a glorious computer; perhaps the best laptop on the planet. It’s blazing fast, ultra quiet, and it’s built like a Sherman tank, but is as sexy as a Ferrari. With Unix under the hood, Apache, PHP and MySQL preinstalled, it’s a web developer’s dream machine.

    I always look forward to setting up a new computer for the first time, but instead of starting from scratch as is my normal approach, this time, I decided to use Apple’s built-in Migration Assistant.

    How to use Migration Assistant to transfer files from another Mac is the name of KB article HT4413 at Apple.com. If you’ve already created your account on your Mac for the first time, but want to migrate a profile (your user account, applications and files) from a different machine or Time Machine backup, using Migration Assistant is the way to go.

    But if you already created your login on your new Mac, read carefully:

    Important info not obvious on Apple’s KB article

    Using Migration Assistant, your old files will be copied to a new, alternate, secondary profile on your new Mac. In other words, if you logged in as ghoffman on your old Mac, and you already created a fresh, new profile ghoffman on your new Mac, you can’t use Migration assistant to get old ghoffman copied into new ghoffman. You can use Migration Assistant to restore ghoffman (old) to ghoffman2 or ghoffmanNEW or any other alternate named profile, just not the one you probably want.

    If you have not yet created your user account on your new computer, or if you are willing to format your Mac and restore it to factory default settings, there is a little-known startup configuration mode when you first boot Mac OS X. It’s called Setup Assistant.

    The first time you start up a new Mac, on one of the very first screens, even before entering your name for creating your account, you have the option of using Setup Assistant, which may be better named First-run Migration Assistant.

    Using Setup Assistant at first-run is by far the fastest way to get going on a new Mac. I was extremely impressed at how simple and complete it was. Just like Migration Assistant, you have a several options as far as the source and transfer method, including using your other computer (as a disk in target mode) or from a Time Machine backup. I chose to use my Time Machine backup over FireWire 800. Other transfer options include USB, Ethernet and Wi-fi.

    I was able to restore my Mac OS X Snow Leopard account on a 250GB MacBook Pro 17″ (Aug 2008) onto a new i7 processor 750GB MacBook Pro 17″ running Lion, in about 2 hours. Over 200 GB of data were restored, including my login username and password, all my keychain files, every document, every application – even Adobe Creative Suite, Microsoft Office, iTunes, iPhoto – everything! Even my ~/Sites folder for web development, with all my local MySQL databases, were perfectly restored.

    I’ve really got to hand it to you, Apple. Not only is this laptop amazing hardware, but your software is extremely good, too.

    Now I just need a new iPhone. And an iPad.

     

  • Epson Printer Driver Update is 922 MB?

    Posted on May 14th, 2012 phpguru No comments

    I just got a new MacBook Pro with Lion installed, and I love it. I used the Setup Assistant (very similar to Migration Assistant) to transfer my account from my old MacBook Pro to my new one. The process was wonderfully simple, seamless and successfully transferred 99.99% of my files, documents, applications and settings.

    After running Software Update to check for the latest system and software updates, I am told I need to download the Epson Printer Driver software update… for a whopping 922 mb!

    Seriously, Epson? Sure, I have a fast connection, but not everyone does yet. Forcing your users to download a gigabyte of software when we own at most, one or maybe two of your printers? Why must I keep drivers for every printer you ever made on my computer? That’s just insane.

    Your printers are pretty decent but your programmers are seriously lazy.

    Here’s another way we end up paying more for everything.

    The more printers Epson makes, the more code they stuff into their bloated driver download. The more we download, the more our ISP’s incrementally charge us for bandwidth.

    It’s a printer for gosh sakes. Didn’t printer drivers used to fit on a floppy?

  • How to gracefully handle WordPress plugin activation errors?

    Posted on February 25th, 2012 phpguru No comments

    Things I learned while attempting to build a custom WordPress plugin…

    A) The documentation is far from clear.
    B) There’s lots of ways of doing it
    C) Many blog posts exist around the net with tutorials and examples, and many of them are outdated
    D) Proper, logical coding practices and assumptions do not work.
    E) You have to just mess with it until it works.

    I inherited a fairly large 15-domain WordPress multi-site which uses Ajax, inline dynamic CSS, and inline dynamic Javascript throughout the theme. Page load times without caching are anywhere from 7 to 15 seconds per page. I can’t have page load times this long, so I should use caching, I think to myself.

    “The world is already flooded with blog posts about how great W3 Total Cache is and how terrific Super Cache is and how fantastic Bat Cache is. Surely one of these will work for me,” I think to myself.

    But alas, I tested using each of these plugins on my site and none of them really did the trick. W3 Total Cache actually broke my theme completely and threw errors; Super Cache didn’t help much either. And Bat Cache was just complete rubbish. Discouraged, I decided to write my own plugin from scratch. So, off I go.

    I’ll write a custom caching plugin that uses Memcache.

    After a week of off-and-on development, I got my caching plugin working extremely well: What was up to 15 seconds is now sub 300ms! Same page, same WP Multi-site, one plugin with only about 300 lines of code. But it only works in a highly-controlled environment. I want to put it up on the WordPress site so others can use it, but before I can release it into the wild, I need to make sure it’s really polite about errors and easy to work with.

    Specifically, I have these 3 simple goals to finish it up:

    1) If you don’t have the Memcache extension installed when you try to activate the plugin, it needs to display a warning message about missing extension;

    2) I want to use the standard h2 error message to display this error to the user; and

    3) I want the plugin to remain deactivated if activation fails.

    You would think the WordPress Codex, Plugin Resources and Plugin API Documentation would be chock full of great examples for Plugin developers, wouldn’t you? I did, too, but unfortunately this just isn’t the case.

    I’ll give examples of A through E above, and hopefully explain how I was able to achieve the proper implementation points of 1, 2 and 3.

    How do you handle WordPress Plugin Activation errors gracefully?
    This post says to use the wp_die( ) function.

    I tried that and it actually does prevent the plugin from getting activated.

    This post suggests that you should just let the fatal error happen and display a slightly better error message in a status box. Terrible idea, IMO.

    Better to use this. Render red error messages in h2′s like this post shows. I’m trying to combine these concepts into a single, elegant solution and having a real rough time of it.

    I think the only way to do it is like HungryCoder says, you have to freaking ob_start and catch the error with output buffering…

     

  • Facebook Update Status Error

    Posted on February 18th, 2012 phpguru No comments

    Even the best of us mess up sometimes.

    See, nobody’s perfect. Not even Facebook. (Ha! Far from it, right?)

     

    I’m not able to post an update status at the moment. I thought I’d document it.

     

    Not bad, though, Facebook IT team, I think you have, what, 99.9999% uptime?

     

  • Top 10 Redis Resources Online

    Posted on February 4th, 2012 phpguru 2 comments

    Chances are you’ve heard of Memcache. Tons of websites use it to speed up page load times. I often say that Redis is like Memcache on steroids. You may not have heard of Redis, but if you’re using Memcache or APC, you should see how Redis could improve what you’re already doing. If you’re not using Memcache or APC yet, don’t bother – I urge you to take a look at Redis for a bunch of reasons.

    First, Memcache is a key-value store only. You set a string value under a string key, and that’s it. With Redis, on the other hand, you have the luxury of several different types of data storage, including keys and values, but Redis also supports hashes, lists, sets and sorted sets.

    An example to help explain why this is such a huge improvement. Say you have a big array of data, such as the kind that can come back from a web service request, like a parsed XML file or JSON packet. With Memcache, to store this in memory you have to serialize the data, often base64 encode the data, and then store it on the way in, and then to get a portion of the data back out again, you have to get the whole string, base64 decode it, deserialize it and then you can read from it. These extra steps needlessly chew up compute cycles.

    With the same data object stored in a Redis Hash, for example, you can have instant access to the data stored in any key of the hash, you don’t have to grab the whole thing, deserialize it and all that mess. Just a single line of code, and boom, there’s your data. Much more elegant.

    Another key reason Redis is superior to Memcache is that when you ask Memcache to store something, it’s in memory and that’s it. If your server goes down and you have to reboot, you have to repopulate your Memcache data over again. If your app has gotten huge, and your cache is huge, this can not only take awhile but puts a huge strain on your database server during this so-called “cache warmup” period. Unlike Memcache, Redis actually stores a copy of its data to a file on disk in the background, so if you stop and start your Redis server, it reloads everything automatically. It does this mind-blowingly fast, too, like millions of keys in seconds.

    Finally, Redis supports master-slave configurations that you can use to build high-availability systems more easily. In the upcoming release (everyone is very eager for) Redis Cluster will support sharding out of the box!

    So, now that you want to dig in and start learning Redis, here are my…

    Top 10 Redis Resources Online

    1. Redis documentation: redis.io/commands
    2. Try Redis Online: try.redis-db.com
    3. Redis-DB Google Group List Archives: groups.google.com/group/redis-db
    4. Antirez (Redis developer Salvatore Sanfilippo’s) blog: antirez.com
    5. Recent blog posts about Redis: RSS Feed
    6. Q&A: stackoverflow.com/questions/tagged/redis
    7. The Little Redis Book – Just released openmymind.net/2012/1/23/The-Little-Redis-Book
    8. Slides from Redis Tutorial simonwillison.net/static/2010/redis-tutorial
    9. A Collection of Redis Use Cases www.paperplanes.de/2010/2/16/a_collection_of_redis_use_cases
    10. My GitHub Page. Chock full of Redis-related project forks. github.com/phpguru
    11. Bonus: Here’s a slideshow for a Redis 101 talk I gave if you’re interested.
    Notes
    You may be wondering about NoSQL and where Redis fits into this discussion. When people bring up NoSQL, I tend to think of MongoDB. Unlike Memcached and Redis, MongoDB is a general purpose document/object (think JSON) store that (strangely enough) allows you to use some SQL-like commands to retrieve subsets of your data. I think of Redis as a data structure server. You don’t use SQL to talk to Redis, so I guess it could be considered along with other NoSQL solutions. You can compare Redis to MongoDB by going to try.mongodb.org/

     

  • Aggregated Kohana 3 Links

    Posted on February 2nd, 2012 phpguru No comments

    SQL Transactions with Kohana 3 – Note: Transactions were added in Kohana 3.1

    StackOverflow Questions tagged Kohana-3 – Look for answers by Kemo, Samsoir and the other Kohana developers

    KohanaFramework.org/discussions – Official Kohana Framework user forum

    Kohana 3 ORM Tutorials and Samples – Terrific example usage of Kohana’s built-in ORM library

    Kohana 3.2 Complete Tutorial – Quickly documented on the site, but comes with downloadable sample application

    Useful Kohana 3.2 Modules & Code – Here’s BadSyntax’s link list of useful Kohana modules (Kohana OAuth 2.0, Media Compression, Minion CLI Task Runner, Minion Tasks Migrations, Kohana 3 Project Template, Pagination, Manage Site View Assets)

     

    Blogging about Kohana 3.2? Get the RSS Feed


     

     

     

  • Configure Subversion with Apache and Security in 5 Easy Steps

    Posted on January 19th, 2012 phpguru No comments

    I’ve been running WampServer for years on my trusty Dell XPS running Windows XP Pro. A while back I installed Subversion and got it working with mod_dav and authz_svn to serve multiple repositories, each with their own user and group permissions. It was tricky to set up and there are some finer points that most documentation I read doesn’t address. I followed a few different web resources like this great beginners guide, but ultimately it boils down to the 5 simple steps below.

    Just recently I needed to add a new repository. I thought I had done everything right, but when I went to use it for the first time, I got the following errors:

    D:\svn\repos>svn mkdir http://localhost:8080/svn/myproject/trunk -m "Trunk"
    svn: OPTIONS of 'http://localhost:8080/svn/myproject': 200 OK (http://localhost:8080)
    D:\svn\repos>svn ls http://localhost:8080/svn/myproject/trunk
    svn: URL 'http://localhost:8080/svn/myproject/trunk' non-existent in that revision
    D:\svn\repos>svn ls http://localhost:8080/svn/myproject
    svn: Could not open the requested SVN filesystem

    If you are getting any of these common errors, this post is for you.

    When using svn over http, you have to use Apache’s configuration files to control access to each repository separately. Start by installing Apache, Subversion, and then referencing these three modules in your httpd.conf as follows:

    LoadModule  dav_module             modules/mod_dav.so
    LoadModule  dav_svn_module         modules/mod_dav_svn.so
    LoadModule  authz_svn_module       modules/mod_authz_svn.so

    Now we’re ready to begin.

    1) Add the repository:

    #> svnadmin create D:\svn\repos\myproject

    *(On Unix systems, chown -R myproject so it is writable by the user Apache runs as)*

    2) Edit your httpd.conf (or extras/httpd-vhosts.conf) adding something like this:

    <Location /svn/myproject>
       DAV svn
       SVNPath d:/svn/repos/myproject
       AuthType Basic
       AuthName "My Project SVN Repo"
       AuthUserFile c:/etc/svn-auth-file
       Require valid-user
       AuthzSVNAccessFile c:/etc/svn-acl
    </Location>

    3) Add the project to your svn auth file at c:/etc/svn-acl (it’s referenced in the Location directive in your Apache config.)

    [groups]
    yourgroupname = yourusername, user_b, user_c
    [myproject:/]   
    yourusername = rw
    @yourgroupname = rw

    This is what tells Apache which users and groups are allowed to access the path(s) in your repository.

    4) Give yourusername an htpasswd (and user_b and user_c)

    cd c:/etc/
    htpasswd -c svn-auth-file yourusername

    *(If that file already exists, omit the -c option)*

    5) Finally, restart Apache

    httpd -k restart

    Then you’re ready to create trunk

    #> svn mkdir http://localhost:8080/svn/myproject/trunk -m "Adding trunk"
    
    Committed revision 1.

    I got the errors shown above when forgetting step one or more of these steps.

     

  • Help stop SOPA/PIPA before it’s too late

    Posted on January 16th, 2012 phpguru No comments

    I’m rather ticked off by politics in general.

    One of the main things politicians are doing with more and more regularity is to pass legislation almost behind our backs, every day chipping away, little by little, more and more of our precious freedom. Freedom is what makes America great. Countless patriots have died protecting it. Why is it the present crop of politicians believe it is their duty to protect me from myself?

    They’re at it again… with this SOPA / PIPA business. This time, it’s going to hit home for many of you readers. SOPA is the Stop Online Piracy Act and PIPA is the Preventing Real Online Threats to Economic Creativity and Theft of Intellectual Property Act of 2011. Only a politician could write a bill with a name as horrific as its intent. While these bills may have good intentions, in practice it’s just a giant fiasco as usual.

    What’s this all about? AmericanCensorship.org puts it bluntly:

    Congress is about to pass internet censorship, even though the vast majority of Americans are opposed. We need to kill the bill – PIPA in the Senate and SOPA in the House – to protect our rights to free speech, privacy, and prosperity.

    If you like the freedom to read, comment on and post about whatever you like on your blog, or around the internet, don’t let the government shut you down, or tell you what you can or can’t link to, or fine you for failure to comply. It’s just one more way the government is trying to step in and tell you how to run every aspect of your life. It’s time to say NO!

    Let your voice be heard! Learn more at the Fight SOPA/PIPA page at WordPress.org.

    The internet is fine just how it is, thank you. Now leave it alone!

     

    Think I’m kidding?

    11/2011 – House Takes Senate’s Bad Internet Censorship Bill, Tries Making it Worse at ArsTechnica.com

    1/16/2012 – SOPA/PIPA: How Far We’ve Come; How Far We Need To Go at TechDirt.com

    1/16/2012 – In SOPA, PIPA protest, Wikipedia to black out at Politico.com

    1/16/2012 – SOPA, PIPA Headed For Major Makeover at HuffingtonPost.com

    1/16/2012 – SOPA vs. PIPA: AntiPiracy Bills Explained at DigitalTrends.com

    1/16/2012 – The White House & SOPA: Reading Between the Lines at Mashable.com

     

    Please pass it on…

     

  • Free Music Online – DJ Sets, Trance, Techno and More

    Posted on January 4th, 2012 phpguru No comments

    While I’m listening to streaming radio via iTunes or Pandora, I typically try to keep an eye out for new tracks that I like and write the artists names down to search for later.

    During this process I end up finding lots of new websites dedicated to electronic music, DJ remixes and so on. Here are a few of my favorites.

    On www.hybridized.org search for DjKira aka Nick Lewis.

    Join hybridized.org to download basically everything without limits.

    On www.sense.fm check out Ashley Bonsall – Into Trance 011

    On sense.fm, go to the forums and you can download complete DJ sets for most of the tracks they spin.

    Just listen at www.protonradio.com.

    With the protonradio free streaming player you get some of the best dance, trance and electronic artists of our time.