Saturday, 13 October 2012

Veg dumplings

Itsu round just the corner from work in Fetter lane do very fine veg dumplings, i'm not normally a one for the chains, but have to say... yum.

I was struggling for a while, trying to copy an action in PhotoShop (CS3), it turns out all you need to do is drag it onto the "Create new action" icon and boom!

Another thing that turns out to be quite easy is formatting a date from a string in jsp, in the example below the "published" variable is a string, the pattern attribute on the parseDate tag must match the format of your string, after that you have a date object variable which you can format using the formatDate tag.

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


<c:set var="published" value="2012-10-01 12:24:09.263" />

<fmt:parseDate 
    value="${published}" 
    pattern="yyyy-MM-dd HH:mm:ss" 
    var="publishedDate"/>

<p>Published: 
<fmt:formatDate 
    value="${publishedDate}" 
    type="date"
    dateStyle="full"/>
</p>

checkout http://www.tutorialspoint.com/jsp/jstl_format_formatdate_tag.htm for more info on what the type and dateStyle attributes do.

Saturday, 6 October 2012

What I learned this week; Ganache

What I learned this week; Ganache

It is possible to ruin a ganache, you stir it like crazy when it still hot! Since I was stuck with it, not having any more cream, I mixed it with a hand blender when it was just getting cool. It didn't have the glossy sheen it should, but made an acceptable covering for the cake.

Also, having had some IE7 problems when loading YUI3 at the bottom of the page I've gone and stuck one in the document head for older versions of IE.

<!--[if lte IE 7]>
    <script 
        type="text/javascript" 
        src="/lib/yui/${yuiVersion}/build/yui/yui-min.js"></script>
<![endif]-->

On a related point, it seems that in IE9 borer-radius is supported, but not in conjunction with a gradient filter, at least not on what I was doing, so decided that I'd rather have the rounded corners than the gradient.

<!--[if IE 9]>
  <style type="text/css">
    #divContainer div.topbar {
        border-radius:10px 10px 0 0;
        filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);
    }
  </style>
<![endif]-->

Saturday, 29 September 2012

What I learned this week; yui3 src

What I learned this week;

Most importantly, keep a supply of something edible, and more substantial than miso soup, at work!

Also, to setup yui3 from src branch in GitHub and download, then follow these steps.... (if you already have git-core and node installed, just run the last 5 or so commands)

$ apt-get install g++ curl libssl-dev apache2-utils then 
$ apt-get install git-core
$ git clone git://github.com/ry/node.git
$ mkdir ~/nodejs && cd $_
$ wget -N http://nodejs.org/dist/node-latest.tar.gz
$ tar xzvf node-latest.tar.gz && cd `ls -rd node-v*`
$ ./configure
$ make install
$ cd /to/your/yui3/
$ npm install
$ npm -g install selleck
$ cd src
$ selleck --server

All being well you should now have a server running on localhost:3000. To update the build folder cd into the individual src folder and run $ shifter, or cd yui3/src and run $ shifter --walk to do the entire thing.

Monday, 9 July 2012

left:-99999999px

*.accessibilityHeader {
   left:-99999999px;
   position:absolute;
}
I put the above in a style sheet the other day and only just noticed that there where no horizontal scroll bars appearing in FireFox.  Fortunately, it didn't take too long to find, apparently it's too big a number, what's up with that!??!

Monday, 20 February 2012

Escaping quotes in XSLT for text used in JavaScript or JSON

XSLT template for formatting javascript safe strings by escaping double quote char " i.e. &quot; or &#34; with escaped version \"

Tuesday, 31 January 2012

IE7 and hasLayout


All these years I've assumed that {zoom:100%;} and {height:1%;} where essentially the same, forcing an element to have layout (hasLayout property). After a very unproductive morning, being made to look foolish by IE7, I finally in desperation changed the zoom directive to height and my clear float hack started working. Note to self, go round the country and personally upgrade all IE6/7 versions to IE9!

Sunday, 8 May 2011

Dynamcially adding style

Dynamically add style to a page...

var style = "body{color:#666;}";
var s = document.createElement('style');
s.setAttribute("type", "text/css");
if (s.styleSheet) { // IE
s.styleSheet.cssText = style;
} else {
var stxt = document.createTextNode(style);
s.appendChild( stxt );
}
document.getElementsByTagName('head')[0].appendChild(s);

Remember to minify the style text using something like http://refresh-sf.com/yui/
 

Note: the opinions on this page don't represent that of my employer in anyway. And, actually only vaguely represent my opinions on the date of publication. (Unlike Ms T, I am very much for turning)