Preventing Screenshots - excel

Ok, I know this is probably impossible but I currently have a spreadsheet on google sheets that I would like to share with a large group of people, but unfortunately the last time I did this there were countless people that took the information and claimed it as their own and other such problems. No one had a problem downloading google drive to access the spreadsheet and did so without complaint. I've since removed that sheet and completely changed the layout and information. I was wondering if there was any way to make things more difficult for anyone that would like to screenshot the sheet. I know that anyone that looks into it can figure out how to screenshot anything, but I honestly don't think they will, and if they decide to go through more steps just to screenshot the info then o well. It's the internet and some things can't be prevented.
TL,DR; Can I add anything to my google spreadsheet to make taking a screenshot more difficult. I'm also willing to move the spreadsheet to another program if that is required, as long as I can still share the information. Everyone that the sheet is for will download the app to access it.(well, 98% of them) I know it sounds silly, but any help would be greatly appreciated.
I want to state that I have looked for awhile and haven't been able to find an answer for my particular question but if this has an answer somewhere and I missed it please direct me there and i will remove this question., and I would also like to say that "you can't stop someone from taking a screenshot, deal with it" isn't required.
Thanks you to anyone that read this. Hopefully someone has some insight and hopefully this helps others with any similar problems.

Below is an example of a client side script that gets the data feed from a spreadsheet (make sure the sheet is published and set to anyone with the link can view). With the data feed you could do anything, such as a table that disappears after a few seconds, or add a watermark as mentioned above. You could also render the data in hard to copy format such as light grey text on a white background.
//https://docs.google.com/spreadsheets/d/1OY18xmnT-O4AWzGDC63RvzzmNgyKHOnuvq-RX6M_6xw/edit#gid=0
var spreadsheetID = "1OY18xmnT-O4AWzGDC63RvzzmNgyKHOnuvq-RX6M_6xw";
var url = "https://spreadsheets.google.com/feeds/list/" + spreadsheetID + "/1/public/values?alt=json";
$.getJSON(url, function(incomingData) {
data = incomingData;
var entry = data.feed.entry;
showData(entry)
});
function showData(entry){
for (var items in entry){
console.log(entry[items].gsx$fruit.$t +": "+ entry[items].gsx$number.$t )
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
</head>
<body>
</body>
</html>

Related

Creating a chess board that calculates moves in backend in NodeJS

This is my first time using NodeJS so I apologize in advance if this is a noob question.
I want to build a NodeJS chess app where the user can play the computer, but the computer's moves are calculated on the backend. I've been trying to get chessboardjs to work, but I can't get much further than displaying a completely static start position. I'm using EJS to render the view. Here's what I've got so far:
<%- include('_header') %>
<link rel="stylesheet" href="css/chessboard-1.0.0.min.css">
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="js/chessboard-1.0.0.min.js"></script>
<center>
<h1>chess app</h1>
<div id="board" style="width: 400px"></div>
<script src='js/board.js'></script>
</center>
<%- include('_footer') %>
and board.js contains exactly the code from https://chessboardjs.com/examples#5001 (for now, random moves will suffice, I just want to figure out how to get this to work on the backend). Also, how exactly should I go about integrating chess.js? The tutorial completely skips it but I have no clue where to start on that.
Thank you in advance for your help! I really really appreciate it.
Generally, games have a certain number of things you need to manage like current state, game loops, etc. This state ideally live on the client side and persisted on the serverside periodically. So i feel since there is no backend code and there's isn't much info here, i suggest you start with a simpler game, react website had a tic-tac-toe tutorial if you are familiar with react that would be a good starting point to understand game development in general. Then i would recommend this book it has an excellent chapter on developing a browser game.
https://eloquentjavascript.net/
Now specifically for chess, we have something called a chess engine which processes the current state and suggests moves like stockfish which is a very complex and not something a newbie can implement

Chrome extension dropdown not correct size

I have a very simple chrome extension. It is almost entirely based on the sample. Sometimes when I click it it works perfectly, sometimes it only drops down a minimal amount.
This is the minimal drop amount
And this is it working correctly. (When I say correctly, ignore the fact that it's totally horrendous, that's stage two)
Question
What do I need to do to ensure that it drops down properly?
You should add <!DOCTYPE html> declaration at the beginning of the popup.html file. Glad it helps!

CodeMirror not indenting code

I am having some problems getting CodeMirror to indent the code at the beginning of a new line.
I have a text area, and when I hit save, the code that is saved to the DB is something like:
<meta charset=\"utf-8\">\r\n\t\t\t<title></title>\r\n\r\n<div class=\"wra ... etc
But when I read that out and do in the code behind in asp.net, ViewCode.Text = dbModel.ViewCode ... i.e. try to assign that string to the textarea which will then be 'converted' into the code mirror editor with relevant js on the page, the indent at the start of new lines is lost. If I indent half way along a line however, those render.
Also, if there is a new line return and then a blank row and then more text, the blank row gets lost when read back out to the text area.
Note: the textarea is runat server to fill the value from the database. I have tried with divs and literals but can't get it working.
So how can I save something like:
<div>
<b>
test
</b>
</div>
and not get it back like
<div>
<b>
test
</b>
</div>
I presume I have to encode it on save but I swear I have tried all encoding methods and now work! lol
Any pointers would be appreciated.
Cheers
Robin
Update/Solution
I have come back to put this in, in case some one stumbles across this post.
Basically I could not still not get the following to play nicely on the particular page in question. I.e.
Code behind
ViewCode.Value = dbModel.ViewCode
where
dbModel.ViewCode
// --> is comes from db as e.g.:
// <meta charset=\"utf-8\">\r\n\t\t\t<title></title>\r\n\r\n<div class=\"wra ... etc
JS (at end of page)
<script>
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("ViewCode"), {
lineNumbers: true
});
</script>
What I did get working however, is if you put the same JS code on the page, however, do NOT fill the text area from the code behind. Then I just make a simple ajax call to a page method to get the data (on page load).
$.ajax({
url: '/WidgetMaint.aspx/GetFileHTML',
type: 'Get',
contentType: 'application/json',
data: { tempid: id },
success: function(result) {
myCodeMirror.setValue(result.d);
}
});
The save and everything else works perfectly because the textarea is still run at server, so can still get its value 'on save', as code mirror takes care of this.
I am fairly sure that there is something else in the pipeline which is stuffing around with the text and 'formatting' it different before code mirror can get to it in time in the first attempt I was doing. However, with the ajax call the problem goes away because the browser/framework/whatever does not have any opportunity to access the string the DB returns. It is feed straight to the instance of code mirror which deals with it.
So in case you are having a similar problem, might be easier to change approach....
Cheers
Robin
Note: accepted answer by Eliran as it gave me this idea, and upvoted Marjin, because that comment proved it code mirror can handle indents...
I would advice you to drop that textarea and keep a live instance of CodeMirror on the page. That way you can assign the response directly to that instance using the CodeMirror API.
Take a look at doc.setValue(content: string) in particular, that should get you on the right track.

Can I use other video formats besides SWF in a feed post?

I have searched for two days on google trying to solve this problem. I have also searched this forum and read the FB Dev page till my eyes hurt. I asked this question two days ago and it got removed. I completely understand but if I am asking it incorrectly please, please, help me to ask correctly or point me in the right direction or tell me im an idiot, anything.
I am trying to use FB.UI to "Publish a story to the feed" from my site. That is working fine.
My problem is that I want to add a video instead of a photo. So based on the FB DEV docs, I am trying to use the "source" property to do this. But I have tried multiple video formats to no avail (avi, mp4, flv). The only thing that does seem to work is a SWF file but I do not have the video in that format. (tried to do that also but don't have the right tools)
Does anyone know if you have to use SWF or can you use another format and I am doing it wrong.
You can see my progress here http://www.thishope.org/facebook-tab.html (click on "get a free song" to get the dialog box.)
This is the code from my page
<html>
<head>
<title>This Hope</title>
<link href="http://www.thishope.org/this-hope-fb-style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '244237565620746',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : 'http://WWW.MYDOMAIN.COM/channel.html', // channel.html file
oauth : true // enable OAuth 2.0
});
</script>
<div id="fb-link">
<script type="text/javascript">
function newInvite(){
FB.ui({ method: 'feed',
message: 'Get A Free Song!',
source:'http://www.thishope.org/FB-Only-One-Lord.mp4',
name:'Get A Free Song By This Hope!',
caption:'Only One Lord',
description:'Click share to post on your wall and download the song',
});
}
</script>
Get A Free Song!
</div>
</body>
</html>
Could you not host a flash video player like flowplayer?
I know it supports FLV, not sure about other formats, you may need to convert to FLV server side first
You can then attach the SWF URL to your post, which will have the advantage of the video being playable right inside Facebook's news feed
Check this sample page's source: http://sdoyle.fbdublin.com/tests/tasks/632942.html
The meta tags on this page, when detected by Facebook (via a share or Like), render the flowplayer video player right into the news feed post, and flowplayer knows which video to play via the configuration passed to it as a parameter.
I know it's not exactly what you're trying to do, but should give you the right idea for your video.
You should be able to embed in the same manner by using the source parameter for the Feed Dialog to specify a flash player for your content

