First look at the new Daily Camera website

Here is literally the first look I had at the Daily Camera’s proud new web site

Daily Camera's new web design

Posted in Uncategorized | Leave a comment

MacBook Air, Windows 8(.1), and Hardware

I’m replacing my notebook and mac mini with a new MacBook Air. My notebook runs Windows, so Boot Camp (version 5) is an essential part of the equation.

Last night was my first attempt. Call it 3 hours and 4 attempts. So far, I still do not have a Windows notebook computer.

There are two scenarios I’ve tried, and the each fail in a different way. The major pain point, however, has to be the download of Windows drivers from Apple.

Windows 8.1

I downloaded the Windows 8.1 preview ISO and followed the instructions on the Boot Camp 5 assistant. I waited—a long time—for the assistant to download the Windows drivers. When it was finished, it rebooted and automatically began to set up Windows. Several minutes later, I had a copy of Windows 8 running on my mac. Neat.

Problem is, there was no network. No networks were available, and the network adapter wasn’t even working.

Windows 8

No problem, I thought. I’ve demonstrated that it’s possible to run Windows on my mac. Plus, I’d rather have my licensed copy of Windows 8 (not the preview of Windows 8.1) so that I don’t have to reinstall everything when the preview expires.

So I go through the motions. I wait—a long time—for the assistant to download the Windows drivers. Then it eventually reboots to set up Windows. I click Next on the screen that asks about language settings. But eventually I get to the welcome screen where it asks me to choose my favorite color and enter my name. And I can’t do anything. Keyboard doesn’t work. Trackpad doesn’t work. (How was I able to click Next only a few screens ago?) The only button that works is the power button, and it won’t even boot into OSX.

Luckily I read about holding the Alt key down while powering the thing on, and I can bail out and back into OSX.

Windows 8.1 Again

By this time, it’s several hours later and I’ve forgotten that the 8.1 install didn’t have the network, so I went through the whole mess again. I wait—a long time—for the assistant to download the Windows drivers, and I let it reboot into Windows 8.1 Then, “Damn,” it hits me, the network card won’t work in 8.1.

Google It

All throughout the evening the Internet was not very helpful. Lots of people had the same issues, but most of what’s out there is problems with Boot Camp 3 (I have 5), and most of the information is just repeating the instructions I had already followed. One particularly unhelpful comment on a Mac bulletin board suggested that if more people read the directions, fewer people would have problems.

One piece of advice was to repeat the whole procedure using the left side USB port for the memory stick. Didn’t help. Another “answer” came from Apple itself, suggesting that I use a USB 2.0 memory stick instead of my brand-new, purchased-just-for-this-installation USB 3.0 memory stick. Maybe I’ll have to end up downgrading in order for this to work.

Meantime, I’m killing a few minutes before I can go to the Apple store to beg for help. That’s part of why I opted to get a more-expensive Mac laptop than a cheaper Lenovo or HP—there’s a store of tech experts in town who will help me—at least for the first 2 weeks. Here’s hoping they have better luck than I do.

Posted in Apple Mac OSX, Hardware | 1 Comment

Apache MultiViews automatically appends .html, but I don’t want it to

Hat-tip to Abdel-Karim Mardini for reminding me which Apache directive is poison. It’s Options MultiViews.

A client reported that WordPress pages weren’t working. For example, was showing a 404, even though WordPress had a page with that permalink. What was strange was that was showing a very old version of the correct page, which was stored on the file system as press.html.

I checked the code on my local server and looked through the apache log files. No help. I deleted all the directives from .htaccess. It was still happening. But I vaguely remembered that Apache “automagically” appends .html to certain URLs. Google was very little help, mostly showing me how to write apache rewrite rules. But since I had disabled .htaccess, I knew that wasn’t it.

I finally found Abdel-Karim’s summary, and sure enough, appending this to my .htaccess file, worked:

Options -MultiViews

Here’s hoping I remember to check my blog next time, before spending hours staring at log files and useless search results.

Posted in Uncategorized | Leave a comment

CakePHP logoutRedirect is not the same as loginAction

If you go through the CakePHP Auth example tutorial, you’ll end up with two (not three) configuration settings in your AppController > components > Auth settings. They will look like this:

public $components = array(
        'Auth' => array(
            'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
            'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home')

I unconsciously made the incorrect assumption that “logoutRedirect” would always take you to the login page. You log out.

You get redirected to the login page. But when I put my carefully crafted login page at pages/home. Yet when I visited my site without a proper cookie, I wasn’t redirected to pages/home. I was redirected to users/login. Where the heck was that coming from?

Turns out there is another AppController > components > Auth setting that specifies where the login action is found. When you add it to your other components, it will look like this:

public $components = array(
        'Auth' => array(
            'loginAction' => array('controller' => 'pages', 'action' => 'display', 'home'),
            'loginRedirect' => array('controller' => 'posts', 'action' => 'index'), 
            'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home') ) );

It seems that logoutRedirect is only used for where to go, immediately after logging out.

I wrote this post because a coworker had made the exact same assumption and mistake as I had.


Posted in CakePHP | Leave a comment

CakePHP Auth->allow only works on actions, not controllers

If you follow the CakePHP documentation on Authentication, you might end up with this line of code in your AppController.php file, in the beforeFilter() method.

$this->Auth->allow('view', 'index');

… And that’s fine for demo purposes. But that actually allows all view() and index() actions, on every controller in your application.

That’s not likely what you want. You will need to move that line of code out of the global AppController.php file, and put it in each SpecificWhateversController.php file, allowing whatever the specific actions you want to allow to users who have not logged in.

Posted in CakePHP | Leave a comment

WordPress “recent posts” file to be included on another page

I have a client who finally asked for something I told him we could easily do. He wanted the recent posts from their blog sub-site to be listed on a sidebar on their main site. We wanted a dynamic list of the most recent headlines, linked to the content.

Since we already spent the budget on “bigger fish,” Before I muddled my way through the WordPress templates, I did a quick web search to see if someone had already written my code for me. Sure enough, David Walsh, a respected developer whose work I already follow, had the answer. I’ll send you to his blog for the code.

Create a “Recent Posts” Module Outside of WordPress

Thanks, Mr. Walsh. Keep up the good work.

Posted in Web programming, WordPress | Leave a comment

WordPress replaces your menu with a single button

Actually, it’s not WordPress per se, but the TwentyTwelve theme. If you look at your beautiful site or blog on a small device, your carefully structured menus will be reduced to a one-dimensional abomination labeled “Menu.”

Wordpress reduces your menu to this

WordPress reduces your menu to this

Well-intentioned designers created this

Well-intentioned designers created this

In looking for a fix, I discovered that it was created by well-meaning theme developers. They think that if you’re viewing a site on a small screen, a larger menu is unusable, so they’re taking the decision out of your hands and “fixing” it for you, with no way for you to opt out.

Thanks, but no thanks.

Another commenter suggested it was made this way because “hover” states don’t work on touch-screen phones. Nice thought, except the decision to go one-dimensional isn’t based on touch input, it’s based on screen width. Plus, you can’t have a top-level navigation item in WordPress that isn’t a link — that is only a hover. So, again, nice thought, but no thanks.

What my client has found is that, although we offer a mobile site, some people like to see the regular, full site, and zoom in to what they are looking for. I’m not sure I agree, but who am I to argue? And who is WordPress to dictate? (Can you tell it’s late and I’ve spent too much time trying to track this “feature” down?)

Enough already. Here’s the fix.

Open the CSS file for your theme. Search for this phrase:

@media screen and (min-width: 600px) {

Change the 600px to 6px.

You’re done.

Posted in WordPress | Leave a comment