3D Sketching in HTML5 Canvas
I’ve found some fantastic HTML5 <canvas> experiments at Hakim El Hattab’s site, here: http://hakim.se/experiments (Not to mention a beautifully design site).
Now having seen how well complex animations perform in modern browsers, I’m feeling much more inspired to starting animating stuff. Time to brush up on my maths.
You can see my sophisticated sketch here: http://hakim.se/experiments/html5/sketch/#41846db9
Read More
Apple No Likey Flashy
There is plenty of chatter regarding the feud between Apple and Adobe regarding Flash. I got a little chuckle seeing the iPad 2 page which contains an interactive animation of the iPad 2 Smart cover showing how AMAZING it’s folding abilities are (Be sure to choose your color first). I thought this little animation would be an obvious candidate for Flash but they’ve invested the energy instead in keeping their site ‘pure’ and used a Scriptaculous script with individual JPEGs for each frame.
I’m no Flash lover, in fact, I’d gladly see it and Silverlight disappear in the wake of HTML5 and JavaSript Frameworks…
Read MoreApplication Pool not starting on Windows 7
I recently installed IIS7 on a Windows 7 workstation via batch file. The installation went off without a hitch but I was getting no response from http://localhost and a quick inspection of the IIS Manager snap-in showed that all my websites and application pools were stopped. I tried to start the Default App Pool but this is what I got:
‘Application pool cannot be started unless the Windows Process Activation Service (WAS) is running.‘
The Service snap-in showed that WAS was not running. When I tried to start it I got:
‘Error 2: The system cannot find the file specified.‘
Thanks to Scott Hanselman’s efforts, I found the answer in his article Fixed: “Windows Process Activation Service (WAS) is stopping because it encountered an error.”.
All that was required was to create the folder ‘C:\inetpub\temp\apppools‘. That’s it!
Once created, start the Windows Process Activation Service and World Wide Web publishing Service and you should be away! Also, make sure they are set with Startup Type, Automatic
Read MoreProxy Auto-Configuration Script to Bypass Proxy for Local Addresses
Most organizations will want to bypass their proxy server for local web servers (intranet, CMS, helpdesk, etc). You can manually add each new server to your exception list in your logon script or group policies or simply use this PAC script to determine if a server is local and bypass it automatically!
You can use built in commands such as isInNet() which use DNS lookups, but this method uses Regex queries instead.
/*
* Web Proxy Auto-Discovery Script
* Written by Ryan Armstrong
* http://ryanarmstrong.net.au
*/
function FindProxyForURL(url, host)
{
var proxy = "PROXY proxy.mydomain.local:8080"; // Standard proxy string
if( /^[a-zA-Z0-9]+$/.test(host) || // Non-domain hostnames (ie. intranet, helpdesk, etc.)
/\.mydomain\.local$/.test(host) || // Local domain hosts (ie. intranet.mydomain.local)
/^192\.168\.0\.\d+$/.test(host) ) // Local IP Addresses (ie. 192.168.0.32)
{
proxy = "DIRECT"; // Bypass proxy
}
return proxy;
}
With each URL request, a client’s browser will execute the FindProxyForURL() function and pass it the URL string and domain host name for the request. The function needs to return a string telling the browser to connect directly, via SOCKS or via a Proxy.
The script can be found automatically by most browsers if it is made available via HTTP and advertised via DHCP or DNS. Firefox and Chrome (to my knowledge) don’t support the DHCP method, but most browsers support DNS.
To have your script found via DNS is must be made available at ‘http://wpad.mydomain.local/wpad.dat‘ where ‘mydomain.local‘, need I say it, is your local domain. To do this, I saved the script as ‘wpad.dat‘ in the root directory of my intranet server and created a DNS CNAME record (alias) pointing to that server named ‘wpad‘. You must also set the MIME type of the file to ‘application/x-ns-proxy-autoconfig‘ or the file won’t download (at least from IIS in my case). See Configure MIME Type (IIS 6.0) on Technet.
If you do also want to advertise the script via DHCP (it can’t hurt), simply add Option 252 to your scope options containing the URL of your script. According to this article, IE6 may require the URL to be NUL terminated.
Further Reading:
Wiki page with an overview: http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
Microsoft examples for IE: http://technet.microsoft.com/en-us/library/dd361950.aspx
IE Proxy Result Caching: http://support.microsoft.com/kb/271361
Publishing via Apache: http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/web-browser-auto-proxy-configuration.html
Best Practices: http://www.websense.com/content/support/library/web/v76/pac_file_best_practices/PAC_best_pract.aspx
Read MoreOutlook 2011 Crashes in OS X Lion
Since installing OS X Lion on a MacBook Pro at work, I’ve had a problem starting Outlook 2011. Outlook displays the splash screen for less than a second and then exits without a trace.
I did find the following error in the system logs by typing ‘tail /var/log/system.log‘ in a Terminal window.
com.apple.launchd.peruser.501[552] ([oxo-ox7a07a]).com.microsoft.Outlook[1448]) Exited with exit code: 255
I’m not sure what causes the problem but Microsoft did tell us to anticipate some issues with Outlook 2011 on OS X Lion in this article here. Fortunately this issue is easy to fix and does not seem to reoccur, but does require you to reconfigure your email accounts.
To fix the problem, you need to reset your Office Identities. There is no need to touch the plist files or create new user accounts. Simply rename ‘~/Documents/Microsoft User Data/Office 2011 Identities‘ to ‘Office 2011 Identities.backup‘ (Press ‘Return‘ to rename once selected in Finder). Please note that tilde (~) is a shortcut to your home folder in OS X and other *nix based operating systems.
Outlook should now open but will require you to recreate your mail accounts. I did so with an Exchange account so all mail items and contacts, etc were still available. I’m not sure if this would be the case with POP3 / IMAP accounts but take heart because you have a backup of your old Identities folder to pull files from! See the article Your Office Identity for more information on the Identities folder.
Please let me know if this solution works for you.
Read MoreMac OSX Lion File Sharing Connection Failed
After upgrading to OS X Lion 10.7 on both my iMac and Mac Book Pro, I’m interrupted by an ambiguous ‘Connection Failed‘ error every time I attempt to list AFP shares on one system from the other in Finder. There are various hints around the web suggesting that this is a bug and that it can be solved by creating another user account, repairing disk permissions or even just switching from AFP to SMB (Windows sharing). Good news is, if your issue is identical to mine, the solution is much simpler and less obtrusive.
In my case, I had the home folder for my user accounts shared on both Macs. Simply remove the home folder file share and all is well. To do this, open the Apple menu, open System Preferences -> Sharing -> File Sharing and then select your home folder (named after your user account) and click the ‘-‘.
To gain access to the home folder from each Mac, simply click ‘Connect As‘ in Finder and enter the appropriate credentials for the user who owns the home folder on the Mac you are connecting to. The home folder (and hard disk root) is automatically available!
Although it is frustrating that this is not either reported to the end user as an issue or automatically resolved, I’d suggest that the concept is more in line with security best practice for network file sharing. Any files to be shared really should be in a public folder, not your personal home folder (says me who had my home folder shared).
For what it’s worth, I’m enjoying the $30 upgrade. Full screen apps are nice (NI Traktor finally works full screen when switching desktops), Airdrop is fool proof and the reverse scrolling is actually oddly natural.
Read MoreSugarCRM Email Composer CSS Styles
A major frustration in SugarCRM (v 1.6.1) is that the style and formatting of outgoing emails do not match what is presented to the user in the email composer window. This is because the CSS styling which is applied to content in the composer window is not attached to the outgoing email. The solution is simple; attach the CSS content of the composer window (TinyMCE) to all outgoing emails. Here’s how:
First, set the default styling in: ‘/include/javascript/tiny_mce/themes/advanced/skins/default/content.css‘. Be sure to add the ‘div.email‘ selector so that the styling is also applied to the main container of the outgoing emails.
body, td, p, pre, div.email {
color:#000;
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size:12pt;
margin:8px;
}
Apply some tweaks to the way TinyMCE renders HTML for your emails in: ‘/modules/Emails/javascript/init.js‘ (Line ~55) by adding the following to the tinyMCE.init() parameters:
// Force new lines to be <p> elements. force_br_newlines : false, force_p_newlines : true, // Set available font sizes to static sizes, as opposed to relative sizes such as 'xx-small'. font_size_style_values : '8pt,10pt,12pt,14pt,18pt,24pt,36pt', // The following line enables source formatting to make HTML editing easier. apply_source_formatting : true
Now attach the CSS styling to outgoing emails by inserting the following in ‘/modules/Emails/Email.php‘:
$body =
"<style>" .
file_get_contents('include/javascript/tiny_mce/themes/advanced/skins/default/content.css') .
'</style><div class="email">' .
$body .
'</div>';
Do this around line 1984, just after the following line:
$body = from_html(wordwrap($this->description_html, 996));
This attaches the CSS styling inline (ie. inside the <style /> tags) and wraps the entire email in the <div class=”email” /> container.
Do some testing and you should now find your outgoing emails correctly match what you saw in the compose window, giving you the full WYSIWYG experience!
* Note: CSS support varies heavily between email clients. A comprehensive list of which CSS rules are supported in each client can be found here: Guide to CSS Support in Email.
Read MoreQuick Script to Set File Permissions
When configuring a web server for the first time, balancing file permissions between locally created, FTP uploaded and PHP created files can be difficult until everything is configured correctly. The following script can help correct any issues and reset all files to a standard.
#!/bin/bash
TARGET_PATH=/var/www
NEW_USER=www-data
NEW_GROUP=www-data
if [ -n "$1" ]
then
TARGET_PATH=$1
fi
for i in $(find ${TARGET_PATH} -type d)
do
chown ${NEW_USER}:${NEW_GROUP} $i
chmod 750 $i
done
for i in $(find ${TARGET_PATH} -type f)
do
chown ${NEW_USER}:${NEW_GROUP} $i
chmod 640 $i
done
Be sure to change TARGET_PATH, NEW_USER and GROUP_USER to your appropriate settings. TARGET_PATH can also be modified when calling the script by including the path required as the first parameter (Eg. ./setperms.sh /var/www).
The permissions set in the script (640) are as follows:
- Owner: Read & Write
- Group: Read Only
- Others: Denied
Owner and Group are also allowed to ‘Execute’ (ie browse) directories (750).
Read MoreScript to Flush Joomla Cache and Temp Folders
There are several instances where you might need to flush Joomla’s cache or temp folders. If you need code changes to be reflected on your web server, need to debug a faulty extension install or maybe to clear out junk before a backup.
Flushing caches in Joomla can be a little tedious being that you must open the admin panel and flush each component. To clear them all out in one command, you can use the following Bash script:
#!/bin/bash
#
# Flushes all cache and tmp files from Joomla
#
echo "Flushing Joomla Caches..."
find cache/ tmp/ administrator/tmp/ administrator/cache/ -type f ! -name 'index.html' -execdir rm {} +
find cache/* tmp/* administrator/tmp/* administrator/cache/* -depth -type d -execdir rm -R {} +
echo "Done."
This of course only applies to Linux based web servers. Maybe you can post a batch script for Windows/IIS servers.
It needs to be run from your Joomla root folder (Maybe ‘~/www/joomla’). Mine is named ‘flush_cache.sh‘.
You’ll need to run this from a terminal via SSH. This is easy enough for any staging servers but you may need to request a ‘shell account‘ from your web host if you don’t already have SSH access.
Please note that this script does not work on Mac OSX. It attempts to delete the ‘cache‘ and ‘tmp‘ folders themselves as well as their contents.
Read MoreHow to Remove Mootools from Joomla
I’ve seen the question raised a few times, how can I remove the Mootools library and other scripts that are loaded automatically into my Joomla template? There are plugins available to do this, but the code required is very simple and adds less complexity to your instance.
I’m yet to find a way to prevent Joomla from adding the scripts, but I have found a way to remove them before the page is rendered. Please note that this code removes all scripts added by Joomla and its extensions.
For Joomla 1.5, modify your template’s ‘index.php‘ to show the following at the top:
<?php defined( '_JEXEC' ) or die( 'Access Denied.' ); $jHeader = $this->getHeadData(); // Grab the HTML Head tag info $jHeader['scripts'] = array(); // Overwrite the 'scripts' array with a blank one $this->setHeadData($jHeader); // Update the Head info before it is rendered ?>
For Joomla 1.6:
<?php defined( '_JEXEC' ) or die( 'Access Denied.' ); // Remove mootools and other scripts from header $this->_scripts = array(); ?>
The same can be applied for removing stylesheets by emptying ‘$jHeader['stylesheets']‘ and ‘$this->_stylesheets‘ for 1.5 and 1.6 respectively.
Please note that this will remove ALL scripts (or style-sheets), not just Mootools. I will post soon on how to isolate Mootools.
Read More