Pages

Showing posts with label from. Show all posts
Showing posts with label from. Show all posts

Monday, March 9, 2015

Interact with your Google Docs List from Apps Script

We recently added a new feature to Apps Script: the ability to interact with your Google Docs List. With this new integration, scripts can create, rename, or move files and folders in your Google Docs. In addition, scripts can now create, modify, and clear plain-text files and search through your documents for a specified query string.

For instance, take a company whose website is hosted on Google Sites. They have a Specials page where they want to list seasonal sales depending on upcoming holidays. They store the details about the seasonal sales in plain-text files that are saved in their Google Docs List. By using the Google Docs List and and Sites services within Apps Script along with time-based triggers to run the script once per day, they can keep their Specials page updated automatically. Here’s a code snippet that demonstrates how to update the Specials page:


//The Mother’s Day sale runs from May 1 - May 7, 2011
var MOTHERS_DAY_START = new Date("May 1, 2011");
var MOTHERS_DAY_END = new Date("May 7, 2011");
//The Valentine’s Day sale runs from Feb 6 - Feb 13, 2011
var VALENTINES_DAY_START = new Date("February 6, 2011");
var VALENTINES_DAY_END = new Date("February 13, 2011");

function updateSpecials() {
var today = new Date();
var site = SitesApp.getSite("example.com", "giftshop");
// Get all the web pages in the Site
var pages = site.getWebPages();
// Loop through the web pages to find the specials page
for (var i = 0; i < pages.length; i++) {
if (pages[i].getPageName() == "specials") {
var page = pages[i];
}
}
// Set up the default wording for the specials page
var pageText = "There are no specials at this time.";

// If today’s date is within the Mother’s Day sale range
if (today >= MOTHERS_DAY_START && today <= MOTHERS_DAY_END) {
// Find the sale text that’s stored in the file mom.txt
pageText = DocsList.find("mom.txt")[0].getContentAsString();
}
// If today’s date is within the Valentine’s Day sale range
else if (today >= VALENTINES_START && today <= VALENTINES_END ) {
// Find the sale text that’s stored in the file valentines.txt
var pageText = DocsList.find("valentines.txt")[0].getContentAsString()
}
// Set the content of the specials page
page.setContent(pageText);
}​




If this script is then set up to run using a trigger that calls it at the same time each day, then the Specials page will be kept automatically up-to-date.

To help you learn more, weve created a tutorial that demonstrates how to search and display information about files, create files, and read content from files.

Note that certain features of the DocsList service, such as creating files, are only available to Google Apps accounts. For complete information on interacting with your Google Docs List using Apps Script, see the DocsList Service documentation.

We look forward to seeing how you use this integration. If youd like to learn more about Apps Script and meet the Apps Script team in person, join us at the upcoming Apps Script hackathon in New York City on June 24.

Read more »

Wednesday, February 25, 2015

From Andragogy to Heutagogy

Link to article (By Stewart Hase and Chris Kenyon)
"...This paper suggests there is benefit in moving from andragogy towards truly self-determined learning. The concept of truly self-determined learning, called heutagogy, builds on humanistic theory and approaches to learning described in the 1950s. It is suggested that heutagogy is appropriate to the needs of learners in the twenty-first century, particularly in the development of individual capability. A number of implications of heutagogy for higher education and vocational education are discussed."

"A heutagogical approach recognises the need to be flexible in the learning where the teacher provides resources but the learner designs the actual course he or she might take by negotiating the learning. Thus learners might read around critical issues or questions and determine what is of interest and relevance to them and then negotiate further reading and assessment tasks. With respect to the latter, assessment becomes more of a learning experience rather than a means to measure attainment. As teachers we should concern ourselves with developing the learner?s capability not just embedding discipline based skills and knowledge. We should relinquish any power we deem ourselves to have."

Heutagogy promotes a self-determined learning approach beyond the reality of most of todays Universities. It will surely empower learners increasingly in determining their future education! Though, are learners ready to take this role of responsibility of designing their own courses (or program)? Also, are Universities or the current generation of teachers and lecturers prepared for such a revolution on par with Andragogy? It will be interesting to see how heutagogy or similar theories will affect the learning process both in the higher learning and corporate sectors in the coming years.

In the meantime lets learn more about Heutagogy.

Read more »

Thursday, February 5, 2015

Sample code from todays class on AS3 Tweens 2011 02 17

