Tool(s) to + column & rows on HTML5 tables - html

I was about to fork a compatibility guide & when I looked at the HTML, I saw it was a table.
Tables are good to show data like this, but not fun to edit when you have to edit every few weeks.
What tools can edit an existing HTML table very quickly & cleanly add/remove/clone columns & rows quickly & painlessly please?
Can be online, GUI or WYSIWYG (prefered) or command-line driven, on or off-line (though online with JavaScript engine that is Node.js compatible is preferred).
Or perhaps another way is better to show tabular data that changes every few weeks, like AJAX presenting JSON data, but still need some hand-holding for the best scenario here also.
Table & suggestion in question:
https://github.com/kangax/es5-compat-table/blob/gh-pages/es6/index.html
https://github.com/kangax/es5-compat-table/issues/29

Different people has different needs and attitudes!
1).You can use a spreadsheet program to edit the table and export to html.Google spreadsheet provides functionality to embed a preadsheet to a web page or to download(export) the spreadsheet in simple HTML, you can use CSS to style it to fit your needs.
2).Google's API can grab data from a spreadsheet and show like a table.What you have to do is just edit the Google spreadsheet!
I checked the API and could build a quick example,Here is the fiddle!
Here is a little summery of what I did,
var query = new google.visualization.Query(
'http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&pub=1');
The spread sheet I refer here is http://spreadsheets.google.com/ccc?key=pCQbetd-CptGXxxQIG7VFIQ
// Apply query language.
//I'm selecting all the cols!
query.setQuery('SELECT * ');
// Send the query with a callback function.
query.send(handleQueryResponse);
in my callback,
var data = response.getDataTable();
//init the table
visualization =
new google.visualization.Table(document.getElementById('table'));
visualization.draw(data, null);

Related

Populate word document from html form

I am new to web development and need your help to figure out how to use the form in HTML and use the data to populate the said field in a word document. Any advice on how to approach this problem is highly appreciated. It would really help if you could post a live example for the below. Please,do let me know if any further explanation is required.
As a new developer, I want to advise you that you are getting into some challenging territory here and many of the solutions might require some heavy experience with programming and MS Word. In this forum, there are many options you can try, but from what I gather you will need to learn about macros.
The second option you could try are some services that will do this for you for a fee. Here are two options. Check out Formstack or Jotform
If you use this type of service, you would create a form action within your html code that will merge the data from the form into the Microsoft Word Document using merge tags.
The third option you can try is using Javascript within the form to populate the Word Document. The code would look more like this:
function Export2Word(element, filename = ''){
var preHtml = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns='http://www.w3.org/TR/REC-html40'><head><meta charset='utf-8'><title>Export HTML To Doc</title></head><body>";
var postHtml = "</body></html>";
var html = preHtml+document.getElementById(element).innerHTML+postHtml;
var blob = new Blob(['\ufeff', html], {
type: 'application/msword'
});
// Specify link url
var url = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(html);
// Specify file name
filename = filename?filename+'.doc':'document.doc';
// Create download link element
var downloadLink = document.createElement("a");
document.body.appendChild(downloadLink);
if(navigator.msSaveOrOpenBlob ){
navigator.msSaveOrOpenBlob(blob, filename);
}else{
// Create a link to the file
downloadLink.href = url;
// Setting the file name
downloadLink.download = filename;
//triggering the function
downloadLink.click();
}
document.body.removeChild(downloadLink);
}
Export HTML Table Data to Excel using JavaScript
HTML Content:
Wrap the HTML content in a container you want to export to MS Word document (.doc).
<div id="exportContent">
<!-- Your content here -->
</div>
Last option would be using PHP, and I recommend watching this video by CodexWorld and reviewing the post that goes along with it here. This is a challenging concept, so I would encourage you to take your time.
Hopefully this will help and best of luck.
Well, I don't know how to exactly do that, I am also a beginner like you. What seems to help you might be connecting your form with Google Sheets. The Google Spread Sheet will store all data submitted via your form. You can then use this data wherever you want.
There is an open source project for this task, you can do that by following the steps stated here: https://github.com/dwyl/learn-to-send-email-via-google-script-html-no-server
You can see it in action here: https://nisootech.vercel.app/#contact-me
There are two parts in your application
Enabling user to input the values in frontend. Which you can build using any frontend technology stack eg: HTML and Plain Javascript(Required for calling the Services), React JS, Angular etc.
Backend Service which will basically does the heavy work
Receiving the input from user.
Creating Word file using any libraries such as
Generate word files using Apache POI ,
Using Node.js to generate dynamic word document using Database value
Downloading the file after its completely generated using the values supplied by user.
download a file from Spring boot rest service
how to download file in react js
For the Backend service you can use technologies like Java and Springboot, Python, Node Js etc.
Building Restful webservices using spring
Use Technology in which you are more comfortable and start building. These Links and documentation you can use to start from basic.
Suggest you to breakdown your problems focus on each specific areas and do the development as per your smaller problems and integrate them later.

