FTP on your Centos server

If you run WordPress on a Centos server, you will discover that you need an ftp server to support automatic updates. There is a good article on how to do that here:

https://www.digitalocean.com/community/articles/how-to-set-up-vsftpd-on-centos-6–2

However, you also need to follow the instructions in the comment by nest.u333:

https://www.digitalocean.com/community/articles/how-to-set-up-vsftpd-on-centos-6–2#1372265397

And with that, you can use WordPress auto-update.

 

PHP’s future is… meh.

Acknowledged:

  • PHP is used in many, many companies.
  • PHP is used in some big companies like Facebook and Yahoo.
  • PHP has many developers.
  • PHP has apps that are not going away in the foreseeable future.
  • PHP has apps that are never going away. (WordPress and Wikipedia, to name two. There are more.)

Yes, yes, yes, yes, yes. All true. But if you are a PHP developer, now would be a good time to start learning something else…

My argument hinges on the idea that no growing company “switches” to PHP. You either start with it, and grow the company, or you never do use it.

See, if you scan the links at TechCrunch.com, you’ll never see a startup that launches on PHP. Actually, I don’t think I’ve seen one in a decade now. (Does Identi.ca count?) Starting around 2006, PHP startups were replaced by Rails startups, which gave way to Python startups, which gave way to nodejs startups. Not being part of the startup scene means that no companies are going to suddenly grow big, and find themselves supporting an installed base of PHP (as Facebook did).

I hope you’ll agree that none of today’s startups are going to switch to PHP at some point. Twitter switched from Rails to Java/Scala, for example. Not to PHP.

Which, I submit, means that PHP will slowly (ever so slowly) fade away.

But take heart my PHP friends! If you just need to eke out another decade or so until retirement, I think you have plenty of runway. There are countless organizations with WordPress/Drupal/Joomla.

Did you know that Hawaii built their state-wide Obamacare site on WordPress? How neat is that? At the same time, I think it exposes the glass ceiling for PHP: cost-constrained organizations, that will accept something “good enough”, and have reasonable scaling requirements (Hawaii has just 1.4MM people, same as San Diego).

Meh.

 

No market for mid-range chromebooks

I reluctantly convinced myself that there is no market for mid-range chromebooks. In fact, there is no high-end market either, despite the existence of the Chromebook Pixel.

In the world of computers, there are:

  1. high-end, pricey, powerful models
  2. low-end, affordable, frustratingly underpowered model
  3. mid-range models, that cost somewhat more than the low-end, but perform so much better

Those who know their stuff buy and recommend mid-range computers. The extra money is well spent.

The Pixel is crazily overpriced for what you actually get. It is clearly a boutique product, sold and supported by the sugar-daddys at Google. Note that we are going on a year now, and no one else has moved to produce a high-end chromebook. Enough said.

Low-end chromebooks are the breakout success story of 2013. Acer announced that chromebooks are their best-selling products. Seemingly every PC maker has one, or is announcing one. Weirdly, no one is trying for the mid-range…

Let me define my terms: A mid-range chromebook has 4gb of ram, 32gb (or more) of storage, and a high-resolution display (say, 1920×1080).  It sells for $400+.  Who makes that today? No one. Who has a announced something in that category? No one.

Look around the current offerings. Everyone is stuck on 1366×768 screens. I don’t understand. The Nexus 7 (2013) has 1920×1200. The Samsung Galaxy Note 10.1 (2014) has 2560×1600. Why do android tablets routinely trounce chromebooks on screen quality?

As for ram, you basically have to settle for 2gb. Walmart and Costco both offer versions of the HP 14 that have 4gb. The Costco version, with 32gb of storage comes closest to my mid-range machine. It is dragged down by that crappy screen.

Acer, whose C720 series won all the awards last year, briefly sold a 4gb edition. Then they stopped. The 4gb edition is now only available from ebay resellers, at premium pricing.

Price is king in the land of chromebook. Straying above $300 is risky, based on what I see out there. I’d love to get a mid-range chromebook, I just don’t expect to see one for a couple of years.

 

Node on CentOS 5

