Getting images from qlmanage - quicklook

qlmanage can produce PNG's. Like this https://superuser.com/a/162221
But using the standard command I only get page 1.
Is it possible to get page 2? I was wondering if I could mimic the quicklook function in Apple Wiki.

qlmanage is really not meant as a tool for any production project. It's a debugging tool. It runs with different privileges as the normal quicklook, does not provide the same level of security. And moreover it's REALLY not meant to be used server side.
That said, to answer your question: no, when qlmanage produces PNGs, it's invoking generators' thumbnailing code which is not meant to page through the document.
The Quick Look function in Apple Wiki is using a specific client that is able to:
request the preview (and not thumbnails) from a limited set of generators
interpret the preview
produces images for each page of the preview when it makes sense
There is no public API to do that yourself, alas.

Related

Can FullCalendar be printed to PDF?

I have tried printing FullCalendar.js rendered calendars to PDF, however none of the generators available seem to work:
Aspose PDF does not allow JavaScript, and straight up just doesn't support absolutely positioned elements
PrinceXML has known issues where it throws TypeError exceptions when processing JavaScript that are not reproducible in IE, Chrome or Firefox.
My minimal repro example for PrinceXML failure is the examples on Adam Shaw's FullCalendar site. Even when I save the generated HTML (via $("body").html()) and pass the generated HTML to PrinceXML, thus bypassing PrinceXML's incorrect JavaScript handling, PrinceXML doesn't lay out the absolutely positioned events correctly.
What are my options?
Your best bet is probably wkhtmltopdf, which uses the WebKit as the rendering engine. This means you can freely use CSS/Javascript. You might need to look into the javascript-delay option.
I have used wkhtmltopdf successfully in Ruby on Rails, but it appears you are using .NET. A quick search reveals some possible wkhtmltopdf wrapper libraries for .NET:
gmanny/Pechkin
codaxy/wkhtmltopdf
You may want to take a look at this answer for some alternative solutions.
My coworker found a simpler solution.
As it turns out, we ran into issues using Pechkin and wkhtmltopdf in test environments. Plus, it required us to set up an additional App Pool just to handle printing to PDF.
Use html2canvas.js library
Convert the canvas to base64. I recommend Fred Palmer's base64.js
Send base64 encoded value to server
Create web service that calls your PDF converter library. We use Aspose, and so all we do is add the image to an Aspose PDF object.
PROFIT!
This solution is incredibly slick, since it uses the user's own rendering engine to generate the PDF. This means WYSIWYG (What You See Is What You Get), so if the calendar looks good when the user uses it, it should print the same exact way! MONEY.

A good way to build javascript profiler for Mozilla Firefox

I'm working on a javascript profiler for Mozilla Firefox, that would let me obtain all available information about the execution of the script on the page (DOM object calls, events, calls to functions like Math.random(), document and navigator object calls, as well as code's own execution tree with arguments etc etc).
Currently, I think that the best way to implement this sort of profiler is by modifying Firefoxe's own source code.
One way to go about it is to find all implementations for corresponding method calls and add profiler log calls there. But there are 2 problems with this approach:
The methods and objects are widely scattered, and I'm not really familiar with the source code at this moment. Tracking down all the functions and making sure that the profiler works as intended will take A LOT of time
When created in this way, the profiler is going to be difficult to maintain when Firefox source code evolves with time.
So I was wondering, if there is a single class/a small group of key classes in firefox source, that could be modified to allow me to collect the information I want? Or is there a better way of doing what I need to do?
The latest Aurora release of Firefox has a basic profiler built into its developer tools, or you can download a more advanced interface from the Mozilla Add-ons site which works with Firefox 16 or later.

Automatically filling in web query forms and returning data (for a newbie)