Writing a script to Clear Data at a specific time, Archive the cleared data and if possible move certain fields to a separate sheet

I have a google form that I am trying to have people answer questions to each day. It is mandatory that this form is completed before they come to the facility. I need a script to clear the data in the Response Tab at midnight each night and I need that data that is being cleared to be archived in a separate sheet if possible. A bonus feature would if as the responses come in each day, the could populate on a separate sheet with 4 fields, "Student ID", "Last Name", "First Name" and "Cleared"
I know I'm asking a lot! The most important thing is the clearing daily and being able to archive the previous day's data (even if it has to be a tab in that file)
To be fair I'm also very new to using scripts if I have to do anything special besides add script I might need some guidance there as well.
Any help anyone could give would be awesome!!!
As Nabnub has already indicated, this is really too much for one question. However, the appointment scheduling system that I made for my tutoring website, (see tutoringbyroger.com), does something quite similar to what you would need, so I will give you some quick pointers below on what worked for me:
You will need to open up the form where the information comes in and go into the script editor from there. Once in there, this function should get you started:
function closeForm(e){
// First we will get the information they entered and parse it
// into an array of strings:
var responsesArray = e.response.getItemResponses();
var txtResponsesArray = [];
var len = responsesArray.length;
for(var i=0; i < len; ++i){
txtResponsesArray[i] = responsesArray[i].getResponse();
}
// We can now do stuff with the strings in txtResponsesArray, like add them to
// a spreadsheet or something.
}
In the script editor you will need to click on triggers, and add a trigger to run the above function when the form is closed. That way, you can capture the data and process it the instant it is submitted.
Create a separate function whose sole purpose is to clear out the information that you would like to clear. This can be from the form or the spreadsheet, or both. It can be in the same script file, just outside of the closeForm() function.
Create another trigger to run the function that does the deleting when you would like that task done.
Anyhow, that is a taste of what you will need to get started. Here are some relevant links to some documentation you might find useful:
How to open a form. (Note: the ID comes from the url of the form when you edit it)
How to open a spreadsheet.
I hope that gives you some idea of where to start.

Display player count on website from another website

I'm trying to fetch "current / max Players" from this site:
http://rust-servers.net/server/64099/
I would like to display just the player numbers, eg. "70 / 175" on another website and have it update every time someone visits my .html page (I can change that one to .php if needed.)
How would I go about doing that in the most simple and efficient way?
I've googled the issue for some hours without any luck, I'm no closer to understanding what I would want to use to do this as everyone seems to suggest widely different methods and most seem way too verbose for the simple thing I'm trying to do - many examples fetch the data as JSON (?) with some JS/jQuery (?) and use a bit of code to find specific items in that data, define it as a variable or array and then display it later.
I've figured that the information I want can be referred to using XPath "/html/body/div[4]/div/div/div[9]/div[1]/table/tbody/tr[4]/td[2]/strong" but that's about it. How do I proceed from there?
Thank you.
It depends on which platform do you want to use.
If you use C#, you can use HtmlAgilityPack library.
It is basically like this:
var webClient.DownloadString("http://rust-servers.net/server/64099/");
var doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(htmlCode);
var node = doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/div[4]/div[1]/div[1]/div[9]/div[1]/table[1]/tbody[1]/tr[4]/td[2]");
var nodeValue = node.InnerText;

How can I generate a file like this for Bing Heat Map data?

