c compiler on own website to test users input - c

i know my question sounds maybe a little bit stupid or unreachable but i will try:
Is there any existing tool in the WWW that i can use on my own website to test users c language input and display the output of it when existing?
I know there are sites like: http://ideone.com/ who does this and so it should be possible but how is it possible for a normal user to put something like this on his own website?
I already found this question on stackoverflow but idk if that is what i'm looking for.
Thanks
Edit1: I tried some hard coded html just for test this plugin without wp
<!DOCTYPE html>
<html>
<head>
<title>Test run-this Plugin</title>
<meta charset="UTF-8" />
<meta name="description" content="Kurzbeschreibung" />
<link href="run_this.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="run_this.js"></script>
<script language="javascript" type="text/javascript" src="jquery-1.3.2.js"></script>
</head>
<body>
<h2> C example</h2>
<pre lang="c" line="1" class="run-this">
#include <stdio.h>
int main (int argc, char** argv) {
printf("Hello, World!");
return 0;
}
</pre>
<div class="run-this-button">
<input type="button" value="Run" onclick='run_this(this, "c", "CSNpbmNsdWRlICZsdDtzdGRpby5oJmd0Ow0KDQoJaW50IG1haW4gKGludCBhcmdjLCBjaGFyKiogYXJndikgew0KCSAgcHJpbnRmKCJIZWxsbywgV29ybGQhIik7DQoJICByZXR1cm4gMDsNCgl9");'/>
<img class="run-this-spinner" src="spinner.gif"/>
</div>
<div class="run-this-details"></div>
</body>
</html>
but i get the error: XMLHttpRequest cannot load http://run-this.appspot.com/runthis. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Edit2:
Now it runs :) i just had to move the folder to a server and it works.

You might try something like this -
Have a python or any other way to run shell commands on your server
When the user want to run his page simply save it and run a shell command to the c compiler you have while having the output saved into another file
Read the output file and show it online.
This can be done, though i mind you that there are MANY MANY security holes that you must check before letting any code run on your server! Many people can use it to hack your server or even make it a part of a botnet.

Related

Broken iron-flex-layout dependency

I have a simplistic page:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="bower_components/iron-flex-layout/classes/iron-flex-layout.html">
</head>
<body class="fullbleed vertical layout" unresolved>
<div>Alpha</div>
<div class="flex">Beta (flex)</div>
<div>Gamma</div>
</body>
</html>
It is very near from there given samples for iron-flex-layout.
But it renders an empty page.
If I add another import, like iron-image, the page is displayed correctly.
It is served by polyserve, and everything is correctly installed otherwise.
Thanks for your help / explanation.
My bad here.
At this point unresolved body attribute is not defined.
Removing it makes it work as expected.
No clue where this attribute is defined, though (but importing an element such as iron-element, as mentioned above, and its dependencies makes it defined)

sample Apache Cordova on visual studio doesn't work