I am whatever comes before 'novice' in programming. I have written macros in VBA for Excel, and used Visual Studio a bit when I was younger, but that's about it.
My problem: To produce the reports I need at work, I have to extract data that is stored behind user-friendly query forms on my company's intranet. I have automated every other part of the report except this. I would like to write a program to access this webpage and fill in query forms for me with preset values, and then return the data that is output. I had a discussion with a computer scientist friend of mine who said this was easy to do with Haskell (his language of choice). However I'm no veteran so I'd like to learn a language a bit nearer to my level... Python seems a good bet.
My question: is it possible to do this type of data extraction with Python? How difficult would it be, and what is a good resource to teach myself about it?
I've done some research and come up with Scrapy, but I can't tell whether it fills in forms. Also, if there are other languages more suited to this, I'd be glad to hear it.
The easiest way is just to use urllib2. Usually, arguments to your forms are transferred to the servers so that you can see them in the URL as ?foo=bar&bla=blah. You can generate arguments to your forms with urllib2.urlencode:
Python and urllib2: how to make a GET request with parameters.
For a newbie, you formulate your thoughts very clear, congrats.
I would start by reading some basic tutorials on HTTP. A form is basically just a visual way to collect data. The meat of the form is the request your browser makes with that form data.
So "filling in forms" is really not necessary (it may be though, hopefully its not because it CAN get complicated). What is necessary is learning what request that form actually makes to the browser and emulating it. A super easy way to do this is with chrome developer tools or a firefox extensions called firebug. Each of these provide you with a way to see all network traffic, including forms.
for example if you have a form where you have to submit a data and a report type the actual web request may look like
?date=2012-09-12&type=overview
so basically you would just have to find a way to make a http request to the url with that data. This is a trivial task and pretty much all languages have a way to do this.
It is very possible to do this with python. There is an abundance of tutorials out there. Python has url libraries built into the standard library that can help
http://docs.python.org/library/urllib.html
Everytime I use urllib2 I usually end up at http://www.voidspace.org.uk/python/articles/urllib2.shtml
Combining loginform and scrapy, you can automate filling forms and crawling web pages.
Here's a tutorial on it. http://blog.scrapinghub.com/2012/10/26/filling-login-forms-automatically/

Visual VoiceXML/VXML development tool?