You can easily install node on CentOS 6 using yum. On CentOS 5? Not so much.

My journey began on this page, which is half right. You need to install python 2.7, just so:

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -xf Python-2.7.3.tgz
cd Python-2.7.3
sudo yum install gcc
./configure
make
make altinstall

The second half of that page describes a way of installing node that no longer works (because nodejs.tchol.org no longer exists). So…

Visit http://nodejs.org/download/, and copy the download link for the latest node tarfile (ie, http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz). Next:

wget http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
tar -xzf node-v0.10.25.tar.gz
cd node-0.10.25
python2.7 configure
sudo yum install gcc-c++
make -j5
sudo make install
node --version

Voilà!

The vast right wing conspiracy to suppress RAM

14 months ago, I bought a new laptop. It only has 4GB, and it’s not upgrade-able. But it was only $600, and I figured I’d be able to buy a better one in a year or so, passing this one down the family food chain.

Really, 4GB is a minimal configuration on a modern Windows machine. I thought for sure the trend would be towards 8GB by now. In fact, desktop PCs all come with more than 8GB now. But search in vain for an 8GB laptop.

Oh, they are out there. For premium prices. In the under-one-thousand-dollar category, you seemingly get the choice of heavy + RAM, or light + no RAM. Adding insult to injury, the new “thing” is to solder the memory to the motherboard, preventing upgrades.

Let me spell it out for you: I want a light laptop, with 8GB, for under $800. I haven’t seen one yet.

Meanwhile, over in Chromebook land, they are stuck at 2GB. Again, this is really the rock-bottom minimum. You can have a much nicer Chromebook experience with 4GB. But there are only a couple of models that offer that, and they are either perpetually out of stock, or priced well above Chromebook’s value proposition.

And don’t get me started on these so-called Windows 8 tablets with just 2GB. Remember single-tasking? You will if you buy one of these tablets.

There is also a conspiracy against increasing screen resolutions. But I’ll save that for another rant.

 

Costco Bourbon

Another in my tradition of reviewing by quoting others.

I bought a bottle of Costco’s bourbon tonight. The label says it is a 7-year-old small batch. The internet is rife with theories on what it really is. I’m not qualified to say. Instead, I’ll selectively quote from “‘s” review:

At 103 proof, the stuff is extremely hot when drunk straight; what few notes come through the alcohol burn are overpoweringly oaky and sour.  Adding a bit of water, or serving it on the rocks, helps some; the flavors open up, allowing some charcoal and molasses notes through and giving it a bit more complexity.  It does, however, still burn significantly on the way down; this is pity party bourbon of the first degree.

In all fairness, it’s not without its charms – it mixes up into a perfectly decent whiskey sour, and the strong flavor would probably work very well in bourbon lava cakes.  But I wouldn’t really recommend it straight, unless you enjoy the sensation of having your taste buds scalded into submission.

 

 

“Derek” – cut and paste review

I learned, long ago, that anything I watch or read has been reviewed by someone more pithy than me. Accordingly, I present my cut-and-paste review of Ricky Gervais “Derek”:

(Cutting and pasting from Brian Lowry’s review in “Variety.”)

Gervais himself is the weakest link in what’s otherwise a thoughtful, sometimes-moving seven-episode run.

Hey, no kidding, After two episodes, I started ignoring everything Gervais does on screen. He has gone full retard in this role, and it is not pretty.

Stick with it, though, and “Derek” begins zeroing in on significant issues — the power of kindness, the nature of mortality and the notion of caring for those who can no longer do so for themselves.

This is the worthwhile part. Derek is not a comedy, it is a drama. A good one.

The title notwithstanding, the real star here is Godliman as Hannah, who is both terribly protective of Derek and so committed to her job she risks sacrificing a potential romance that has come into her life. Wonderfully relatable, tough yet vulnerable, it’s easily the best female character to come from Gervais.

Agreed. You keep watching this show to find out what happens to to Hannah, not Derek.

