Somebody know how use OpenX (php app) with Django? I need to use OpenX or a similar software for displaying ads.
As Tomsky answered you don't need any special software just to display ads - you can just use javascript.
However, if you want to access the server and manipulate the OpenX objects such as campaigns, banners, advertisers, etc, you will need some kind of remote API. For that OpenX Source provides a XML-RPC API but I also developed a REST API:
http://www.openxrest.com
You can implement Openx using javascript, so as long as you run Openx on a php server, that should be easy.
Header, something like this:
<script type='text/javascript' src='http://something.here/delivery/spcjs.php?id=1&block=1'></script>
And then, something like this where you want to put you ad.
<script type='text/javascript'>
OA_show(1);
</script>
<noscript>
<a target='_blank' href='http://something.here/delivery/ck.php?n=112bda3'>
<img border='0' alt='' src='http://something.here/delivery/avw.php?zoneid=1&n=112bda3' /></a>
</noscript>
OpenX generates all this code for you.
Here's a project that gives you API integration. If you only want to serve ads, you don't need it though, you just have to paste the javascript provided by OpenX.
Related
The dart-polymer transformer assumes that your html are static assets. But I want my html to be dynamically generated server-side. The reason for this is that I want to build a multi-page web-app (or perhaps I should call it a multi-app web-site), and use server-side templating to keep the page structure between pages.
Is there a way to use dart-polymer without using the "compiled" html produced by the polymer transformer? Ideally I want to serve a page like this from the server:
<!DOCTYPE html>
<html>
<head>
<script src="packages/browser/dart.js"></script>
<script type="application/dart"
src="packages/web_components/webcomponents.dart"></script>
<title>Films</title>
<link rel="stylesheet" href="style.css"/>
<link rel="import" href="player/film_player.html"/>
<link rel="import" href="filmlist/film_list.html"/>
</head>
<body>
<film-player id="player"></film-player>
<film-list href="/api/movies"></film-list>
<script type="application/dart" src="main.dart"></script>
</body>
</html>
I know it is not supported having dart.js at the top, but it would be nice if dart.js did as webcompontents.dart.js need to run before the html import tags. At least I guess it does.
I really would like to avoid all the javascript and css inlining done by polymer transformer.
Polymer.dart doesn't support that scenario.
I'm not sure I understand your multi-page attempt. Dart is much better used for single-page application where you dynamically change what is shown at the current page. If you navigate to other pages a whole new Dart application is loaded and you don't have access to variables of the previous page and it is slow because Dart has some overhead and that only pays off if you stick to the one page.
A typical Dart application is built so that the client is basically an entire application that communicates with one or more servers but only sends and receives data but not application logic or views (except for very specific use cases).
Dart supports lazy loading to not load the entire application at once but not yet for Polymer.
Currently using RiotJS and Mocha for unit testing. Was wanting to know if I can use a headless browser webkit like PhantomJS & CasperJS to do additional tests on my RiotJS tags/pages. Up to now all my attempts to load the tags/pages and perform queries on the document have failed. Would appreciate any samples/links.
Thanks
Updated:
querySelector fails for '#testId', but succeeds for 'testId2'.
Extract from my unit test:
page.open('http://localhost/src/default.html', function (status) {
var test = document.querySelector("#testId"); // returns undefined
}
<!-- html page -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Riot.js Example</title>
</head>
<body>
<!-- mount points -->
<spinner data-url="./data.json" data-sourceId="instance1" data-model="myModel" id="testId"></spinner>
<imageoutput data-sourceId="instance1" data-model="myModel"></imageoutput>
<div id="testId2">this content</div>
<!-- mount the same way -->
<!--[if lt IE 9]>
<script src="../dist/scripts/es5-shim.js"></script>
<script src="ie-stuff.js"></script>
<![endif]-->
<script src="../dist/scripts/require.js" data-main="./main"></script>
</body>
</html>
Patrick,
It would be nice you better specify which test objectives you want to do, what to do on each page to see if the CasperJS / PhantomJS realize do it!
The CasperJS, working with the PhantomJS can work independently and I confess that today, any automation project pages or testing, I use them only and give the trick!
For a layout test (images, fonts, CSS), you can study the PhantomCSS, but if your goal is to navigate, click, test elements and even download archive (assuming avoid URLs with Silverlight, Java ... the CasperJS will give account to do anything you want ... and the returns you can get at log.xml to treat it in any other tool or system.
I'm finishing my new site and it, post several tutorials and tips regarding the CasperJS and PhantomJS ... and in the future, perhaps a course ...
If you want you can find me on facebook, twitter, github ... post there when everything is online.
I have had some success with using Protractor and Karma with riotjs. Granted we used RiotTS for the project, but the principles remain the same.
Although Karma and Protractor are typically used for commonly used testing angular applications they are agnostic.
There is tons of information out there, and is widely supported.
From the source I can see you are probably doing something asynchronous, (data-url="./data.json") which will mean you need to raise a flag in your app that the data is loaded or page is ready.
You can always introspect riot by doing document.querySelector('imageoutput')._tag to the investigate the state of your riot tags.
I want to create a Web Widget. It must access remote clojure data structure and display elements of it requested by a widget parameter. The visual style would also be dictated remotely.
EDIT:
Youtube has this:
<iframe width="560" height="315" src="//www.youtube.com/embed/Z6bFyVGvg28" frameborder="0" allowfullscreen></iframe>
Google Maps has this:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.ca/maps?q=yahoo+corp&ie=UTF8&hq=&hnear=&ll=37.417223,-122.025112&spn=0.006295,0.006295&t=h&iwloc=A&output=embed"></iframe><br /><small>Agrandir le plan</small>
So I suspect an iframe that targets a specific URL handle by the remote server could do the job.
There are indeed tradeoffs between writing your widget inside an iframe or simply inline the page and make it part of the dom of the hosting page.
http://prettyprint.me/prettyprint.me/2009/05/30/widgets-iframe-vs-inline/
This is a very similar request which it's achieved in this David Nolen demostration project:
https://github.com/swannodette/om-sync
based on his clojurescript react.js thin layer called"om":
https://github.com/swannodette/om
I got a job on a freelance site to make a calculator where the user enters values into text fields. The problem is all they told me is they need to be able to publish it in html. I'm used to using asp.net and c#. I've never used javascript but it seems like that maybe what I need to use. is there any way I could make an app with java or c# and be able to add it to html?
I would use HTML and javascript, all you need to do is type <script> *javascript Here* </script>. I currently have a web app that calculates how much insulin a diabetic will need. Post a comment and ill send you a link to it for reference. It's as simple as
<script>
var x = document.getElementById('textX').value;
var y = document.getElementById('textY').value;
var z = x + y
document.getElementById('labelA').innerHTML = z;
</script>
<body>
<input type="text" ID="textX" onchange="valuechanged();" /> +
<input type="text" ID="textY" onchange="valuechanged();" /> = <br>
<label ID="labelA"></label>
That will make a value + value calculator. You can develop this code to be as complex as you want. Also remember to add the header tags ect.
Java / C# are SERVER technologies, HTML / JavaScript are CLIENT technologies. If the requirement is that the page be only a basic html publish (no server technology present) then JavaScript is your only choice. ASP.net or Java are basically programs on the server which decide what HTML to render dynamically, instead of an .html page which is static content.
Once the HTML is downloaded, then JavaScript can be used to manipulate the Document Object Model (DOM) to change the HTML that is rendered from memory. To do calculations in an HTML/JavaScript application, the browser is doing the computation and replacing the information without ever communicating with a server, asking for a new page or for more information, etc. In contrast, a C# application would be running on the server, waiting for the browser to send something to calculate, then the server would do the calculations and send back a new page with the result.
There are hybrid options as well, so it's definitely not wasted effort to learn JavaScript.
I wanted to add a +1 button on every post in my website. How do I do that? Any resources? I am also looking for Twitter's Tweet and Facebook's Like. Or Django does not handle that?
Check out the documents for Google Plus, it looks pretty straight forward:
The simplest way to include a +1 button on your page is by just
including the necessary JavaScript and adding a +1 button tag:
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<g:plusone></g:plusone>