February 18, 2010
JS to make one button the same size as another
var padme = $('m_butt').offsetWidth - $('sum_butt').offsetWidth;
// The 3 is the padding applied to the first element,
// which needs to be added to the difference
$('sum_butt').style.paddingRight = (padme + 3) + 'px';
Tags: JavaScript
Posted by Paul Hollands pj at 09:45 AM | Comments (0)
January 30, 2010
She's a mystery to me
Darkness falls and she Will take me by the hand Take me to some twilight land Where all but love is gray Where I can't find my way Without her as my guide Night falls, I'm cast beneath her spell Daylight comes, our heaven turns to hell Am I left to burn, and burn eternally? She's a mystery to me She's a mystery girl She's a mystery girl She's a mystery girl She's a mystery girl In the night of love Words tangled in her hair Words soon to disappear A love so sharp it cut Like a switchblade to my heart Words tearing me apart She tears again my bleeding heart I wanna run, she's pulling me apart Fallen angel cries And I just melt away She's a mystery to me She's a mystery girl She's a mystery girl She's a mystery girl She's a mystery girl Haunted by her side It's a darkness in her eyes That so enslaves me But if my love is blind Then I don't want to see She's a mystery to me Night falls, I'm cast beneath her spell Daylight comes, our heaven turns to hell Am I left to burn, and burn eternally? She's a mystery to me She's a mystery girl She's a mystery girl She's a mystery girl She's a mystery girl She's a mystery girl She's a mystery girl She's... a mystery girl She's a mystery girl She's a mystery girl She's... a mystery girl
Posted by Paul Hollands pj at 06:43 PM | Comments (0)
January 18, 2010
Using SVN switch
Tags: Subversion
Posted by Paul Hollands pj at 05:07 PM | Comments (0)
January 04, 2010
Diff of my iTunes Libraries on various computers
List of Songs by Computer and Album
Tags: Music
Posted by Paul Hollands pj at 07:05 PM | Comments (0)
December 23, 2009
Keyword Modifiers
Anton Palitsyn - MySource Matrix 3.26.0 RC1
Posted by Paul Hollands pj at 06:22 PM | Comments (0)
December 12, 2009
4 Store Triple Store
Posted by Paul Hollands pj at 05:52 PM | Comments (0)
XML_FOAF PEAR Package
http://pear.php.net/package/XML_FOAF
Posted by Paul Hollands pj at 04:33 PM | Comments (0)
XML :: PEAR Packages
Tags: PHP
Posted by Paul Hollands pj at 04:33 PM | Comments (0)
Social Graph API
About the Social Graph - Social Graph API - Google Code
Tags: FOAF
Posted by Paul Hollands pj at 04:12 PM | Comments (0)
FOAF in RDFa
Getting started with RDFa: Creating a basic FOAF profile | webBackplane
Tags: FOAF
Posted by Paul Hollands pj at 04:10 PM | Comments (0)
December 10, 2009
FullCalendar Code
This is a genius piece of jQuery:
http://arshaw.com/fullcalendar/
<script type="text/javascript">
var events =
[
{ title: 'Dummy', start: new Date(1900,1,1)}
,{
title: "Reuters Datastream Training",
start: "2009-09-22T16:00:00+01:00",
end: "2009-09-22T17:00:00+01:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/reuters-datastream-training"
}
,{
title: "Pom tiddly pom",
start: "2009-11-23T10:59:00+00:00",
end: "2009-11-23T12:49:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/pom-tiddly-pom"
}
,{
title: "Management of R and D and Product Innovation",
start: "2009-02-16T16:10:00+00:00",
end: "2009-02-16T18:00:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/management-of-r-and-d-and-product-innovation2"
}
];
</script>
<script type="text/javascript">
var recurrences =
[
{ title: 'Dummy' }
,{
title: "Foundations of Finance Theory",
start: "2009-09-22T14:00:00+01:00",
end: "2009-09-22T15:50:00+01:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/foundations-of-finance-theory",
frequency: "FREQ=WEEKLY;INTERVAL=1;UNTIL=20091201T000000",
stop_date: "2009-12-01T00:00:00+00:00"
}
,{
title: "Analysis of Corporate Financial Information Lecture",
start: "2009-09-24T11:10:00+01:00",
end: "2009-09-24T13:00:00+01:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/analysis-of-corporate-financial-information-lecture",
frequency: "FREQ=WEEKLY;INTERVAL=1;UNTIL=20091203T000000",
stop_date: "2009-12-03T00:00:00+00:00"
}
,{
title: "My test title",
start: "2009-12-02T16:00:00+00:00",
end: "2009-12-02T17:50:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/my-test-title",
frequency: "FREQ=WEEKLY;INTERVAL=2;UNTIL=20100324T000000",
stop_date: "2010-03-24T00:00:00+00:00"
}
,{
title: "Derivatives Tutorial Group 1",
start: "2010-01-11T09:00:00+00:00",
end: "2010-01-11T10:00:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/derivatives-tutorial",
frequency: "FREQ=WEEKLY;INTERVAL=1;UNTIL=20100221T000000",
stop_date: "2010-02-21T00:00:00+00:00"
}
,{
title: "Management of R and D and Product Innovation",
start: "2010-01-12T16:10:00+00:00",
end: "2010-01-12T18:00:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/management-of-r-and-d-and-product-innovation",
frequency: "FREQ=WEEKLY;INTERVAL=1;UNTIL=20100214T000000",
stop_date: "2010-02-14T00:00:00+00:00"
}
,{
title: "Doing Business Projects in Emerging Markets",
start: "2010-01-11T09:00:00+00:00",
end: "2010-01-11T10:50:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/doing-business-projects-in-emerging-markets",
frequency: "FREQ=WEEKLY;INTERVAL=1;UNTIL=20100221T000000",
stop_date: "2010-02-21T00:00:00+00:00"
}
,{
title: "Derivatives Tutorial Group 2",
start: "2010-01-11T10:00:00+00:00",
end: "2010-01-11T11:00:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/derivatives-tutorial-group-2",
frequency: "FREQ=WEEKLY;INTERVAL=1;UNTIL=20100221T000000",
stop_date: "2010-02-21T00:00:00+00:00"
}
,{
title: "Corporate Strategy",
start: "2010-01-11T21:00:00+00:00",
end: "2010-01-11T22:50:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/corporate-strategy",
frequency: "FREQ=WEEKLY;INTERVAL=1;UNTIL=20100221T000000",
stop_date: "2010-02-21T00:00:00+00:00"
}
,{
title: "Advertising Management",
start: "2010-01-11T14:00:00+00:00",
end: "2010-01-11T15:50:00+00:00",
allDay: false,
url: "http://www.business-school.ed.ac.uk/mybiz/msc-accounting-and-finance/my-study/timetables/msc-accounting-and-finance/advertising-management",
frequency: "FREQ=WEEKLY;INTERVAL=1;UNTIL=20100221T000000",
stop_date: "2010-02-21T00:00:00+00:00"
}
];
function get_event_recurrences(recurrences, events){
var end_date;
for(i in recurrences){
if(i > 0){
var this_one = recurrences[i];
var number_of_days = 7;
if(this_one['frequency'].match(/DAILY/)){ number_of_days = 1; }
if(this_one['frequency'].match(/MONTHLY/)){ number_of_days = 30; }
if(this_one['frequency'].match(/WEEKLY/)){ number_of_days = 7; }
var stop_date = eval($.fullCalendar.parseDate(this_one['stop_date']).getTime()) / 1000;
end_date = eval($.fullCalendar.parseDate(this_one['end']).getTime()) / 1000;
var start_date = eval($.fullCalendar.parseDate(this_one['start']).getTime()) / 1000;
var interval = (60 * 60 * 24) * number_of_days * extract_interval(this_one['frequency']);
//alert((eval(stop_date) - eval(start_date)) / interval);
for(d = start_date; d < stop_date; d = d + interval){
var start = d;
var new_oc = {};
new_oc['title'] = this_one['title'];
new_oc['url'] = this_one['url'];
new_oc['allDay'] = this_one['allDay'];
new_oc['start'] = new Date(start*1000);
new_oc['end'] = new Date(end_date*1000);
end_date = end_date + interval;
events.push(new_oc);
}
}
}
return events;
}
function extract_interval(frequency){
var da_list = frequency.split(';');
var interval = da_list[1];
var da_number = interval.split('=');
return eval(da_number[1]);
}
</script><script type="text/javascript">
var now = new Date();
$(document).ready(
function(){
$('#calendar').fullCalendar(
{header: {left: 'prev,next today',center: 'title', right: 'month,agendaWeek,agendaDay'},
columnFormat: {
week: 'ddd d MMM', // Mon 9/7
day: 'dddd d MMM' // Monday 9/7
},
editable: false,
firstHour: 9, //eval(now.getHours()),
minTime: '8:30am',
maxTime: '8:30pm',
timeFormat: 'H:mm',
firstDay: 1,
defaultView: 'agendaWeek',
currentTimezone: 'Europe/London',
events: get_event_recurrences(recurrences, events)});
}
);
</script>
Tags: jQuery
Posted by Paul Hollands pj at 04:42 PM | Comments (0)
November 19, 2009
Indo European Language Google Site
Europe's Indo-European Language - Northwestern Proto-Indo-European (Indo-European Language)
Posted by Paul Hollands pj at 09:23 PM | Comments (0)
November 18, 2009
iCal Validator
Posted by Paul Hollands pj at 01:49 PM | Comments (0)
November 14, 2009
Staggolee
It was early, early one morning
When i heard my bulldog bark,
T’was staggolee and billy delyon
Squabbling in the dark.
Staggolee told billy delyon
“what do you think of that?
You win all my money, lord!
You spit in my stetson hat"
Staggolee were walking
In the red hot brawling sun,
Says: “bring me my six-shooter,
Lord i wants my fourty-one"
Staggolee were walking
Through the mud and through the sand
Says: “i feel mistreated this morning,
I could kill most any man"
Billy delyons told staggolee:
“please don’t take my life,
I got three helpless children,
One poor, beautiful wife"
“i don’t care nothing ‘bout your children
And nothing about your wife
You done mistreated me, billy,
And i’m bound to take your life".
He shot him three times in the shoulder, lord,
He shot him three times in the side.
Well, the last time he shot him
Caused billy lyons to die.
Staggolee told mrs. billy:
“you don’t believe your man is dead?
Come on into the barroom,
See the hole i shot in his head!"
The high-sheriff told the deputies:
“get your pistols and come with me!
We got to go’n arrest the bad man
Known as staggolee"
The deputies took their pistols
They laid them on the shelf,
“if you want that bad man staggolee
You have to arrest him yourself!"
The high-sheriff asked the bartender
“who can that bad man be?"
“speak softly!?, said the bartender,
“that bad man’s staggolee"
He touched old stag on the shoulder,
“say, stag, why do you run?"
“i don’t run, white folk,
When i got my fourty-one"
The hangman put the mask on,
Tied his hands behind his back,
Sprung the trap on staggolee,
But his neck refused to crack.
The hangman, he got frightened,
Said: “chief, you see how it be,
I can’t hang this man, lord,
You better set him free"
Three-hundred dollar funeral,
Thousand dollar hearse,
Satisfaction! “undertaker,
Put stag on down in the earth!"
Staggolee told the devil:
“say, come on and have some fun!
You stick me with your pitchfork,
And i’ll shoot you with my fourty-one"
Staggolee took the pitchfork
And he laid it on a shelf,
He says: “stand back, tom devil, lord,
I’m gonna rule hell by myself."
Posted by Paul Hollands pj at 12:06 AM | Comments (0)
November 13, 2009
Really fast Ajax
Ajax/load - jQuery JavaScript Library
Tags: AJAX , JavaScript
Posted by Paul Hollands pj at 04:24 PM | Comments (0)
Yeti USB Mic
Blue Microphones Yeti USB Microphone: Amazon.co.uk: Electronics & Photo
Posted by Paul Hollands pj at 02:26 PM | Comments (0)
October 29, 2009
Indigetes
Indigetes - Wikipedia, the free encyclopedia
Posted by Paul Hollands pj at 02:20 AM | Comments (0)
Iberian language
Iberian language - Wikipedia, the free encyclopedia
Posted by Paul Hollands pj at 01:21 AM | Comments (0)
Languages of Iberia
Languages of Iberia - Wikipedia, the free encyclopedia
Posted by Paul Hollands pj at 01:20 AM | Comments (0)
October 28, 2009
Vulgar Latin - Wikipedia
Vulgar Latin - Wikipedia, the free encyclopedia
Posted by Paul Hollands pj at 02:03 AM | Comments (0)
Catalan personal pronouns
Catalan personal pronouns - Wikipedia, the free encyclopedia
Posted by Paul Hollands pj at 12:46 AM | Comments (0)
October 26, 2009
Thickbox and Prototype
getting thickbox, jquery, and prototype to play together nicely | disjoint thoughts
Tags: JavaScript
Posted by Paul Hollands pj at 11:22 AM | Comments (0)
October 19, 2009
PostgreSQL 7.4: Mathematical Functions and Operators
PostgreSQL: Documentation: Manuals: PostgreSQL 7.4: Mathematical Functions and Operators
-43
Tags: PostgreSQL
Posted by Paul Hollands pj at 04:55 PM | Comments (0)
October 16, 2009
iCalendar Recurrence Reference and Examples
4.8.5.4 Recurrence Rule
Property Name: RRULE
Purpose: This property defines a rule or repeating pattern for
recurring events, to-dos, or time zone definitions.
Value Type: RECUR
Property Parameters: Non-standard property parameters can be
specified on this property.
Conformance: This property can be specified one or more times in
recurring "VEVENT", "VTODO" and "VJOURNAL" calendar components. It
can also be specified once in each STANDARD or DAYLIGHT sub-component
of the "VTIMEZONE" calendar component.
Description: The recurrence rule, if specified, is used in computing
the recurrence set. The recurrence set is the complete set of
recurrence instances for a calendar component. The recurrence set is
generated by considering the initial "DTSTART" property along with
the "RRULE", "RDATE", "EXDATE" and "EXRULE" properties contained
within the iCalendar object. The "DTSTART" property defines the first
instance in the recurrence set. Multiple instances of the "RRULE" and
"EXRULE" properties can also be specified to define more
sophisticated recurrence sets. The final recurrence set is generated
by gathering all of the start date/times generated by any of the
specified "RRULE" and "RDATE" properties, and excluding any start
date/times which fall within the union of start date/times generated
by any specified "EXRULE" and "EXDATE" properties. This implies that
start date/times within exclusion related properties (i.e., "EXDATE"
and "EXRULE") take precedence over those specified by inclusion
properties (i.e., "RDATE" and "RRULE"). Where duplicate instances are
generated by the "RRULE" and "RDATE" properties, only one recurrence
is considered. Duplicate instances are ignored.
Dawson & Stenerson Standards Track [Page 117]
RFC 2445 iCalendar November 1998
The "DTSTART" and "DTEND" property pair or "DTSTART" and "DURATION"
property pair, specified within the iCalendar object defines the
first instance of the recurrence. When used with a recurrence rule,
the "DTSTART" and "DTEND" properties MUST be specified in local time
and the appropriate set of "VTIMEZONE" calendar components MUST be
included. For detail on the usage of the "VTIMEZONE" calendar
component, see the "VTIMEZONE" calendar component definition.
Any duration associated with the iCalendar object applies to all
members of the generated recurrence set. Any modified duration for
specific recurrences MUST be explicitly specified using the "RDATE"
property.
Format Definition: This property is defined by the following
notation:
rrule = "RRULE" rrulparam ":" recur CRLF
rrulparam = *(";" xparam)
Example: All examples assume the Eastern United States time zone.
Daily for 10 occurrences:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=DAILY;COUNT=10
==> (1997 9:00 AM EDT)September 2-11
Daily until December 24, 1997:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=DAILY;UNTIL=19971224T000000Z
==> (1997 9:00 AM EDT)September 2-30;October 1-25
(1997 9:00 AM EST)October 26-31;November 1-30;December 1-23
Every other day - forever:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=DAILY;INTERVAL=2
==> (1997 9:00 AM EDT)September2,4,6,8...24,26,28,30;
October 2,4,6...20,22,24
(1997 9:00 AM EST)October 26,28,30;November 1,3,5,7...25,27,29;
Dec 1,3,...
Every 10 days, 5 occurrences:
Dawson & Stenerson Standards Track [Page 118]
RFC 2445 iCalendar November 1998
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=DAILY;INTERVAL=10;COUNT=5
==> (1997 9:00 AM EDT)September 2,12,22;October 2,12
Everyday in January, for 3 years:
DTSTART;TZID=US-Eastern:19980101T090000
RRULE:FREQ=YEARLY;UNTIL=20000131T090000Z;
BYMONTH=1;BYDAY=SU,MO,TU,WE,TH,FR,SA
or
RRULE:FREQ=DAILY;UNTIL=20000131T090000Z;BYMONTH=1
==> (1998 9:00 AM EDT)January 1-31
(1999 9:00 AM EDT)January 1-31
(2000 9:00 AM EDT)January 1-31
Weekly for 10 occurrences
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=WEEKLY;COUNT=10
==> (1997 9:00 AM EDT)September 2,9,16,23,30;October 7,14,21
(1997 9:00 AM EST)October 28;November 4
Weekly until December 24, 1997
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=WEEKLY;UNTIL=19971224T000000Z
==> (1997 9:00 AM EDT)September 2,9,16,23,30;October 7,14,21
(1997 9:00 AM EST)October 28;November 4,11,18,25;
December 2,9,16,23
Every other week - forever:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=SU
==> (1997 9:00 AM EDT)September 2,16,30;October 14
(1997 9:00 AM EST)October 28;November 11,25;December 9,23
(1998 9:00 AM EST)January 6,20;February
...
Weekly on Tuesday and Thursday for 5 weeks:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH
or
Dawson & Stenerson Standards Track [Page 119]
RFC 2445 iCalendar November 1998
RRULE:FREQ=WEEKLY;COUNT=10;WKST=SU;BYDAY=TU,TH
==> (1997 9:00 AM EDT)September 2,4,9,11,16,18,23,25,30;October 2
Every other week on Monday, Wednesday and Friday until December 24,
1997, but starting on Tuesday, September 2, 1997:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=19971224T000000Z;WKST=SU;
BYDAY=MO,WE,FR
==> (1997 9:00 AM EDT)September 2,3,5,15,17,19,29;October
1,3,13,15,17
(1997 9:00 AM EST)October 27,29,31;November 10,12,14,24,26,28;
December 8,10,12,22
Every other week on Tuesday and Thursday, for 8 occurrences:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=8;WKST=SU;BYDAY=TU,TH
==> (1997 9:00 AM EDT)September 2,4,16,18,30;October 2,14,16
Monthly on the 1st Friday for ten occurrences:
DTSTART;TZID=US-Eastern:19970905T090000
RRULE:FREQ=MONTHLY;COUNT=10;BYDAY=1FR
==> (1997 9:00 AM EDT)September 5;October 3
(1997 9:00 AM EST)November 7;Dec 5
(1998 9:00 AM EST)January 2;February 6;March 6;April 3
(1998 9:00 AM EDT)May 1;June 5
Monthly on the 1st Friday until December 24, 1997:
DTSTART;TZID=US-Eastern:19970905T090000
RRULE:FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR
==> (1997 9:00 AM EDT)September 5;October 3
(1997 9:00 AM EST)November 7;December 5
Every other month on the 1st and last Sunday of the month for 10
occurrences:
DTSTART;TZID=US-Eastern:19970907T090000
RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU
==> (1997 9:00 AM EDT)September 7,28
(1997 9:00 AM EST)November 2,30
Dawson & Stenerson Standards Track [Page 120]
RFC 2445 iCalendar November 1998
(1998 9:00 AM EST)January 4,25;March 1,29
(1998 9:00 AM EDT)May 3,31
Monthly on the second to last Monday of the month for 6 months:
DTSTART;TZID=US-Eastern:19970922T090000
RRULE:FREQ=MONTHLY;COUNT=6;BYDAY=-2MO
==> (1997 9:00 AM EDT)September 22;October 20
(1997 9:00 AM EST)November 17;December 22
(1998 9:00 AM EST)January 19;February 16
Monthly on the third to the last day of the month, forever:
DTSTART;TZID=US-Eastern:19970928T090000
RRULE:FREQ=MONTHLY;BYMONTHDAY=-3
==> (1997 9:00 AM EDT)September 28
(1997 9:00 AM EST)October 29;November 28;December 29
(1998 9:00 AM EST)January 29;February 26
...
Monthly on the 2nd and 15th of the month for 10 occurrences:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=2,15
==> (1997 9:00 AM EDT)September 2,15;October 2,15
(1997 9:00 AM EST)November 2,15;December 2,15
(1998 9:00 AM EST)January 2,15
Monthly on the first and last day of the month for 10 occurrences:
DTSTART;TZID=US-Eastern:19970930T090000
RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=1,-1
==> (1997 9:00 AM EDT)September 30;October 1
(1997 9:00 AM EST)October 31;November 1,30;December 1,31
(1998 9:00 AM EST)January 1,31;February 1
Every 18 months on the 10th thru 15th of the month for 10
occurrences:
DTSTART;TZID=US-Eastern:19970910T090000
RRULE:FREQ=MONTHLY;INTERVAL=18;COUNT=10;BYMONTHDAY=10,11,12,13,14,
15
==> (1997 9:00 AM EDT)September 10,11,12,13,14,15
Dawson & Stenerson Standards Track [Page 121]
RFC 2445 iCalendar November 1998
(1999 9:00 AM EST)March 10,11,12,13
Every Tuesday, every other month:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=MONTHLY;INTERVAL=2;BYDAY=TU
==> (1997 9:00 AM EDT)September 2,9,16,23,30
(1997 9:00 AM EST)November 4,11,18,25
(1998 9:00 AM EST)January 6,13,20,27;March 3,10,17,24,31
...
Yearly in June and July for 10 occurrences:
DTSTART;TZID=US-Eastern:19970610T090000
RRULE:FREQ=YEARLY;COUNT=10;BYMONTH=6,7
==> (1997 9:00 AM EDT)June 10;July 10
(1998 9:00 AM EDT)June 10;July 10
(1999 9:00 AM EDT)June 10;July 10
(2000 9:00 AM EDT)June 10;July 10
(2001 9:00 AM EDT)June 10;July 10
Note: Since none of the BYDAY, BYMONTHDAY or BYYEARDAY components
are specified, the day is gotten from DTSTART
Every other year on January, February, and March for 10 occurrences:
DTSTART;TZID=US-Eastern:19970310T090000
RRULE:FREQ=YEARLY;INTERVAL=2;COUNT=10;BYMONTH=1,2,3
==> (1997 9:00 AM EST)March 10
(1999 9:00 AM EST)January 10;February 10;March 10
(2001 9:00 AM EST)January 10;February 10;March 10
(2003 9:00 AM EST)January 10;February 10;March 10
Every 3rd year on the 1st, 100th and 200th day for 10 occurrences:
DTSTART;TZID=US-Eastern:19970101T090000
RRULE:FREQ=YEARLY;INTERVAL=3;COUNT=10;BYYEARDAY=1,100,200
==> (1997 9:00 AM EST)January 1
(1997 9:00 AM EDT)April 10;July 19
(2000 9:00 AM EST)January 1
(2000 9:00 AM EDT)April 9;July 18
(2003 9:00 AM EST)January 1
(2003 9:00 AM EDT)April 10;July 19
(2006 9:00 AM EST)January 1
Every 20th Monday of the year, forever:
Dawson & Stenerson Standards Track [Page 122]
RFC 2445 iCalendar November 1998
DTSTART;TZID=US-Eastern:19970519T090000
RRULE:FREQ=YEARLY;BYDAY=20MO
==> (1997 9:00 AM EDT)May 19
(1998 9:00 AM EDT)May 18
(1999 9:00 AM EDT)May 17
...
Monday of week number 20 (where the default start of the week is
Monday), forever:
DTSTART;TZID=US-Eastern:19970512T090000
RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO
==> (1997 9:00 AM EDT)May 12
(1998 9:00 AM EDT)May 11
(1999 9:00 AM EDT)May 17
...
Every Thursday in March, forever:
DTSTART;TZID=US-Eastern:19970313T090000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=TH
==> (1997 9:00 AM EST)March 13,20,27
(1998 9:00 AM EST)March 5,12,19,26
(1999 9:00 AM EST)March 4,11,18,25
...
Every Thursday, but only during June, July, and August, forever:
DTSTART;TZID=US-Eastern:19970605T090000
RRULE:FREQ=YEARLY;BYDAY=TH;BYMONTH=6,7,8
==> (1997 9:00 AM EDT)June 5,12,19,26;July 3,10,17,24,31;
August 7,14,21,28
(1998 9:00 AM EDT)June 4,11,18,25;July 2,9,16,23,30;
August 6,13,20,27
(1999 9:00 AM EDT)June 3,10,17,24;July 1,8,15,22,29;
August 5,12,19,26
...
Every Friday the 13th, forever:
DTSTART;TZID=US-Eastern:19970902T090000
EXDATE;TZID=US-Eastern:19970902T090000
RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13
Dawson & Stenerson Standards Track [Page 123]
RFC 2445 iCalendar November 1998
==> (1998 9:00 AM EST)February 13;March 13;November 13
(1999 9:00 AM EDT)August 13
(2000 9:00 AM EDT)October 13
...
The first Saturday that follows the first Sunday of the month,
forever:
DTSTART;TZID=US-Eastern:19970913T090000
RRULE:FREQ=MONTHLY;BYDAY=SA;BYMONTHDAY=7,8,9,10,11,12,13
==> (1997 9:00 AM EDT)September 13;October 11
(1997 9:00 AM EST)November 8;December 13
(1998 9:00 AM EST)January 10;February 7;March 7
(1998 9:00 AM EDT)April 11;May 9;June 13...
...
Every four years, the first Tuesday after a Monday in November,
forever (U.S. Presidential Election day):
DTSTART;TZID=US-Eastern:19961105T090000
RRULE:FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,
5,6,7,8
==> (1996 9:00 AM EST)November 5
(2000 9:00 AM EST)November 7
(2004 9:00 AM EST)November 2
...
The 3rd instance into the month of one of Tuesday, Wednesday or
Thursday, for the next 3 months:
DTSTART;TZID=US-Eastern:19970904T090000
RRULE:FREQ=MONTHLY;COUNT=3;BYDAY=TU,WE,TH;BYSETPOS=3
==> (1997 9:00 AM EDT)September 4;October 7
(1997 9:00 AM EST)November 6
The 2nd to last weekday of the month:
DTSTART;TZID=US-Eastern:19970929T090000
RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2
==> (1997 9:00 AM EDT)September 29
(1997 9:00 AM EST)October 30;November 27;December 30
(1998 9:00 AM EST)January 29;February 26;March 30
...
Dawson & Stenerson Standards Track [Page 124]
RFC 2445 iCalendar November 1998
Every 3 hours from 9:00 AM to 5:00 PM on a specific day:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=19970902T170000Z
==> (September 2, 1997 EDT)09:00,12:00,15:00
Every 15 minutes for 6 occurrences:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=MINUTELY;INTERVAL=15;COUNT=6
==> (September 2, 1997 EDT)09:00,09:15,09:30,09:45,10:00,10:15
Every hour and a half for 4 occurrences:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=MINUTELY;INTERVAL=90;COUNT=4
==> (September 2, 1997 EDT)09:00,10:30;12:00;13:30
Every 20 minutes from 9:00 AM to 4:40 PM every day:
DTSTART;TZID=US-Eastern:19970902T090000
RRULE:FREQ=DAILY;BYHOUR=9,10,11,12,13,14,15,16;BYMINUTE=0,20,40
or
RRULE:FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16
==> (September 2, 1997 EDT)9:00,9:20,9:40,10:00,10:20,
... 16:00,16:20,16:40
(September 3, 1997 EDT)9:00,9:20,9:40,10:00,10:20,
...16:00,16:20,16:40
...
An example where the days generated makes a difference because of
WKST:
DTSTART;TZID=US-Eastern:19970805T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=MO
==> (1997 EDT)Aug 5,10,19,24
changing only WKST from MO to SU, yields different results...
DTSTART;TZID=US-Eastern:19970805T090000
RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=SU
==> (1997 EDT)August 5,17,19,31
Dawson & Stenerson Standards Track [Page 125]
RFC 2445 iCalendar November 1998
Posted by Paul Hollands pj at 09:26 AM | Comments (0)
October 15, 2009
iCalendar Recurrence
RFC 2445 - Internet Calendaring and Scheduling Core Object Specification (iCalendar)
Posted by Paul Hollands pj at 04:56 PM | Comments (0)
This is so cool
Posted by Paul Hollands pj at 04:51 PM | Comments (0)
Prototype-based Carousel
Tags: JavaScript
Posted by Paul Hollands pj at 11:46 AM | Comments (0)
October 09, 2009
PostgreSQL version of do_sql.py
import sys
import postgresql
from read_config import read_config
import time
import string
import re
def parse_insert_sql(sql):
response = {}
da_list = re.split("[\s\(\)]+", sql.lower().strip())
print(da_list)
ma_table = da_list[2]
if da_list[0] == 'insert':
response['is_insert'] = 1
if "returning %s_id" % (ma_table) in da_list:
response['sql'] = sql
else:
response['sql'] = sql + " returning %s_id as insert_id" % (ma_table)
else:
response['is_insert'] = 0
response['sql'] = sql
return response
def do_sql_query(db_config_file, sql, debug):
response = {}
results = ()
"""
Takes config file name, your SQL and a debug parameter.
Returns a dictionary with a boolean, an error and a warning string and
a list of results dictionaries.
"""
connection_map = read_config('%s.ini' % db_config_file, debug)
(host, user, passwd, db) = (connection_map['connection_parameters']['host'],
connection_map['connection_parameters']['user'],
connection_map['connection_parameters']['password'],
connection_map['connection_parameters']['db'])
connection = postgresql.open("pq://%s:%s@%s/%s" % (user, passwd, host, db))
insert_response = parse_insert_sql(sql)
if insert_response['is_insert'] == 1:
sql = insert_response['sql']
try:
results = connection.prepare(sql)
response['results'] = results
response['status'] = 1
if insert_response['is_insert'] == 1:
response['insert_id'] = results.first()
return(response)
except:
if debug == 1:
print ("\nPostgreSQL error: %s\n" % (sql))
response['status'] = 0
response['error'] = "\nPostgreSQL error: %s\n" % (sql)
response['results'] = results
return(response)
if __name__ == "__main__":
response = do_sql_query('waf_common', "insert into stuff(stuff_id, nonsense) values(nextval('stuff_seq'::regclass), 'Glug')", 0)
print (response['insert_id'])
response = do_sql_query('waf_common', "select * from staff limit 10", 0)
print (response['results'].first())
for record in response['results']:
for column in record.column_names:
print("%s : %s" % (column, record[column]))
print("\n ----------- \n")
Tags: Python
Posted by Paul Hollands pj at 05:00 PM | Comments (0)
October 01, 2009
De-dupe but leave one of each with one SQL query
Using sick sub-queries:
delete from ug_abstract where ug_abstract_id in
-- Get a list of duplicated rows based upon a comparison of the title
(
select ug.ug_abstract_id
from ug_abstract ug, ug_abstract ag
where ug.title = ag.title and ug.ug_abstract_id != ag.ug_abstract_id and ug.ug_abstract_id not in
-- Get the PK from one of each of the rows that have been duplicated
-- then exclude them from the delete run with a "not in"
(select max(ug.ug_abstract_id) as ug_abstract_id
from ug_abstract ug, ug_abstract ag
where ug.title = ag.title and ug.ug_abstract_id != ag.ug_abstract_id group by ug.title)
group by ug.title, ug.ug_abstract_id order by ug.title
)
Tags: PostgreSQL
Posted by Paul Hollands pj at 04:23 PM | Comments (0)
September 25, 2009
Mental BST events SQL with cluster tags included
-- All dates are plus one hour to accomodate BST '1970-01-01 01:00:00 GMT'
select distinct e.event_id, e.event_name, e.event_start_date, e.event_start_time, t.asset_id, '1970-01-01 01:00:00 GMT'::timestamp +
((e.event_start_date::bigint)::text)::interval as ma_date,
-- Get the day from the date and pad it with a leading zero if less than 10
case when extract('day' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval) < 10 then
'0'||extract('day' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval)::text else
extract('day' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval)::text end
as ma_day,
-- Get the month from the date and pad it with a leading zero if less than 10
case when extract('month' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval) < 10 then
'0'||extract('month' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval)::text else
extract('month' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval)::text end
as ma_month,
-- Get the year from the date
extract('year' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval) as ma_year,
-- Get the hours and minutes from the date + the start time and pad them with a leading zeros if less than 10
case when extract('hour' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint + (e.event_start_time * 60 * 60))::text)::interval) < 10 then
'0'||extract('hour' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint + (e.event_start_time * 60 * 60))::text)::interval)::text
else extract('hour' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint + (e.event_start_time * 60 * 60))::text)::interval)::text end
as start_hour,
case when extract('minute' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint + (e.event_start_time * 60 * 60))::text)::interval) < 10 then
'0'||extract('minute' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint + (e.event_start_time * 60 * 60))::text)::interval)::text
else extract('minute' from '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint + (e.event_start_time * 60 * 60))::text)::interval)::text end as start_min,
-- Get two tags
max(rc.research_cluster_name) as tag_one,
min(rc.research_cluster_name) as tag_two
from event e
-- left join in the research cluster (tag) table
left join event_research_cluster_link ecl on (ecl.event_id = e.event_id and ecl.expired_date is null)
left join research_cluster rc on (ecl.research_cluster_id = rc.research_cluster_id and ecl.expired_date is null),
-- Join on the heading and transaction table (latter for the asset_id)
event_heading_link l, heading h, transaction t where l.event_id = e.event_id and l.heading_id = h.heading_id and l.heading_id in (2)
and t.event_id = e.event_id and t.asset_id is not null
-- Check that the event_start_date is in British Summer Time
and ('1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval between
-- Get the last Sunday in March
date_trunc('month', (extract('year' from now()::timestamp)::text||'-03-01 00:00:00 GMT'::text)::timestamp + '1 month'::interval) - '1 day'::interval + (((1 - 7 - to_char(date_trunc('month', (extract('year' from now()::timestamp)::text||'-03-01 00:00:00 GMT'::text)::timestamp + '1 month'::interval) - '1 day'::interval,'D')::int) %7)||' days')::interval
and
-- Get the last Sunday in October
date_trunc('month', (extract('year' from now()::timestamp)::text||'-10-01 00:00:00 GMT'::text)::timestamp + '1 month'::interval) - '1 day'::interval + (((1 - 7 - to_char(date_trunc('month', (extract('year' from now()::timestamp)::text||'-10-01 00:00:00 GMT'::text)::timestamp + '1 month'::interval) - '1 day'::interval,'D')::int) %7)||' days')::interval )
-- This is an archive so the start date must be before now
and '1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval < current_timestamp
group by e.event_start_date, e.event_start_time, e.event_name, t.asset_id, e.event_id
order by e.event_start_date desc, e.event_start_time desc
Tags: PostgreSQL
Posted by Paul Hollands pj at 02:32 PM | Comments (0)
September 24, 2009
Is this date during BST?
-- Check that the event_start_date is in British Summer Time and ('1970-01-01 01:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval between -- Get the last Sunday in March date_trunc('month', (extract('year' from now()::timestamp)::text||'-03-01 00:00:00 GMT'::text)::timestamp + '1 month'::interval) - '1 day'::interval + (((1 - 7 - to_char(date_trunc('month', (extract('year' from now()::timestamp)::text||'-03-01 00:00:00 GMT'::text)::timestamp + '1 month'::interval) - '1 day'::interval,'D')::int) %7)||' days')::interval and -- Get the last Sunday in October date_trunc('month', (extract('year' from now()::timestamp)::text||'-10-01 00:00:00 GMT'::text)::timestamp + '1 month'::interval) - '1 day'::interval + (((1 - 7 - to_char(date_trunc('month', (extract('year' from now()::timestamp)::text||'-10-01 00:00:00 GMT'::text)::timestamp + '1 month'::interval) - '1 day'::interval,'D')::int) %7)||' days')::interval ) -- The 1 specifies Sunday
Posted by Paul Hollands pj at 11:23 PM | Comments (0)
September 23, 2009
Code for detecting if it's BST
http://www.devscripts.net/browse/116.php
Tags: PHP
Posted by Paul Hollands pj at 03:45 PM | Comments (0)
Getting a date from a bigint in PostgreSQL
'1970-01-01 00:00:00 GMT'::timestamp + ((e.event_start_date::bigint)::text)::interval as ma_date
Posted by Paul Hollands pj at 12:19 PM | Comments (0)
September 02, 2009
Odin's Bra Treefest
Posted by Paul Hollands pj at 11:26 PM | Comments (0)