Although this is not exactly new, but it’s still valid and informative in case you haven’t already known all of these tricks. Read OS X command line tools that you should know.
I’ve been working on a Apache Cordova app for sometimes. Before seeing the light of the tunnel, I bump into issue with the file upload function.
After banging my head a number of times, it turns out the Apache Cordova FileTransfer plugin only like cdvfile:// paths rather than file:// file system path. Do NOT do that again or nothing gets submitted.
Since Ubuntu 14.04.1 has just been released recently, I want to see if there’s anything improved in installing the w3c markup validator with it. The basic information is covered by Simply Testable here.
But there’s some extra steps you need for the latest changes. So I’m just putting the extra steps along with the original steps to get it going.
To start, fire up the Terminal app.
Most nuts and bolts are installed by default so you only need to take care a few things.
First, you’ll need to manually create the directory
sudo mkdir /etc/apache2/conf.d
because this is where the w3c-markup-validator package wants to install. Otherwise you’ll end up with a bunch of error messages to trace.
You would want to install these 7 extra packages proceeding further.
sudo apt-get install apache2 mercurial subversion python openjdk-6-jdk git libapache2-mod-perl2
Then install the w3c validator package should run smoothly:
sudo apt-get install w3c-markup-validator
git wasn’t mentioned elsewhere because this is a recent change in the HTML5 validator. Thus you will need git to get the latest source.
The perl module is required for the w3c validator actually, and there’s some changes you need to make to the conf file.
You will need to do these before w3c validator works
sudo ln -s /etc/w3c/httpd.conf /etc/apache2/conf-enabled/w3c-markup-validator.conf
Added the mod_perl module part to the cgi-bin conf:
sudo gedit /etc/apache2/conf-available/serve-cgi-bin.conf
It will look like the following:
<IfModule mod_alias.c> <IfModule mod_cgi.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfModule mod_cgid.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfModule mod_perl.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfDefine ENABLE_USR_LIB_CGI_BIN> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Require all granted </Directory> </IfDefine> </IfModule> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Low and behold, you will need to actually enable CGI-BIN for Apache first. Otherwise you will end up with error when you try to check any url.
sudo a2enmod cgi
Now restart apache with:
sudo service apache2 restart
You should now be able to reach http://localhost/w3c-validator/ and do a basic validation.
To install the HTML5 validator at /usr/share/html5-validator, do the following:
sudo ln -s /usr/lib/jvm/java-6-openjdk-amd64 /usr/lib/jvm/java-6-openjdk sudo gedit /etc/enviroment
Append the following lines:
To make the JAVA_HOME available to sudo commands, type at command line:
Then add at the bottom of the file and save.
Defaults env_keep += "JAVA_HOME PATH"
Back to Terminal, do the followings:
sudo mkdir /usr/share/html5-validator && cd /usr/share/html5-validator sudo hg clone https://bitbucket.org/validator/build build sudo python build/build.py --legacy all sudo python build/build.py --legacy all
The HTML5 validator is running now and you can verify by going to http://localhost:8888/
But there’s not good enough for our daily use, right? We want it to start upon startup. Let’s just Ctrl-C to break the HTML5 validator for now. Then we’ll create the startup script at
sudo gedit /etc/init/html5-validator.conf
Put the following into it.
description "Validator.nu HTML5 Validator"
start on runlevel  stop on runlevel 
chdir /usr/share/html5-validator exec python build/build.py --legacy --control-port=8889 run respawn
With this, the HTML5 validator will start upon reboot, and you can start and stop it with:
sudo service html5-validator start/stop
The last item here is to enable w3c validator to work with private IP and HTML5 validation.
sudo gedit /etc/w3c/validator.conf
Allow Private IPs = no
Allow Private IPs = yes
Uncomment the following line. (Do NOT put the extra HTML at the end of the URL)
HTML5 = http://localhost:8888/html5/
sudo service apache2 restart
Now we got a fully working w3c validator!
Just recently I noticed I can’t load GitHub on Safari and turns out it’s the SSL certificate causing the issue. However it doesn’t seem like it’s GitHub’s fault but rather it’s OS X’s new policy (introduced at 10.9.2?) Firefox is just working fine btw.
It’s supposed to be fixed already as I’m using 10.9.4 now.
To get around this, people suggested to delete the DigiCert High Assurance CA-3 and alike. That doesn’t work for me.
Once you load github.com, this very item will be regenerated in Keychain Access.
A temporary solution is to set the SSL to be “Always Trusted” to bypass this annoying issue. But that’ll make your Mac vulnerable to sites pretending to use certificates from this authority. Joy!
A very drastic solution is “Reset My Default Keychain” via Keychain Access’s Preferences > General.
That might just save you some times – a CSS hexagon generator.
A nice of collection of shapes made with pure CSS. Very neat.
Yo app got hacked by college students after it’s reported having raise half million fund. The fame & the money surely do bring the attentions from all around.
Compressor.io is a new image compressor / optimizer for jpeg, png, gif, and even svg. It also has options to save the optimized image directly to Google Drive and Dropbox. Pretty neat.
Phonopaper is the coolest app so far. It takes photo from the waveform on paper and generates sound!