Unexpectedly poignant and only sporadically funny. … Although it takes awhile to grow accustomed to Gervais’ character — a seemingly autistic man working in a struggling convalescent home — the show is filled with a beguiling sense of melancholy, and a knockout performance by Kerry Godliman as the facility’s caring administrator.

Yep.

 

 

What if there was a Microsoft iPod Touch?

It occurred to me that if Microsoft sold an iPod Touch-like device, but with Metro interface and apps, I’d buy one. Metro is slick. It would be really nice to use it on a small, affordable (sort of) touch screen.

But then I thought some more… Microsoft would, of course, only allow syncing via a proprietary, non-great music store app. And that app would transcode all my mp3s into wma. After which, I would be locked in the Microsoft trunk.

So… nevermind.

 

Adding unix commands to Windows

Update 4/2/2014: Forget everything below. The right way to do this now is:

  • install git
  • use git bash as your command shell

We programmers love our unix commands.  Which is why so many embrace MacOS: every command shell is a unix shell. Sadly, that’s not true on Windows.

The traditional work-around is Cygwin. Which is excellent. But it feels unnatural, like running a VM window with another OS.

This week, I discovered GnuWin, a project that ports the unix command set to windows. There is a slick installer here.

After installing the GnuWin commands, and adding the bin directory to my path, I can now fire off unix commands from a normal windows command console, or from PowerShell.

Life is good.

 

CSS pixel ratios (or, why all mobile sites are 320 pixels)

 

The first few iPhones (and, later, Android phones) all had a screen width of 320 pixels. This prompted web developers everywhere to design mobile sites that were exactly 320 pixels wide.

When Apple introduced the retina display, they doubled the screen width to 640 pixels. Current Android phones go higher than that even. When you view a screen optimized for 320 pixels on a retina iPhone, you could see something like this:

Except that you don’t, of course, most of the time. And that is because of a magic setting called “viewport”.  It works like this:

<meta name="viewport" content="width=device-width, initial-scale=1">

The “width” value above can actually be a number of pixels, like “640″. But if you use the special value “device-width”, which almost every mobile page does, crazy adjustments are made.  What am I talking about? Read on!

According to Edward Cant:

With the advent of high pixel density displays the pixel itself is now a relative unit.

According to the CSS 2.1 Specification:

Pixel units are relative to the resolution of the viewing device, i.e., most often a computer display. If the pixel density of the output device is very different from that of a typical computer display, the user agent should rescale pixel values.

So, a ‘CSS pixel’ indicates one point on the virtual pixel grid to which our CSS design aligns. This either directly matches the actual device pixel grid on which our content is rendered or it is intelligently scaled.

This has led to the definition of a ‘Density-independent pixel (dip)’. (Android Developers)

A virtual pixel unit that applications can use in defining their UI, to express layout dimensions or position in a density-independent way.

iPhone4 was not the first to employ virtual pixels although other implementations often had less convenient scaling factors. 1 virtual pixel could equal 1.5 physical pixels and so on.

A detailed summary of the ‘Pixel is not a pixel’ situation is available on quirksmode.

If that confuses you, let me simplify: the “pixels” we specify in CSS are not actually hardware screen pixels. They are an abstract grid laid on top of the screen.  How wide is that abstract grid? Ah! Now we get to the heart of the matter.

By specifying width=”device-width”, you are asking the browser to apply a scaling factor to its screen pixels. One css pixel occupies one or more screen pixels. How many more? This value is called the css pixel ratio. There is a good list of devices and their css pixel ratios on wikipedia.

If you study that list, you will discover that screen width / css pixel ratio = 320 in most cases. For some Android phones, it comes to 360, a little more breathing room. Bottom line, by specifying width=”device-width”, you transform the browser window into what is effectively a 320 (or so) pixel screen. And now your site that is optimized for 320 pixels looks like this on any phone:

Neat! So as you design mobile sites, you may assume that all phones are 320 pixels wide.

 


 

But of course…

The world has moved on. We now use media queries to provide responsive designs across various pixel widths. And we don’t need to punish people with good phones by forcing narrow windows on them. For the modern mobile site, it is better, I think, to omit the viewport width setting, and rely instead on responsive techniques.