Disabling Back button on the browser [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am writing an application that if the user hits back, it may resend the same information and mess up the flow and integrity of data. How do I disable it for users who are with and without javascript on?
It's not possible, sadly. However, consider your applications navigation model. Are you using Post/Redirect/Get PRG Model? http://en.wikipedia.org/wiki/Post/Redirect/Get?
This model is more back button friendly than the Postback model.
You shouldn't.
You could attach some script to the onbeforeunload event of a page and confirm with the user that's what they want to do; and you can go a bit further and try to disable it but of course that will only work for users who have javascript turned on. Instead look at rewriting the app so you don't commit transactions on each page submit, but only at the end of the process.
I strongly urge you to go to heroic lengths to prevent breaking the back button, it is a sure fire way to alienate your users and even made it to No.1 on Jacob Neilsen's Top 10 Web Design Mistakes in 1999.
Perhaps you could consider rather asking the question: "How to avoid breaking the back button for <insert your scenario here>?"
If Scott's answer hits close to the mark, consider changing your flow to the PRG model. If it's something else, then give a bit more detail and see how we can help.
I came up with a little hack that disables the back button using JavaScript. I checked it on chrome 10, firefox 3.6 and IE9:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<title>Untitled Page</title>
<script type = "text/javascript" >
function changeHashOnLoad() {
window.location.href += "#";
setTimeout("changeHashAgain()", "50");
}
function changeHashAgain() {
window.location.href += "1";
}
var storedHash = window.location.hash;
window.setInterval(function () {
if (window.location.hash != storedHash) {
window.location.hash = storedHash;
}
}, 50);
</script>
</head>
<body onload="changeHashOnLoad(); ">
Try to hit back!
</body>
</html>
Best option is not to depend on postbacks to control flow, however if you are stuck with it (for now)
you may use something like this:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(Now.AddSeconds(-1));
Response.Cache.SetNoStore();
Response.AppendHeader("Pragma", "no-cache");
Soon you will find that it will not work on all browsers, but then you may introduce a check in your code like:
if (Page.IsPostBack)
{
if (pageIsExpired()){
Response.Redirect("/Some_error_page.htm");
}
else {
var now = Now;
Session("TimeStamp") = now.ToString();
ViewState("TimeStamp") = now.ToString();
}
private boolean pageIsExpired()
{
if (Session("TimeStamp") == null || ViewState("TimeStamp") == null)
return false;
if (Session("TimeStamp") == ViewState("TimeStamp"))
return true;
return false;
}
That will solve problem to some extend, Code not checked -- only for examples purposes..
It is possible to disable back button in all major browser. It just uses hash values to disable the back button completely.
Just put these 5 lines of code in your page
<script>
window.location.hash="no-back-button";
window.location.hash="Again-no-back-button";//for google chrome
window.onhashchange=function(){window.location.hash="no-back-button";}
</script>
Detailed description
Here's a previous post on it:
Prevent Use of the Back Button (in IE)
Whatever you come up with to disable the back button might not stop the back button in future browsers.
If its late in the development cycle I suggest you try some suggestions above but when you get time you should structure your flow so that the back button does not interfere with the logic of your site, it simply takes the user back to the previous page like they expect it to do.
It is true, proper validation should be added to make sure duplicate data doesn't mess things up. However, as in my case, I don't full control of the data since I'm using some third party API after my form. So I used this
history.go(+1);
This will send user forward to the "receipt" which is supposed to come after "payment" page if they try to go back to "payment" page (just giving a payment for example). Use sparingly, though
You could post the data on each form to a _NEW window. This will disable the back button on each window, but without javascript it might be difficult to force the old one closed.
I was able to accomplish this by using:
Response.Cache.SetExpires(DateTime.MinValue);
Response.Cache.SetNoStore();
When I used Response.Cache.SetCacheability(HttpCacheability.NoCache); it prevented me from downloading office files.
Find below link
Disable browser back button functionality using JavaScript in asp.net | ASP.Net disable browser back button (using javascript)
http://www.aspdotnet-suresh.com/2011/11/disable-browser-back-button.html

Resources