I am working on a fairly simple Heat Map application where the longitude and latitude of the points will be stored in a SQL Server database. I have been looking at an example that uses an array of objects as follows (eliminated a lot of data for brevity):
/* Sample data to demonstrate Bing Maps Heatmap */
/* http://alastair.wordpress.com */
var CrimeData = [
new Microsoft.Maps.Location(52.67280, 0.94392),
new Microsoft.Maps.Location(52.62423, 1.29493),
new Microsoft.Maps.Location(52.62187, 1.29080),
new Microsoft.Maps.Location(52.58962, 1.72228),
new Microsoft.Maps.Location(52.69915, 0.24332),
new Microsoft.Maps.Location(52.51161, 0.99350),
new Microsoft.Maps.Location(52.59573, 1.17067),
new Microsoft.Maps.Location(52.94351, 0.49153),
new Microsoft.Maps.Location(52.64585, 1.73145),
new Microsoft.Maps.Location(52.75424, 1.30079),
new Microsoft.Maps.Location(52.63566, 1.27176),
new Microsoft.Maps.Location(52.63882, 1.23121)
];
What I want to do is present the user with a list of some sort that displays all the data sets that exist in the database (they each have a name associated with them) and then allow the user to check all or only a select few. I will then need to generate an array like the above to create the heat map. Any ideas on a good approach to this?
What you trying to achieve is more related to a web developement rather than only related to Bing Maps.
To summarize, you have multiple ways to do this but it really depends on what you are capable to do and what you need in the interface.
What process/technology?
First, you need to determine what process you want to follow to display the data and it will set the technology that you will use. The questions that you need to ask yourself are:
Do you want to be able to change the data sets dynamically without refreshing the whole page?
If yes, it means that you will have to use asynchronous data loading through a dedicated web service in order to avoid loading all the information at the initial load of the page.
Do you have lots of data to load?
If so, it might comfort you with asynchronous loading to avoid loading all data.
If not loading every elements in multiple arrays might be the simplest solution.
Implementation
So now, you want to create a web service to load the data asynchronously, you can take a look at the following websites :
http://www.asp.net/get-started
http://www.stefanprodan.com/2011/04/async-operations-with-jquery-ajax-and-asp-net-mvc/
There might be interesting other website, you will be able to find them. If needed, add comment and I'm sure the community will help you.
If you want to generate the data directly in the script, it could be simple as you can compose the JavaScript directly in your dynamically created HTML page (in your ASP.Net markup code or whatever technology you're using).

Use a Google doc (spreadsheet) in my script

I'm new to SO (although not to the SE medium), so though I've searched for an answer (using the site's search function and Google) there's a chance it's been asked and answered before; if so, thanks in advance for flagging as duplicate (provided I can find some assistance in the original, naturally).
I'm trying to compose a script for my personal use that would aggregate and filter RSS feeds. I've got the RSS corner handled (thanks in large part to this Programmer's Library entry), but the point where I'm stuck is that I want to make the filter modular by making it look for phrases contained in a spreadsheet file on my Google Drive. That way, if I ever need to modify/add filtering terms, I could simply edit the file on my Drive instead of going into my script's code.
So, I've been browsing the APIs for classes File, Spreadsheet, SpreadsheetApp, ScriptDb, as well as this Developer's article, but I just can't get my head around it (and I get the feeling I might not be looking in the right place). What I need to do, in the most basic terms, is load (and perhaps save) an array (it could be Object[][] for all I'm concerned) from (to) a spreadsheet file on my Drive. Then I could easily filter by the entries of said array. Another thing I'll be interested in doing is to keep some statistics on how much each term was used as an active filter, which is where saving a modified array back to my Drive would come in handy.
In conclusion, I should mention that I took some Java in collage, but as a math major I was never very accomplished with it; I'm comfortable using examples of similar things and making adjustments to do what I need, but probably not much more than that (although I'm more than willing to learn, if things are explained in a way a non-professional-programmer can understand). I'll appreciate any help you could give me (referring me to the correct place in which to get my answers would be super), but please keep in mind that my head's liable to explode if things get too technical.
Many thanks.
here is an example with your criteria :
function getArrayFromSheet(sheetName) {
var ss = SpreadsheetApp.openById('0AnqSFd3iikE3dF9hb3RUeHBqNUt2NGdkRlUycVZQN0E');// edit this id to suit your spreadsheet
var sh = ss.getSheetByName(sheetName);
var lastRow = sh.getLastRow();
var lastCol = sh.getLastColumn();
var data = sh.getRange(2,1,lastRow,lastCol).getValues();// starting from row nr 2 to skip headers if present (otherwhise start from 1)
// data is an array of arrays [[row1],[row2],[row3],[...]] 0 indexed, each row inside the array is an array of the cell values
return data
}
// usage :
function testFunction(){
var firstRowOfData = getArrayFromSheet('filters')[0];
Logger.log(firstRowOfData)
}
here is a testSpreadsheet to start with (make a copy to run the code)