One problem I've been toying with off and on is a service that requires my server to produce a screenshot of a webpage at a given url. The problem is that I don't have any idea how I would accomplish this. I mostly use a LAMP software stack, so answers that were given with that in mind would be the most helpful. Again the basic requirements are: Given a url, the server needs to produce an image file of the rendered web page at that url. Thanks in advance!
You might also want to take a look at webkit, it's known for being easier to embed (used by Adobe for AIR, by Google for Chrome, by Apple for the iPhone...) then other rendering engines. This might take a little more work to setup, but it would be a lot more stable than some hack that launched a webbrowser and took a screenshot.
IF your server is a Mac, then I recommend webkit2png, which is a short python program that leverages WebKit's Objective-C API to render an URL. Personally, I use it in combination with WWW::Mechanize to walk my development site and make screenshots of every page -- useful for testing functionality, showing clients and keeping screenshots up-to-date. The resulting screenshot is perfect, but sometimes very tall for long, scrolling pages.
IF your server has a non-bare-bones Linux distro with KDE installed, then you might try khtml2png. I have not tried that myself, but saw it mentioned on the webkit2png page.
PhantomJS is a headless (commandline) WebKit-based browser which can be easily scripted to save a screenshot of webpage.
You actually need to have the server launch the web browser in question and take a screenshot of the application with the appropriate libraries. Apache will not render the page for you so you have to have software that will.
Yes, that is what is needed. I do this in asp.net, and I actually create a WebBrowser object that is avaialable in the .Net framework class libraries to generate the screenshot.
I use the http://webthumb.bluga.net service for thumbnail generation. Robust, powerful, easy to use, and very reasonable rates. I have a high traffic production website using this service and it works very well. Given the difficulty of creating a robust web screenshot service, it's nice to have someone else do the hard work.
A non-free solution for Java is WebRenderer. Interesting feature: it can emulate Safari, IE or Firefox browsers when rendering. They have a desktop version and a headless server version. Also they have example code showing how to render a screenshot image of a webpage.
virtual framebuffer X server
I would rather recommend XVFB (virtual framebuffer X server) is the best solution for taking screenshots of a headless server. Virtual framebuffer X server xvfb provides an X server that can run on machines with no display hardware and no physical input devices.
I am using that on my server for testing URLs and taking its screenshot. We are using Ubuntu & XVFB + FIREFOX. It is working fine. Modify according to your needs.Take a look on these articles. It might be use full for you.
http://www.semicomplete.com/blog/geekery/xvfb-firefox.html
http://linux.about.com/cs/linux101/g/xvfb.htm
http://www.xfree86.org/4.0.1/Xvfb.1.html
Related
I want to deploy my Unity3D game on Facebook as canvas App. There are two platforms in unity version 5:
WebPlayer
WebGL (Preview)
I have no idea about both of these builds. I am using Parse to store my user data. And Facebook Unity SDK for social gaming. I have built for IOS platform and now for Canvas App deployment I want to know:
which one of these would be best for Canvas App?
I want to know if there are any issues regarding Parse API or Facebook Unity SDK for
WebPlayer/WebGL build?
EDIT:
I have built for WebPlayer and i can not run it on Google Chrome.
does it have to do anything with Canvas App too?
I have built for WebGL and tried to run it on Google Chrome and got this alert:
( I am using Google Chrome Version 44.0.2403.107 (64-bit) )
Any suggestion/help is highly appreciated.
I will suggest you to not build your game in webplayer, because chrome is dropping support for unity webplayer(Google Chrome version 42 and later has disabled all NPAPI plugins), and other browser will also drop the support sooner or later. The best way forward is to use webGL. WebGL in unity is still getting evolved, but this is the future. I also have developed game for webGL, I didn't face much problems except data storage. Parse does not support webgl yet, you have to look for other services. In my case I have build my own php server and it is working fine. Anyways you have to choose what is best in your case. You should use webGL , but thats my opinion.
The error message is more or less self-explanatory: Chrome doesn't support running Unity WebGL when it is run from a local file on disk, because of Chrome security. This is not a real problem, as in production it will always be run from a webserver (http://).
During development, your options are:
Start chrome with access to local files: chrome.exe --allow-file-access-from-files
Host a local webserver (Apacha/WAMP, IIS, etc)
Use firefox
You are correct. Building the unity for the web is the way to go. You select web from the build settings and you can upload it to the facebook canvas. The thing with chrome is that it no longer supports NPAPI and that is what the Unity web players uses. You can manually enable it and try out your game in chrome. But for the majority of chrome users unity web player no longer works.
I've designed a desktop app using PyQt GUI toolkit and now I need to embed this app on my Django website. Do I need to clone it using django's own logic or is there a way to get it up on website using some interface. Coz I need this to work on my website same way it works as desktop. Do I need to find out packages in django to remake it over the web or is there way to simplify the task?
Please help.
I'm not aware of any libraries to port a PyQT desktop app to a django webapp. Django certainly does nothing to enable this one way or another. I think, you'll find that you have to rewrite it for the web. Django is a great framework and depending on the complexity of your app, it might not be too difficult. If you haven't done much with web development, there is a lot to learn!
If it seemed like common sense to you that you should be able to run a desktop app as a webapp, consider this:
Almost all web communication that you likely encounter is done via HTTP. HTTP is a protocol for passing data between servers and clients (often, browsers). What this means is that any communication that takes place must be resolved into discrete chunks. Consider an example flow:
You go to google in your browser.
Your browser then hits a DNS server (or cache) that resolves the name google.com to some IP address.
Cool, now your browser makes a request to that IP address and says "get me some stuff".
Google decides to send you back a minimal amount of HTML and lots of minified JavaScript in the page.
Your browser realizes that there are some image links in the HTML and so it makes additional requests to google to get each of the images so that it can display them.
Now all the content is loaded on your browser so it starts to execute the JavaScript code, and that code needs some more data from google so it starts sending requests to google too.
This is just a small example of how fundamentally different a web application operates than how a desktop application does. On a desktop app you have the added convenience that any operation doesn't need to be "packaged up" and sent, then have an action taken, etc (unless you're using a messaging architecture, but that's relatively uncommon outside of enterprise apps).
I have a Windows Embedded Compact 7.0 based development board which has a HTTPD webserver and SQL Compact DB,
Objective: My task is to deploy few HTML5 pages and create C++ component for DB access.
Current solution : Currently we are thinking of CGI interface between HTML5 and C++
component, not sure if this is possible , but our vendor (where this board bought from) confirmed that WinCE can support ISAPI (much faster CGI).
I would like to know if we are in a right direction? or Is there a alternate solution to this?
Asking this question because I came across this article in Code project about http://www.codeproject.com/Articles/336018/Building-C-Applications-with-HTML[Building C++ Application with HTML5] which talks about usage of Webkit and Qt.
Please let me know if I can explore as per this article. Can this work under Embedded-based environment.
Thanks in advance for your replies.
It's one path. This article uses QT to intercept requests, so you are basically implementing your own web server
I don't know about your requirements but you may have quite some work if you wanna do it by yourself (implementing Sessions, Authentication, Http methods, SSL, etc).
In my case, I deactivated the standard HTTPD server and used Padarn for a C# backend and I found it to be ok, but it's not free.
I didn't spend much time looking for C/C++ servers but I believe setting up a pre-made web-server is a good path path unless that article meets your requirements.
While developing a REST service I want to be able to manually submit some data (e.g. by PUT or POST method) to a specific URL and see the response. The only tool I know is SoapUI, which is not only a commercial product, but a bit overcomplicated while my task is so simple. There is a question about SoapUI alternatives, but all the discussion there is about SOAP services, while what I need is just some REST :-) Any ideas? I know I can write such a tool myself pretty easily, but I'd prefer not to reinvent a bicycle if there is one.
UPDATE: Mark Cidade's answer is ok, but I'd wish the tool could run on Linux too...
UPDATE 2: The solution of my choice came to be HttpRequester Firefox extension.
I have just discovered and installed RESTClient, which is a Firefox add-on (it's ideal for me as I do most development on FF, both on Windows and Linux). No idea if it's any good yet. :)
EDIT: I've started it using extensively since, and it's very good, it really gives back a lot of data about the response and the request.
My favorite is WizTools RESTClient which is written in Java. A nice feature is that it lets you save requests and responses to file if you want to reload them later. It's also cross-platform thanks to Java.
There is yet another free handy application called Postman which will let you do this. It was initially launched as a Chrome plugin and since then is available on the Mac.
I use the Chrome plugin extensively on Windows, Linux and Mac. What I find most useful is the fact that, when signed in, all your requests can be synced across all machines. I use the Mac at the office and when I get home, I pick up where I left of on a Windows machine.
Cross platform insomnia you must test it.
If you use mac then paw another option
Any HTTP request tester will do. Fiddler is a good one.
You can try this online testing tool https://reqbin.com/
For Mac and Linux there is Charles http://www.charlesproxy.com/ but it is not free.
If you need tool, which you can run on Linux, try WebScarab, it is written on Java.
https://restclientgui.codeplex.com
Download it from the downloads section
I'm Only Resting works for me.
I'm quite fond of either Fiddler (if you need to dig into things deeper) or Insomnia (if you're trying to get to grips with a particular REST API).
Fiddler runs on Linux using the Mono runtime. Insomnia provides Linux packages. I like that Insomnia has a scaffolding generator for the most popular languages, so when you made a particular REST API call work in Insomnia, you can generate code for many languages from that. Neat!
Telerik now has a new standalone software to test API's: Telerik Test Studio for APIs
http://www.telerik.com/download/teststudio-apis
If you are just looking for a lite rest client and have tried all the others here and did not like them!
I finally rested on Restlet a Chrome plugin.
It is commercial software, but "appears" to be free to use if you are only making requests, which is all I need now.
I may try the trial in the future.
cURL is free and runs on almost everything.
Our company has a set of 3d modeling softwares written in c++ with qt based gui. We are planning to offer these applications to customers to try them from a web browser. I mean to say, we need to create web interfaces for native c++ codes. Please suggest me which technology, languages should be used. If possible please give some links to some white papers or case studies for this kind of projects. I am totally clue less :)
Ideally you would keep your c++ code on the server and use a mixture of HTML and Javascript on the browser. However since 3d modeling is so client centric you may have to run some c++ code directly in the browser.
There are a few options to look at:
Emscripten
Adobe Alchemy
Google Native Client
A Java Applet using NestedVM
Netscape plugin API
ActiveX
You could also run a few instances of your application on your server inside an XVnc session and let people use it through a VNC viewer applet. The simplest solution however is still to offer a downloadable demo of your application.
Have a look at Wt
Take a look at Native Client.
Soon you might be use WebGL to do 3D in the browser. But how long it will take for browsers to include it I do not know. But it might be good to look at it to not rule out using it in the future.
If creating everything again is too expensive, always you can create a distributed application:
One program running the main application in C++ and generating (for example) XML files.
A web application reading the XML files generated by the C++ application and translating them into the web application language (for example Adobe Flex).
Good luck!