Chrome extension with python - google-chrome-extension

I am building a chrome extension where I need to take the text of the current webpage and save that text in the input file on hard disk. This file I need to use in the python program which i'l be running in the back end. This python script will create a output file after processing the input file. Then i'll display this file content on the same webpage in the form of pop up. Now I am need to know how will I create the file,write into it and read from it in chrome. Is there any way to do this???

As far as I know Chrome Extensions are merely glorified javascript snippets. With the limitations of javascript and chrome's sandboxing I doubt you can do File I/O let alone talking to a native application. I'd say the best you can do use Chrome's LocalStorage or WebDatabase APIs. You'll have to poke around to see where these things are actually stored (hacky hacky).

Related

How to generate a skp file from SkPicture, in skia?

In skia, we can use SkPicture to record draw commands and then playback it, it works well.
I am wondering if there is some ways to generate a skp file from the SkPicture, so that I can use debugger.skia.org to analyze the draw commands.
I know , it's easy to capture the skp file from Chrome web page or android package. For my own rendering engine , if it's possible to get the skp file from SkPicture?
Thanks.
Yes this is what SkPicture::serialize() does. Take the Skia picture you want to write to a file, call serialize() on it, write the resulting SkData to a file with the .skp extension, and you should be able to open it in the Skia debugger.

Creating custom documents (PDFs) on the fly on a website

I want to create custom documents on my website which is running on a Linux-based server. My website has user login capability to access specific details on the website.
What I want to do is:
Use a default .tex file where the contents of the main document are stored. This would be available on the server (on admin side);
Get few user specific inputs (like login name, the day and date when the request was made), their custom inputs like what specific details they want (this will make it possible to include or exclude few chapters, sections from the document);
Using the inputs received above (in point 2), the document would be customized on the fly on the website by running LaTeX compiler and the output of the compilation would be shared with the user.
My questions are:
Has someone tried this before? Any suggestions, alternatives they can point to? If there is any other better solution than LaTeX, I am open to hear and understand that as well.
Are there any specific settings that we need to do either on the server or on LaTeX installation that will enable doing this?
Any additional packages, programs are required to be installed to get this working?
Any help and insights would be appreciated.
You can generate PDF using appropriate libraries for programming language you use for your back-end. This is definitely safer than injecting user input into TeX file and probably would be faster too.
PHP: Best way to create a PDF with PHP
Ruby: https://github.com/prawnpdf/prawn
anything else: google for "$LANGUAGE generate pdf".
The first and the second questions can be done in any programming language you choose while reading the .tex template and add/omit the data, then save it to the temporal .tex file. After compilation yo can remove this file. If you are working with a linux server you can use a service (cron, systemd) to automate the cleaning of files.
To compile and get the file you must use pdflatex command line program, which is the one any LaTeX editor uses. I compile my LaTeX documents this way in linux. I think this way is quite fast, except if you want images in this document, or are using tikz pictures.
I know I am suggesting the old way to do the work, but usually is the best way.
And, finally, I think PHDComics uses something like this for the emergency button (down in the right), only that in the site the pdf is already generated for the specific comic: http://www.phdcomics.com/

Making Chrome/Firefox Reuse Existing Opened File

I've added logic in Emacs to automatically call browse-url on a DMD generated html documentation file upon completion of a special build finish hook I've written.
In order for this to be usable I now want this call to only open a new browser tab the first time it is called and the rest of the times only reload the tab already showing the the doc file.
Is this possible, preferrably in Google Chrome?
I've scanned command line arguments for both GC and FF but have found nothing.
I suspect some Javascript/HTML-5 may do the trick but I know nothing about that.
For Firefox look into browse-url-firefox-new-window-is-tab and / or browse-url-maybe-new-window. You could follow the execution path from the definition of browse-url-default-browser, all in the browse-url.el.
But the basic idea is that you could just look at how, for example, browse-url-firefox is implemented, write the one that does exactly what you want (launches Firefox in the way that you need), and set it to be the browse-url-browser-function. The value of this variable must be a function which is called from browse-url.
What is interesting (perhaps something similar is available in Google Chrome), there's MozRepl, obviously, it will run in Mozilla browsers, and there's a binding for Emacs to talk to this REPL (interactive JavaScript interpreter). Using that you can have very fine-grained control over the behaviour of the browser, including, but not limited to creating new GUI components (using XUL), manipulating browser windows and so on. Would probably depend on how much time you are willing to spend on it.

Is it possible to render .doc file in qt on linux?

All I need is to show .doc files in qt application on Linux. No need edit/save or something else.
Is it possible?
Of course it's possible. But the file reading, parsing, and displaying would really be carried out by the underlying language, not Qt. So, if you think about it, C++ and Python and whatever else is quite capable of parsing and displaying what is essentially a text file (or for .dox an XML file).
The implementation details of how to go about that are quite another matter. You have to contend with a huge portion of the file that is merely there to render the file's styling, etc.

make swf from fla without ever opening it

is it possible to change text and images in a fla file without ever opening it up and then making the swf via command line? I want to make a flash template and save the fla. Then be able to update my text and image name and convert it to swf. I have one template but tons of different text options and background images. It would be nice to be able to copy the master.fla twenty times and just change the source code (will do this from command line) and then convert to swf (via command line).
Any help would be appreciated.
With CS5, you can do half of what you're asking today, by using the XFL file format instead of FLA. Instead of a binary blob, you get an editable XML file and a tree of separate asset files: PNGs, AS3 files, etc. You can then modify the XML or AS3 files programmatically to get your variants.
(A CS5 FLA file is really just a zipped up version of the XFL, but there's no advantage to using that instead of an XFL. In CS4 and previous, FLA was a proprietary binary format.)
The missing piece is an XFL compiler. Adobe currently provides no such thing, and the third party market hasn't yet produced one.
You could use a systems automation tool to drive the Flash Professional environment through the compilation steps. On OS X, for example, either Automator or AppleScript should be able to do what you want. It'll just have more overhead than the command line compiler you were hoping for.
I agree with Jason, there are a lot of alternatives to what you suggest. Keeping content out of the SWF is good practice actually. This is a good way to avoid large files!
Depending on what you 're looking to achieve, there are a lot of solutions available. XML is an option, JSON another.
If you're looking to build a template, any of the above would seem appropriate.
It sounds like you're working from the Flash IDE, as Jason suggests you may want to have a look at another IDE, such as FlashDevelop, FDT or FlashBuilder as they make coding with AS3 a lot easier.

Resources