I followed the instruction on msdn to build the sample Apache Cordova, but when it is running, I am not getting and response from the output. The output is similar to the following image:
but there is no way to add / remove entry to the list.
I checked and found that index.html has the following lines:
<button class="templateLeft templateToggle" ng-class="{'checked': toDoItem.done, 'unchecked': !toDoItem.done}" ng-mousedown="toggleToDoDone(toDoItem)"></button>
<button class="templateLeft templateRemove" ng-click="removeToDo(toDoItem)"></button>
but there is no way to add new items to list?
What is wrong with this sample code that makes the UI doesn't work properly?
The sample uses angular.js
Edit 1:
To find why the sample doesn't work and why I am not getting the correct result, I tried to debug the javascrip code. Based on my understanding, when the page which the code for it is as follow :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="cordova.js"></script>
<script src="scripts/platformOverrides.js"></script>
<script src="scripts/frameworks/angular.min.js"></script>
<script src="scripts/frameworks/angular-resource.min.js"></script>
<title>AngularJSToDo</title>
<!-- AngularJSToDo references -->
<link href="css/index.css" rel="stylesheet" />
</head>
<body ng-app="xPlat">
<section id="todoapp" ng-controller="ToDoCtrl">
<header id="header">
<div id="headerBand"></div>
<input id="new-todo" placeholder="What needs to be done?" ng-text-change="addToDo()" ng-model="newToDoText" autofocus>
</header>
<section id="main">
<div id="todo-list">
<div class="templateWrapper" ng-repeat="toDoItem in todos">
<div class="templateContainer">
<input class="templateTitle" ng-class="{crossedOut: toDoItem.done}" type="text" ng-text-change="changeToDoText(toDoItem)" ng-model="toDoItem.text" />
<h3 class="templateAddress">{{toDoItem.address}}</h3>
<button class="templateLeft templateToggle" ng-class="{'checked': toDoItem.done, 'unchecked': !toDoItem.done}" ng-mousedown="toggleToDoDone(toDoItem)"></button>
<button class="templateLeft templateRemove" ng-click="removeToDo(toDoItem)"></button>
</div>
<div class="templateBorder"></div>
</div>
</div>
</section>
</section>
<script src="scripts/index.js"></script>
</body>
</html>
The function in index.js is called:
The source for index.js is as follow:
(function() {
'use strict';
angular.module('xPlat', ['xPlat.services', 'xPlat.controllers', 'xPlat.directives']);
angular.module('xPlat.directives', []);
angular.module('xPlat.controllers', []);
angular.module('xPlat.services', ['ngResource']);
})();
I put a breakpoints on this line:
angular.module('xPlat', ['xPlat.services', 'xPlat.controllers', 'xPlat.directives']);
and run the application, but the application did not stop on the line (apparently, the index.js is not loaded and if loaded, it is not run)
To see if the file exist in the correct place, I run the application and after it is loaded in ripple emulator, I change the url of the web browser to this:
http://localhost:4400/scripts/index.js
and I can see the index.js text on screen.
why this function is not run when I load the page?
Edit 2
After making some try and error, I found that I am getting these errors on JS console:
Failed to load resource: the server responded with a status of 404 (Not Found)
ripple.js (50,28958)
Error: [ng:areq] http://errors.angularjs.org/1.3.16/ng/areq?p0=ToDoCtrl&p1=not%20a%20function%2C%20got%20undefined
at Error (native)
at http://localhost:4400/scripts/frameworks/angular.min.js:6:417
at Sb (http://localhost:4400/scripts/frameworks/angular.min.js:19:510)
at La (http://localhost:4400/scripts/frameworks/angular.min.js:20:78)
at http://localhost:4400/scripts/frameworks/angular.min.js:75:465
at http://localhost:4400/scripts/frameworks/angular.min.js:57:178
at q (http://localhost:4400/scripts/frameworks/angular.min.js:7:428)
at M (http://localhost:4400/scripts/frameworks/angular.min.js:57:45)
at g (http://localhost:4400/scripts/frameworks/angular.min.js:51:409)
at g (http://localhost:4400/scripts/frameworks/angular.min.js:51:426)
angular.min.js (102,443)
It is appear from the first error that somefile is missing, but how can I find which file is missing?
I believe you haven't gone through all parts in that guidance.
Please keep following and you will find the functions you need in services.js mentioned in section "add the data model". The data model and related functions are defined there.
To add entries to the TODO list just click on “What needs to be done?”, start typing and press enter when done. To remove an entry just click on the entry and you will get the delete button on the left, click it and the item is gone and to mark an item as “Done” just click on the check box to the left.
I just ran the sample using Android Ripple Nexus (Galaxy) and it worked fine. The fact that you got to the initial page of the sample you attached tells me you are good to go. I also get the 404 on ripple but that doesn’t stop the sample to run (I have to investigate why of that error)
Finally if adding an entry doesn’t work for you, on Solution Explorer double click toDoCtrl.js file at www/scripts/controllers and set a breakpoint inside the ToDoCtrl.prototype.addToDo function, press F5 and try to add an entry, you should hit the breakpoint as soon as you enter a text and press enter.

Writing html code dynamically to an aspx file

I have HTML stored in a Microsoft SQL Server column, and I also have an blank .aspx file called myreport.aspx. My problem now is, when I retrieve the contents of the column from the database, I want to be able to write it to the empty myreport.aspx file and use Response.Redirect() to call the myreport.aspx and display it.
The contents of the column looks like this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<h1>Welcome Aboard!</h1>
</body>
</html>
And also replace the contents with a new one whenever the page is being called.
I need help, thank you in advance, seniors!

Nancy - Super Simple View Engine: How do I override a MasterPage's title in the view?

I would like to set the title of each rendered page from the corresponding view. I would also like a default title to be set in my Master page. Here is the super-simple set up I am using.
Master Page
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>NancyFX is Splendid</title>
</head>
<body>
#Section['Content']
</body>
</html>
View
#Master['_Master']
#Section['Content']
<h1>Home</h1>
<p>Hello #Model.UserName</p>
#EndSection
I have tried a few of the more obvious guesses but no joy so far. Can you help?
On a more general note - is there any definitive help for Nancy's SSVE? I have read all the docs available on the site and GitHub but they are sparse. Just a list of all SSVE '#[]' keywords, would save me a lot of time.
Thanks
You can just render it from the model, same as anything else:
<!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">
<head>
<title>Hello #Model.Name!</title>
</head>
<body>
<h1>Super Simple View Engine</h1>
<p>This text is in the master page, it has access to the model:</p>
<p>Hello #Model.Name!<p>
#Section['Content']
</body>
</html>
As for documentation, most of the tags are documented here: https://github.com/grumpydev/SuperSimpleViewEngine although it's slightly out of date now. It was initially designed purely for internal use, but obviously you are welcome to use it if you want to. The best place to look if you get stuck is the tests, there's samples for all the tags in there.

VML v:shape , V:roundrect elements ain`t displayed correctly in IE6, IE7 in strict mode

Does anybody can provide an answer to such issue? I`m trying to put some vector graphics into HTML. Actually it is not necessary in mine case, so I probably would resort to simple image for now, but I as encountered a problem, I couldn't resolve, it's became very interesting and relevant to the future to define what is going wrong. VML is absolutely new to me, by the way.
I tried to insert several vml-elements into a page, and some of them worked perfectly (in IE6, IE7) namely "oval", "rect". But when I've attempted to insert a shape or roundrect everything went wrong.
Actual question is: is there satisfactory VML support in IE6, IE7 or what I'm doing wrong? But as far as I'd examined my code everything is right in it. Below I'll put a sample, so everyone could test this in IE-browser:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>sample</title>
<style>
v\:* { behavior: url(#default#VML); display:inline-block}
#div1 {
width:400px;
height:400px;
background-color:#e4fe56;
}
</style>
</head>
<body>
<div id="div1">
<v:shape style='width:100px;height:100px' fillcolor="red" path="m 0,0 l 30,0,30,30 xe" />
<v:rect style='width:100pt;height:75pt' fillcolor="blue" strokecolor="red" strokeweight="3.5pt"/>
<v:roundrect style='width:100pt;height:75pt" arcsize="0.3" fillcolor="yellow" strokecolor="red" strokeweight="2pt"/>
</div>
</body>
</html>
Additionally I found that it happens only in strict mode. When DOCTYPE removed or with other conditions when IE works in quirks mode everything works well.
You have mismatched quotes on your style attribute
<v:roundrect style='width:100pt;height:75pt"
You have whitespace in your doctype:
/xhtml1 /

Resources