I am looking for some advice on what to read up on. I am trying to make a webapp for my school that teachers can user for the school reward system. It is designed as a front end to a google sheets spreadsheet. The teachers log how many housepoints a child has earned in a lesson via a table with a column of text inputs (one for each child in the class) The webapp then adds these to the spreadsheet using the appendrow method.
I have one problem currently and need some advice on what I should do about another issue I can see on the horizon!
Current issue:
I have a javascript function that checks the housepoint values that have been added to each child collects a list of ids and the number of housepoints and sends these to google apps script as attributes of an object via a for loop.The apps script then strips the attributes and adds the data to a spreadsheet. The issue is as I understand it the apps script takes too long to append the rows and the javascript for loop does not wait for the apps script to catch up. The result is that it misses some of the data out and only appends a fraction of the rows it should do. Is there a way to get the javascript function to pause and wait for the app script to say its ready for the next object?
Potential issue: As this script is meant to be used by multiple teachers at the same time I am worried that if the same function (to add the housepoints to the spreadsheet) is called at the same time by different users what will the app script do? I would imagine it will collapse. I have tried to investigate what to do on this and have to say I do not understand what I am reading. What I really want is the app script to "park" each request in a cue and then chug through them at its own speed. Is this possible?
As you may have guessed I am not an experienced programmer, I am willing to read up and learn but just would like someone to point me in the right direction. Many thanks in advance for your time.
Related
Is it possible to have a database under MySQL export rows into managed folders accessible to the web with the contents of each column be it's own text file OR json file?
To be honest, I can't find anywhere on how to do this?
My question seems to be quite niché.
Ill break down my problem.
lets say I have a database, with a table called "registry"
under registry, I would have 4 columns.
for example:
username nickname dob timestamp
bob2414 bobby 03211989 201019
sarah83 sars 10162002 231019
masterc carlo 07271997 261019
blahhbh umomi 03241999 281119
is there a way, upon a new entry, to trigger either a JS bot, or any kind of automation to create a structure on the web that could be called upon, for example.
domain.com/registry
bob2414/
nickname.txt
dob.txt
timestamp.txt
(or)
bob2414.json
sarah83/
nickname.txt
dob.txt
timestamp.txt
(or)
sarah83.json
masterc/
nickname.txt
dob.txt
timestamp.txt
(or)
masterc.json
and so on?
is there a page i can view, or any video explanation online?
Are there any better ways I can do this?
The application of my problem lies within creating these directories, as I don't want one huge json file hanging around, because i plan on these files being downloaded and accessed, and want smoother download times then managing a huge database.
The same would also apply to after I delete a row, would it manage to be deleted on its own?
please, and thank you. Ill help any way I can!
Answering my own question with a personal thought experiment.
In theory it would be easier to design an element in PHP to query the database with a GET request, and have data presented in JSON format, than to worry about managing files and directories with a java or javascript applet
I'm quite new to SharePoint (about 1 week into it actually) and I'm attempting to mirror certain functionality that my company has with other products. Currently I'm working on how to duplicate the tasking environment in Box.com. Essentially it's just an email link that goes to a webpage where users can view an image and comments related to that image side by side.
I can dynamically load the image based on url parameters using just Javascript so that part is not a problem. As far as the comments part goes I've been trying to use a Noteboard WebPart, and then my desire is to have the "Url for Note" property to change dependent on the same URL parameter. I've looked over the Javascript Object Model and Class Library on MSDN but the hierarchy seems to stop at WebPart so I'm not finding anything that will allow me to update the Url for Note property.
I've read comments saying that there's a lot of exploration involved with this so I've tried the following:
-loading the javascript files into VisualStudio to use intellisense for looking up functions and properties in the SP.js files.
-console.log() on: WebPartDefinitionCollection, WebPartDefinition, WebPart, and methods .get_objectData(), get_properties() on all the previous
-embedding script in the "Builder" on the Url for Note property (where it says "click to use Builder" - I'm still not sure what more this offers than just a bigger textbox to put in the URL path)
I'm certain I've missed something obvious here but am gaining information very slowly now that I've exhausted the usual suspects. I very much appreciate any more resources or information anyone has and am willing to accept that I may be approaching this incorrectly if someone has accomplished this before.
Normally I'd keep going through whatever info I could find but I'm currently on a trial period and start school back up again soon so I won't have as much time with it. Apologies if this seems impatient, I'm just not sure where else to look at the moment.
Did you check out the API libraries like SPServices or SharepointPlus? They could help you doing what you want...
For example with SharepointPlus you could:
Create a Sharepoint List with a "Note" column and whatever you need to record
When the user goes to the page with the image you just show a TEXTAREA input with a SAVE button
When the user hits the SAVE button it will save the Note to the related list using $SP().list("Your list").add()
And you can easily retrieve the information (to show them to the user if he goes back to the page) with $SP().list("Your list").get()
If I understood your problem, that way it may be easier for you to deal with a customized page :-)
I have searched all over the net, and can't find a solution to this. I have no experience in AJAX but know it will be needed to perform this function as I believe it would be better than just using pure javascript.
I have a list of members who registered on my site, list is on a separate page --> on that list for each member, there is either a green dot (signifies if member is online) and if the user is offline (grey dot shows). I have that as a placeholder at the moment using only css and html. The <online /> and <offline /> are within the <h2> tag almost like a <span> tag. Is there a way to auto-update this to show who is actually logged in/out in real-time and without using NodeJS and/or SocketIO?
The html looks like this:
<h2>Billy <online title="Online" /></h2>
Where the <online title="Online" /> will then display the green dot next to their name if online (logged in). If they are not logged in, the html should look like this:
<h2>Billy <offline title="Offline" /></h2>
Where the <offline title="Offline" /> will then display the grey dot next to their name if offline (logged out).
Like I also mentioned, I have no experience in AJAX but am pretty sure it's something I'd need to perform an auto-update/refresh time just for this section alone - so NOT for the entire page...And I am a little familiar with PHP, so I would base a query using SESSION_[ID] to see/gather information on who is logged in and who isn't.
If anyone could help, I'd greatly appreciate it, I've been searchin' for days on how to accomplish this and cannot find anything...
Demo of what I currently have: http://jsfiddle.net/tZpk6/
While I am not all JS fancy, the basics of this is to simply update a table in your database with the latest time that someone was logged in or performed an action - then when you are displaying the information about users, you simply query that table - anyone in say the last five or ten minutes who had some kind of activity is considered "Online" - and others... well aren't.
Your script can't really use session IDs - as they are unique and only visible to the user who is running the code. By that I mean, that although you might have a dozen users on your site, all of whom are using a session variable, they cannot interact with one another. Each user (and by that I mean the code running) can only access their own session variables. If you want them to be able to see each other, it has to be done via an intermediary device such as a database, or a file - or an actual application that is constantly running - written in Java or C# or the like, which is ALWAYS running and being passed data from the PHP code.
So basically, although you can apply AJAX to check constantly for the updates, the data in the background is pretty much always done via a simple table that you can implement either on page reload or get a bit fancier and check it on a regular basis via scripts running inside your page.
I am trying to create a Google Apps Script that keeps a Google Calendar and a "master spreadsheet" on Drive synchronized -- is this possible? I found these two posts:
http://blog.ouseful.info/2010/03/04/maintaining-google-calendars-from-a-google-spreadsheet/
http://blog.ouseful.info/2010/03/05/grabbing-google-calendar-event-details-into-a-spreadsheet/
I'm quite sure this could be done using a lot of if statements and logic, but maybe there's a simpler way?
I ended up just providing the following simple script. All that was really necessary was adding events based on two columns, and this would've taken too long to develop.
function onOpen() {
//spawns a menu with a button that triggers AddToCal
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Add event to calendar",
functionName : "AddToCal"
}];
sheet.addMenu("Data To Calendar Plugin", entries);
};
function AddToCal(){
//get the current row
var ss = SpreadsheetApp.getActiveSpreadsheet();
var cell = ss.getActiveCell();
var R = cell.getRow();
//grab values for current row to pass to calendar event
var date_of_event = ss.getRange('G'+R).getValue();
var date = new Date(date_of_event);
var event_title = ss.getRange('A'+R).getValue();
//access the calendar
var cal = CalendarApp.getCalendarById('[IDREMOVED]');
cal.createAllDayEvent(event_title,date);
ss.toast("Event added to " + cal.getName());
}
Yes, it's possible to write a two-way event synchronization script, but it isn't going to be simple. Those two posts you refer have parts that could be reused, but they are quite elementary compared to the challenges you'll face with actual synchronization. You may want to read over Using Google Apps Script for a event booking system which does create calendar entries based on a spreadsheet (but doesn't do on-going synchronization). I've done some debugging of that script in past.
Synchronization would need to support:
Creation of events in either location
Modification of event details in either location (although you could opt to consider only a subset of event details for simplification)
Deletion of events in either location
Recurrence, e.g. CalendarEvent.getEventSeries() handling (or choose to avoid)
This is pseudo-code that you could start with:
Open Calendar, Read Calendar events into calArray (will all attributes you care for)
Open Spreadsheet, Read Spreadsheet events into sheetArray
For each event in calArray:
Search for calEvent in sheetArray.
If found, compare lastUpdated values.
If equal, do nothing
Otherwise copy most recently updated to least recently updated
Continue with next event
If not found then copy calEvent to new sheetEvent, including lastUpdated value.
Continue with next event
For each event in the sheetArray (...that hasn't been handled yet)
Similar logic above.
Write updated sheetArray to spreadsheet.
Write updated calEvents to calendar API (see note 1 below)
Notes:
All updates to calEvents could be made to array and written to calendar API immediately, as an alternative to a bulk update. This would eliminate the need to track the changes locally, although it would be a good idea to touch the lastUpdated value.
You will want to use CalendarEvent.getLastUpdated() when reading calEvents, and store a similar value in your spreadsheet (tied to an onEdit trigger) to facilitate comparisons.
It would simplify comparisons to record CalendarEvent.getId() against events in the spreadsheet. You also have CalendarEvent.setTag(key,value) that could be used to record custom metadata into the calendar, for instance to indicate events that originated or have been synchronized with your spreadsheet. (These tags are not accessible through the GCal UI, so would only be accessible via script.)
You should think about the range of dates or number of events you want to deal with, and limit the scope of the script. If you don't, you are sure to run into execution time limits in real operation.
Some Calendar Event characteristics don't lend themselves to easy expression in a spreadsheet, for instance:
Guest list
Reminder list
As mentioned (thanks Henrique) in the other post I've spent some time - it was actually what brought me to GAS originally - on data exchange between spreadsheets and calendars mainly because people I worked with where used to organize their time schedule (for a highschool) in spreadsheets and I had to take care of the transition to Google Calendars.
After some time though it appeared that the online Calendar interface is far more effective to create events so they don't use the sheet to Calendar scripts anymore !!
On the other hand, the printing and presentation options in GCal are very limited so the other direction is still very useful and we use it all the time !
I know this will seem to be out of subject regarding the original question and maybe too anecdotic but I just wanted to point out that you should thoroughly think about what you really need before reinventing the wheel... As Mogsdad mentioned, some events parameter are not easily described in spreadsheet logic and finally it could become a lot more complicated to use than the original tool.
The only really useful tool I developed using bidirectional data transfer is a 'batch modification tool" when I need to delete or edit a big number of similar events.
For example if we need to change a teacher's name for some reason all along the year I import all the events for a number of class, replace the name in the spreadsheet and update back the class calendar... it takes me 5 minutes and is very easy but these are very specific use cases and I'm not sure it is very common.
Anyway I wouldn't call that "synchronization" since it only takes some events some time and changes them... I've never attempted to keep a spreadsheet up to date with a calendar, from my experience calendars are pretty reliable and I consider them as the original data source. As I already said, we import data in spreadsheets every week just for printing and local archiving.
Sorry for this long and a bit vague comment (that was way too long to fit in a normal 500 chrs comment ;-)
No there isn't. And although a lot of issues regarding Apps Script Calendar Service has been solved (timezones, all day events, queries and so on), it's still a fairly complex task.
I know Serge, the top contributor here in SO on #google-apps-script tag, has developed quite some scripts involving the Calendar Service.
But I don't know of anyway that made a two-way update between a calendar and a spreadsheet. It should be a hard one. If you ever do, please be kind to share :)
I wrote a script that synchronizes between GCalendar and a GSheet. You may be able to use it as is, or can certainly borrow ideas from it. There are separate commands for copying events each way: https://github.com/Davepar/gcalendarsync
I'm putting together a simple website for our department. I'd like to include one of the references that we use often on the main page, a word document that contains a priority list for outstanding work. This document is generated by another department and located on a shared drive. The info is not in a table, but uses a fairly consisten format for displaying info.
Ex: (the info is actually formatted like this)
--------------
Item Title
--------------
Tracker#: 12345-0012 Due; 01/01/12
Description...
My ultimate goal is to have a table on the main page that contains the various items in the priority list. I would like a mechanism that automatically checks the word docs about once an hour, parses the document, generates a table from the info in the doc, and updates the main page accordingly.
I've never done anything like this and have no idea where to start or if what I'm asking is even possible. I'm not in IT and do not have the ability to use ASP or PHP at the moment. So I'd like to avoid server-side scripting if possible, but I may be able to work something out if absolutely necessary.
Thanks
I know how to do this in java.. you can use the docx4j library.. Without that it would be difficult. Can't the team that create the doc store the file as a flat file as well maybe?
One possible solution is to save document as html (using automation - create Word.Application object, call Open, SaveAs) and serve it directly or inside frame.