I talked about the AS3 Tween class today and how it can be used to create motion tweens using AS3 code. For the example discussed in class, I used a for loop to create multiple sprite instances, and multiple tween objects to animate those sprites. The size, color and movement properties of each moving sprite were randomized as well. I also talked about the MOTION_FINISH event related to the AS3 Tween class, and how it can be used with the yoyo() method to make the tweens loop back and forth. Some of my students asked if I could post the sample code from our session today about the AS3 Tween class, so Im posting it here. I also created another version that has more randomized properties. The AS3 Tween class is great for creating simple motion tween animations using code.

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.display.Sprite;

var nSprites:Number = 25;
var aSprites:Array = new Array();
var aTweenX:Array = new Array();
var aTweenY:Array = new Array();

for (var i:Number = 0; i < nSprites; i++)
{
var nRadius:Number = Math.random() * 25 + 10;
var nColor:Number = Math.random() * 0xFFFFFF;
var nStartX:Number = Math.random() * stage.stageWidth;
var nEndX:Number = Math.random() * stage.stageWidth;
var nStartY:Number = Math.random() * stage.stageHeight;
var nEndY:Number = Math.random() * stage.stageHeight;

aSprites[i] = new Sprite();

aSprites[i].graphics.beginFill(nColor);
aSprites[i].graphics.drawCircle(0,0,nRadius);
aSprites[i].graphics.endFill();

addChild(aSprites[i]);

aTweenX[i] = new Tween(aSprites[i], "x", Elastic.easeInOut, nStartX, nEndX, 3, true);
aTweenY[i] = new Tween(aSprites[i], "y", Elastic.easeInOut, nStartY, nEndY, 7, true);

aTweenX[i].addEventListener(TweenEvent.MOTION_FINISH, onMotionFinish);
aTweenY[i].addEventListener(TweenEvent.MOTION_FINISH, onMotionFinish);
}

function onMotionFinish(e:TweenEvent):void
{
e.target.yoyo();
}
Heres another version with even more randomization. The duration for each tween is randomized. The easing used is also randomized. The different easing functions are placed in an Array. Then we get a random number thats anywhere from 0 to the highest index value in the array, and use that to retrieve an easing type randomly from the easing functions Array:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
import flash.display.Sprite;

var nSprites:Number = 25;
var aSprites:Array = new Array();
var aTweenX:Array = new Array();
var aTweenY:Array = new Array();
var aEasing:Array = new Array(None.easeNone, Back.easeIn, Back.easeOut, Back.easeInOut, Bounce.easeIn, Bounce.easeOut, Bounce.easeInOut, Elastic.easeIn, Elastic.easeOut, Elastic.easeInOut, Regular.easeIn, Regular.easeOut, Regular.easeInOut, Strong.easeIn, Strong.easeOut, Strong.easeInOut);

for (var i:Number = 0; i < nSprites; i++)
{
var nRadius:Number = Math.random() * 25 + 10;
var nColor:Number = Math.random() * 0xFFFFFF;
var nStartX:Number = Math.random() * stage.stageWidth;
var nEndX:Number = Math.random() * stage.stageWidth;
var nStartY:Number = Math.random() * stage.stageHeight;
var nEndY:Number = Math.random() * stage.stageHeight;
var nDurationX:Number = Math.random() * 5 + 2;
var nDurationY:Number = Math.random() * 5 + 2;
var nEasingX:Number = Math.floor(Math.random() * aEasing.length);
var nEasingY:Number = Math.floor(Math.random() * aEasing.length);

aSprites[i] = new Sprite();

aSprites[i].graphics.beginFill(nColor);
aSprites[i].graphics.drawCircle(0,0,nRadius);
aSprites[i].graphics.endFill();

addChild(aSprites[i]);

aTweenX[i] = new Tween(aSprites[i], "x", aEasing[nEasingX], nStartX, nEndX, nDurationX, true);
aTweenY[i] = new Tween(aSprites[i], "y", aEasing[nEasingY], nStartY, nEndY, nDurationY, true);

aTweenX[i].addEventListener(TweenEvent.MOTION_FINISH, onMotionFinish);
aTweenY[i].addEventListener(TweenEvent.MOTION_FINISH, onMotionFinish);
}

function onMotionFinish(e:TweenEvent):void
{
e.target.yoyo();
}
Read more »