Running a Perl/TK GUI inside a web page - html

We have a Perl application which contains a Perl/TK based GUI ( some checkboxes, entry fields, etc.)
I have been asked to modify the Perl / TK GUI part of the application so that it can be run inside a web page. Is this possible?
I found this:
http://oreilly.com/openbook/webclient/ch07.html
however it appears to create a web client and parsing the HTML response to format the output, as opposed to running inside a browser.
I would like to know if it is possible to somehow incorporate a Perl/TK GUI into web browser and if so what is the best way to do so? Maybe something like a plugin (ex. http://www.tcl.tk/software/plugin/)?

The usual way would be to rewrite your application in HTML/CSS/JavaScript. The example you show on the O'Reilly site does the opposite - it shows you how to write a Tk application that will render HTML.
A browser plugin is possible if that will provide what you need. If that is the case then the problem is trivial, but you would need the plugin installed on every PC that needs to have access to your application, and it is possible that there are certain Tk facilities that the plugin doesn't support. All you can do is try it.

There was a project for Netscape that was mentioned in Mastering Perl/Tk called PerlPlus. But it looks like the Sourceforge page hasn't been touched in a while. The intent was to run Perl (and PerlTk) code in a Netscape browser.

Related

Why can't a browser display a local ASP.NET file?

I wanted to build a web application that kids could view 4-H Record Book forms, criteria, and examples from a CD. I wanted it to be in a web page format so that it was platform-independent (compatible with Windows, Mac, and Linux). I wanted to write the application in ASP.NET, so that I could reuse pieces of my site (e.g. Master Pages, databound controls). It worked fine while in Debug mode running on my simulator server, but when I attempted to open the files without the server simulator, they simply displayed as blank pages.
I've learned thus far that ASP.NET requires a server to run, but my question is: why does it require a server when so much of ASP.NET is just HTML tags? Also, is there any way I can use ASP.NET features such as Master Pages and Databound controls on a local website?
Output of ASP.NET is html, css and other stuff, but ASP.NET itself is a very complex system that consists of many components, for instance code-behind classes, asp.net controls, event system, routing system, various libraries etc. The server has to somehow (I won't go into details, because it's a way too broad topic to explain like this) assemble the output and it will spit out the generated html, css etc. to the client who requested the file (typically a browser).
Browser itself can only work with final html, css, javascript and so on, but it can't do processing that needs to take place on the server-side.

How to customize buildbot web pages

I am trying to make some extra web pages for a test buildbot, since I am planning to have one running my project.
Practically I would like to have a waterfall page that show the button to build a specific builder, close to the build name, instead than in the builder page only. I would also like to have some reference documents loaded from inside the builder work folder, and from other locations on the slave machine; using buttons to display or hide them.
I've looked at the manual and I do not see any info about how do you customize or create new html pages, that can leverage on the Buildbot features (like the templates already included with Buildbot do).
I have opened some pages, and see that there are some html files that actually has non-html code statements like
% macro
% for
And so on. I am not a web programmer so I am quite clueless about what should I look for. Tried to google the word macro for HTML and I just got a bunch of results related to Wiki customization; it does not look like it is Python language so I am quite lost.
Is there anyone that was successfully able to make custom pages for the buildbot, and could give me some pointers about what to learn?
Buildbot uses jinja2 for templating, the jinja2 homepage has some nice documentation. This is where the non-html statements come from. I found google's chromium buildbot to be a good starting point, when learning about buildbot customization.
http://buildbot.net/buildbot/docs/0.8.7/developer/webstatus.html
http://jinja.pocoo.org/docs
http://src.chromium.org/viewvc/chrome/trunk/tools/build/masters/master.chromium/templates/

How best to make a web app with multiple pages?

I'm trying to make a multiplatform offline webapp using PhoneGap. I know my html and css, but I'm not altogether familiar with the full capabilities of JavaScript, and I've never made a webapp before, let alone tried to use phonegap to empower it.
Right now, I have the main index.html that phonegap sets up for you, but now I'm uncertain as to how to proceed. If I want a button to take the user to another page from the main page, should I make a second html file and literally link between them, or is this a lot more complex than that?
Also (get ready for a possibly epically stupid question from a total beginner):
Do web apps have to be online? I'm really not clear on whether they function like normal websites in which they need to be hosted on a server, or if they can be packaged up and downloaded just like normal native apps. Please help!
Thanks.
Oh, and btw, I'm working in Xcode with the phonegap addon thing....I'm trying to get it running on the iphone before I move on to android.
Although the other answer helped me at the time, I thought I would add a more complete answer now, five years later, to my own first StackOverflow question.
To start with, a "web app" is the same as a "website" in a technical sense, and yes, they have to be hosted on a server in order to be accessed through the browser...just like every website. The only distinction is that a web app is generally a more dynamic and complex sort of website, involving JavaScript and AJAX. It would be misleading to call a simple website like this one a "web app," whereas Facebook is definitely a web app. Basically all web apps are websites, but not all websites are quite exactly web apps.
However, it only has to be "online" if you want it to be accessible anywhere from a browser via http. If you're making a Cordova app like I was at the time, that's not relevant. If you only want to run an application locally, you can do so with a local server like Python's SimpleHTTPServer or the one webpack provides, or any other alternative, including a server you write yourself from scratch.
As for the primary question about having multiple pages, yes anchor elements like my link are the standard way of connecting pages. To link among your own pages, you would have multiple .html files, and you would create a link with an href like href="myOtherPage.html", where that file is contained in the same directory as the file for the page linking to it. Alternatively you could set up a single-page-app where JavaScript loads new page content without the use of anchor elements-- in that case multiple .html files are not needed. Frameworks like Angular and React are helpful for accomplishing that, but it's by no means necessary.
In a typical web app, most of the time you would just need to create a link as you would if you were creating a link on a website. Also, Web apps can be developed via a local environment (research Mamp/ or Wamp) depending on the dependencies in which your app require.

Phonegap JQTouch Joomla and MySQL application

I am working on a project and it needs to accomplish the following:
A user logs into a joomla
Makes a change to some of their profile
This new information updates in the
database
Up to this point joomla will do everything, so the question is how do I take the information from the database and call it into a phonegap app. I am using phonegap and jqtouch for the app, and joomla with jomsocial for the update side.
I cannot have the app open into just a mobile version of the website because apple will reject it from the store. I need this solution to work for people to make updates to their profile, and these updates will automatically post to their app. All users input data on the same site, and share a database. Each profile however will have a different app that is released to the markets, so right now I am focusing on a template framework that can easily be changed to the users portion of the database.
From my understanding the php files stay on the server to process information. The big question is how do i call this information into a phonegap app?
To display XML as HTML you need to parse it through an XSLT stylesheet. This transforms your XML nodes into HTML. Of course, you could just use a PHP XML parser. I think there's one bundled with Joomla, but there are lots out there.
I was going to suggest using a Joomla plugin to push the data over to the Phonegap app. There are lots of events that are fired when an account is created and you could manipulate that.
If the XML is local, Jeepstone is correct. If it is not, how are you going to get it? To do this without running into cross domain issues, I suggest you try out this jQuery plugin on the phonegap side of things ... http://code.google.com/p/jquery-jsonp/ . So to take advantage of that nifty tool, you will adjust the public functions in this script to echo back json_encoded array. With which you can then do as you want on the phonegap side of things.
Ya Apple wants your app to not be useless without internet. But it is straightforward to create your index.html to show the user something. Use the failure and success functions in the jsonp library to show connection problems if necessary.

Delphi with HTML/CSS interface

I want to develop a delphi application with an HTML/CSS graphical user interface, not necessarily running from within a web browser. I want to do this do create a richer graphical user interface with animations etc. and break away from normal VCL components / Windows look. Any suggestions?
HTML and CSS won't deliver animations or a Rich User Interface to your feet. Far from it in fact. Quite the opposite. You will need to invest in a toolkit to provide that sort of functionality and almost certainly involve JavaScript. And even if you don't want your eventual application hosted in a web browser, your application will itself have to host a web browser to render your HTML/CSS/JavaScript UI, and you will then have a much more difficult job of connecting your GUI to your application logic (unless you do actually embrace a web application architecture).
Delphi (or any Windows application development language for that matter) gets you much, much further down the road towards a more simply, effectively and quickly implemented Rich User Interface than HTML or CSS.
If you don't like the look and feel of the standard Delphi controls (which in essence is what you are saying) there are numerous alternative libraries available.
Also bear in mind however that when someone uses a Windows application they expect it to look and behave a certain way to a large extent. Using fancy, web based paradigm's in a desktop application simply for the sake of it is likely to confuse and frustrate users if taken too far.
I'm all for user interfaces breaking with convention where it leads to a more intuitive user interface, but simply being "prettier" does not necessarily lead in that direction and is just as misguided as dogmatically adhering to convention.
In one of my applications I have an an embedded browser and I have implemented the IDocHostUIHandler interface. This allows me to expose a COM object via the "GetExternal" method. I simply have a COM object that exposes methods and properties of my application which makes them available to the web pages hosted inside the embedded browser.
So the script in my web pages has lines like "external.DoSomething()" and "i=external.GetThisValue()". So, for example, behind button onclick events you can run a method of your application (implement in the main form, in the COM object itself, or whatever you like).
This site has lots of info on embedding a browser in your Delphi app:
http://www.delphidabbler.com/articles?article=22
It can certainly be cumbersome to implement a lot of this stuff and in many cases there are probably better options. But for my specific purpose I am able to offer a "home page" which can easily be modified to change its layout, look and even expose more (or less) functionality as required by myself or my users.
If you want a Delphi program with a better-looking interface, HTML is really not what you're looking for. What you really need are better-looking VCL controls.
Take a look at TMS Smooth Controls, for example. If you're on Delphi 2009 or 2010, you can get it as a free download here. That's one of many component libraries that can bring a slicker user interface to your program.
HTML / CSS offers some nice features which are (not yet?) available in Delphi and the VCL. They are also a good starting point for client/server programming, separating the user interface and the business logic is a key factor here.
One popular library for Delphi is the extpascal project:
ExtPascal is an Object Pascal (Delphi,
FreePascal/Lazarus) wrapper/binding
for Ext JS, a complete GUI Ajax
framework, made in JavaScript, for
Rich Internet Application (RIA)
development. ExtPascal lets you use
Ext JS from Object Pascal commands
issued by the server. It brings the
structure and strict syntax of the
Object Pascal for programming the web
browser. ExtPascal will wrap Draw2d
into future releases.
Some demos are online here and here.
p.s. and I really like the HTML / CSS support for element and font sizes in relative units (for exampe percent). Combined with browser zoom in / zoom out and WCAG, user interface ergonomy can not be much better.
HTML Option 1
If you relly want to use HTML+CSS(+JavaScript) to build a GUI, you can have a look at HTML Applications, a very fascinating concept from Microsoft. HTML Applications, .hta files, have been supported from Windows ME, if I remember correctly, and they are still supported on Windows 7.
You could create an HTML Application (i.e. an HTA file), and by so doing, creating a GUI using only HTML, CSS, and JavaScript. When the user double-clicks the HTA file, it will open like a program, but the GUI is entirely based on HTML; in fact, the entire Window is an Internet Explorer window in disguise.
And now comes the important part: you could create non-GUI Delphi applications (i.e., Delphi applications that are not console applications, but that have no forms either), and start them via hyperlinks (or JavaScript) from within your HTA GUI. (Well, it is probably better to create one such Delphi application, and use command-line arguments (ParamStrs) to communicate the desired action.)
Just an idea...
HTML Option 2
Alternatively, you could create a normal Delphi GUI application, but fill the entire main form with a TWebBrowser (a IE control), using Align := alClient. Then you could either load static HTML pages (stored in the Program Files folder or on the Internet), or you could use Delphi to dynamically create HTML pages to show. I think it is possible to intercept links from the control, so that you could respond to links using Delphi code.
What about OpenGL?
If you want to "break away" from the normal Windows look and feel, then I would recommend you to create your GUI using OpenGL. It is very easy to make a Delphi application with OpenGL (as long as you are familiar with OpenGL) - just add "OpenGL" to your uses list.
First this: I completely agree with Deltics' answer.
Having said that, if you master HTML and CSS (and JavaScript and AJAX etc etc) and you are looking for a way to use the power and speed of the Delphi compiler to run the dynamics of a website, this may be of interest.
I've created a project that uses the Delphi compiler to build a library that runs a website. The source-files combines HTML and Delphi, much like other web-scripting tools out there, but gets processed on a page-refresh, and compiled automatically. It uses a 'library handler' that plugs in the website library into pretty much anything you like: IIS, Apache, a stand-alone HTTP server (for hosting), or directly into InternetExplorer or FireFox (which is great for developing).
http://xxm.sourceforge.net/
New versions of Qt contain ability to use html/js for interfaces. I don't know if there is Qt library bindings for Delphi, but Qt is exactly what you want.
for Rich GUI and animation, have you looked at KSDev DXScen and VGScene ?
If you want to keep your delphi/Pascal Object 'background' and have a Web like RIA you also have a look to Morfik : link text