Does anyone know of any tools out there that will let me run and debug a VXML application visually? There are a ton of VXML development tools, but they all require you to build your application within them.
I have an existing application that uses JSPs to generate VXML, and I'm looking for a way to navigate through and debug the rendered VXML in much the same way that Firebug allows one to do this with HTML. I have some proxy-like tools that let me inspect the rendered code as it is sent to the VXML browser, but there's a ton of JS, which makes traversing the code by hand rather difficult.
Has anyone worked with a product that allows for this?
Thanks!
IVR Avenger
There is JigSaw Test suite - has free trial license and reasonably priced.
There is IBM's debugger - part of WebSphere Voice Toolkit.
Many other products have debuggers - a very good summary is here
Disclaimer: I am the development manager for Voiyager (www.voiyager.com), a VoiceXML testing tool. It doesn't meet your criteria nor do I believe it is the type of tool you want, but I thought it was worth mentioning it.
As far as I know, there isn't such a test tool for VoiceXML. In fact there are very few VoiceXML tools on the market and hardly any of them test or analysis. The vendors that created development tools, have all been acquired by other companies. Some of them offered did offer various forms of debugging that were specific to their tool set or stayed at the Dialog (caller input) level. From your question, I'm assuming you need much lower level debugging capabilities.
I think the alternative paths are minimal and somewhat difficult. I believe your primary goal is to debug or rewrite an existing application, but you haven't provided any specific challenges beyond the JavaScript. Some thoughts or approaches that may help:
Isolate the JavaScript and place the code into a unit test harness. That will go a long way to understanding the logic of the application. Any encapsulation of the JavaScript you perform will probably go a long way towards better code maintainability.
Attempt to run the VoiceXML through a translation layer to HTML so you could use FireBug. The largest challenge would involve caller input (ie processing the SRGS grammars). You could probably cheat this by just having the form accept a JSON string the populates the field values. There are tools on the market to test grammars. Depending on the nature of your problems, you could take a simple and light approach and attempt this over just the trouble areas.
Plumb the application with a lot of logging. This can be done through the VoiceXML LOG element, or push the variable space back to the server. By adding intermediate forms, you may be able to provide a dump from each via the VoiceXML Data element.
See if your application will run in one of the open source VoiceXML browsers (not sure of the state of the open source browsers as we've built and bought for our various product lines). If you can get it mostly working, you can use the development debugger to provide some ability to step through the logic. However, it is probably one of the more difficult paths as you'll really need to understand the browser to know when and where to stick your breakpoints and to figure out how to expose the data you want.
Good luck on the challenge. If you find another approach, I would be interested in seeing it posted.
An alternative debug env is to use something like Asterisk with a voicexml browser plugin like the one from http://www.voiceglue.org/ or for a limited licence, i6net.
You can keep all the pieces separate(dynamic html and vxml application in php/jsp/j2ee/, tts processing, and optional asr processing as separate virtual machines with something like virtualbox. If the logic can be kept the same, then it is just a matter of changing the UI based on the channel.
A softphone is all you need to call a minimal asterisk machine, which has the voicexml browser with the url of the vxml in the call plan.
I just used Zend Framework as php is used in this environment, and changed view suffixes(phtml vs vxml) based on the user-agent string.
Flite for tts is fine for debugging, and when your app is ready you can either record phrases, and there was a page on the ubuntu forums with directions for how to increase flite quality with some additional sound files.
Do you have tried Eclipse VTP or InVision Studio?
Eclipse VTP
This is Eclipse plugin. But I feel that it is user-unfriendly a little (of Japanese viewpoint).
InVision Studio *Required create user account*
This is Convergys's IVR tool. It has to edit standard VXML mode. (Unfortunately, It's not exact matching.)
For just debugging vxml, I use Nuance Cafe's VoiceXML checker. It doesn't give you a visual tree or anything, but it's pretty good at spotting syntax errors and is free. I think they might also have more advanced debugging tools if you look into it, but I haven't had the need. (Note: I have no association with them)
http://cafe.bevocal.com/tools/vxmlchecker/vxmlchecker.jsp
I'm looking for the same problem that most of the links are down. I found a document where they propose an open source solution, which works as a plugin for Asterisk (https://www.researchgate.net/publication/228873959_Open_Source_VoiceXML_Interpreter_over_Asterisk_for_Use_in_IVR_Applications) and is available at https://sourceforge.net/projects/voxy/
I would like to know if there are current options to create a VXML structure graphically, like the next image.

How do I develop an addon for Safari?

I want some personally developed JavaScript code to execute whenever I load a page in Safari. Seems like addblock for Safari does this. Anyone know how to do this?
Safari is not extensible. There's no addon framework for it. But yet there's adblock and verious other addons available for it, although Apple's Webkit and Safari developers discourage users from using them, calling them 'binary hacks'. Seems though some of these addons use InputManager, which isn't documented at all anywhere, at least for not for how people are using it to load scripts in Safari. I guess I'm going to have to backwards engineer to see how addblock does it, but before I do, I thought I'd ask around here. Anyone know?
Input managers are a commonly (ab)used way of injecting arbitrary code into another application's runtime. Once you are there, you have to reverse-engineer enough of the application itself to figure out how to get the behavior you want; usually that involves method swizzling to replace parts of the application you are hacking. It's not documented because there's no API to document, but you can learn about the individual pieces (how to write an input manager in general, how method swizzling in Objective C works, how to use tools like class-dump) and then put it all together.
What you are describing sounds like Greasemonkey though, and there are least one or two hacks already out there to enable Greasemonkey-like behavior in Safari. I'd suggest seeing if one of them meets your needs first.

Resources