I work for a school district in which the teachers submit their lesson plans to their principals online.
They do this using an online form I wrote using PHP/MySQL and it uses TinyMCE for its textareas. One of the major features that was requested was for teachers to be able to save their incomplete forms as drafts to submit later. This was implemented, but the new problem I'm facing is that not all teachers have access to the internet at home, thus they cannot work on their lesson plans while at home.
Of course, they could cut and paste out of a word document or text file that they save on their laptops, but then they have to cut/paste one textarea at a time, and they complain about it.
So what I was thinking about trying, is making an offline application that looks like the online form, but saves the form in an xml format on their computer. Then they could open this file to keep working on it, or upload it to the online form later.
My question is: being that my programming experience is currently limited to a few web-related languages (php, javascript, html) what should I use to attempt to write this offline app? Winbinder? Adobe AIR?
I think your best bet will be to ask them to install Google Gears on their browser (comes by default with Google Toolbar iirc), which is ideal for storing content offline. And then as soon as they go online it's easy to sync the stored content back to your online server.
Gears API Documentation can be found here.
How are teachers currently working on their lesson plans offline?
If they're doing it in plain text, for example, perhaps you can simply add a file upload field. They would upload their file (which they worked on offline), and your web app would parse it and divide it up into the appropriate sections.
(If rich text is a requirement, they can use a Word doc.)
To aid with parsing, you could tell them to use section headers -- maybe special words in all caps -- or provide them an example template (which maps directly to the web form) to start from.
The idea here is that you may want to minimize the changes teachers will need to make. They're already used to what they're currently doing, so work with their current habits. It would be easier than having them change and do something new. Installing a new offline app on their computers is almost certainly a significant barrier.
(While I was typing this answer, Josh Curren submitted a similar one.)
I would save the form to a text file that they can save to their desktop, then upload it and read it into the form later. You would have to supply them with a template so that everything they enter is in the correct order.
One simple option would be to build a regular desktop app they could install locally and take with them. Have an upload function in the app that allows them to submit it when they are connected to the internet.
Another option is to use create an editable PDF of the form, then either a) submit those as a whole to the principal, or b) parse out the field data on the server side.
IF they are using Internet Explorer at BOTH school and home, you could give them the form in a webpage saved in the web archive format, *.mht. They fill out the form at home and save it in the same *.mht format. When they return to school they open the page and submit it.
This should work and may be simple to implement. I tried it on this post, but ran into problems somewhere between the captcha and the openid login. Give it a try on your form.
I've actually gone with Adobe AIR to do this.
With AIR, the form looks nearly identical to the one that's used online and even uses the same TinyMCE library. And I didn't have to learn much to get it going, just the AIR javascript API.
I'm also using AIR to write a few other apps and I love it.
Related
I am writing a social website which using Server-side render,
for example , user received the rendered post (HTML) from the server when user created a post,
and append the HTML to the Dom.
--
Now here comes the problem,
when I choose to render everything at the server,
where should I render "small things"?
For example, if I want to generate a photo preview before user upload a photo,
should I create a tag at the cilent side,
then modify it with JavaScript,
or just request the preview from the server to make y website "fully" server side render?
If I choose the former solution, my website will become hard to manage (Because it's like cilent-side render plus server-side render , which makes me hard to manage the templates)
I perfer the latter solution so I can manage all of my templates at the server,
but it depends on the internet speed, and I cant do anything once the user is offline,
What should I do?
Well, would say that your question about where to render "small things" will be responded with a vague answer. It may seem like an innocuous question, but the answer will be responded by more complex questions! IMO, it is far better to ask this question, than to apply a server-is-better myopic view to everything.
In general, I view each rendering task through some constraints all of which can vary dramatically by user!!:
- origin of content (is the information coming from the client?)
- delivering content (network infrastructure)
- viewing content (client hardware)
So, let's try to answer something specific:
For example, if I want to generate a photo preview before user upload a photo,
should I create a tag at the cilent side, then modify it with JavaScript,
or just request the preview from the server to make y website "fully" server side render?
Is the photo is coming from the server?
Yes: have server render preview
No: have the client render it
After reading the first view paragraphs of this Twitter ariticle, I came to the conclusion that their content would be best rendered on the server. But further reading, showed that they are hybridizing their rendering - some client and some server (complex - just like you said!).
But, that conclusion was made 8 MONTHS after they had 100 million users! So, be pragmatic and choose the rendering approach that will enable you to build the application with the least complexity.
After few months I decided to stick with Cilent-side render with Vue.js (and I have to rewrite everything, yay),
The reasons are:
Easier to manage the templates, pages.
Great for storing the data for offline usage (Because CSR get data only, not the whole page).
Separate the render work, so I can spend less money on my server.
Because everything will always outputted to the browser.
I would like to ask for something that I donĀ“t know if it is even posible.
Lets suppose I have a QR-code that, after reading, send to ascertain URL in my server with PHP. Is it possible to get any data from the device? The situation is, i want to deploy QR codes, that when reaching my server, can offer random prizes to the device user (or save it...) But I need some data, IMEI, phone number, so I know who are the winners.
Has someone ever had a similar need?
I have searched this whole site, but cant find any answer.
The only way this would be possible would be to write your own QR code scanner app & have the user install it. And even then, I'm not sure that this wouldn't violate some sort of security control on the device.
The reason for this is simple: the QR code simply encodes a static string like a URL. There is no provision in the QR code itself to insert additional data to the URL after the device reads it - this would have to be done by an application on the user's device. And while I haven't researched all the various QR code reading apps out there, I would be surprised if the most common ones did anything like this.
What you might do is play around with a QR code scanner: set up a web server with PHP, create a QR code that points to it, and examine the request that your server gets when the code is scanned. My guess is that you'll just find the standard HTTP headers, but you might find information in there that you can use.
But the best solution to this kind of functionality would be to have the QR code point to a web page with a form on it where the user can enter their email address. This has the added benefit that you can then collect customer email addresses (with full disclosure of what you're doing with that information, of course).
I am working on an online time card system to replace the paper time cards. What I have done is create a webpage in PHP that takes the time in and out along with job description and other values the user inputs and stores them in a MySQL database. Everything is working just fine.
What I would like to work on next is to take the information from the database for the specific user and week and have it fill in a PDF template file I have created from scanning the old paper time card and making it into a PDF form. I dont know if this is possible I have been researching it online and all I can come up with is how to generate a new PDF file. I am hoping someone here can point me to a source of information on how to do this.
Here is an example of exactly what I want to do http://try.fillpdf-service.com/
Hi congratulation for you about done the 1st step in time,
You can use very complete pdf generator php class TCPDF
It started in 2002, TCPDF is now one of the world's most active Open Source projects, used daily by millions of users and included in thousands of CMS and Web applications.
http://www.tcpdf.org/ for genarating your pdf what kind your want this class has very useful documnet and simple to use
Cheers,
Farzam
Take a look ath this
http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
It can be invoked as a command line tool and among the other functions let fill form fields, (on an already existing PDF you supply).
Maybe FPDF is quite old, but still good to handle for PDF generation. Just take a Template PDF (create as you like) and put the informations you want on it. You will have to place your data on the specific positions, see the tutorial section for a better understanding.
Another popular solution is to use Zend_PDF from well known Zend Framework, but I think FPDF would be a tick easier to work with if you are not very experienced.
I am struggling for days to solve this problem and it seems i cant find any good helpful guidance. So the problem is i want to implement a feature in my web application to give the users the option of editing a text on any editor they have locally and then save the file (the saved file will be online).
Suggested Solution: well my idea is:
1)to create a folder for the user locally on the browser file location.
2)open the applications using exec() (before doing so checking what kind of operating system the user use and create the appropriate error handling)
3)save the file will should be in the created file(point 1).
4)Retrieve the data from the folder.
Please advice me if u have a better idea?
What you're trying to do is impossible. PHP is server-side and it has no control over the client, it can only send it a sequence of characters to render (the page that gets displayed).
There are javascript-based rich editors such as CKEditor and TinyMCE which you can provide for the client to use, but that's about as far as you can go. Additionally, as every web browser is a little different from the other and has its own quirks and bugs when it comes to running client side javascript/DOM operations, you can expect a lot of weird little issues that happen in one particular version of one particular browser but not in others. And if the client has javascript turned off they won't see any editor at all.
In short, you can't do all that. You can do some of that. Remember, with HTTP the user is in complete control, and you can do nothing "on the user's machine". If you could, that would be called "a dangerous security exploit" and would stop working as soon as the various browsers' coders got to it.
You can send the output to the user with an appropriate MIME type, that will open the editor of your choice. You can even invent your own MIME type to do that (the user must install the editor by himself).
Then the user will save the text on his machine. You can't save on a remote machine (not in all editors), since it is not a "save", it is an "upload" that you want.
Finally the user can recover the file he or she just saved, and submit it to you via a POST form, for example.
Frankly, where I live we call this "how to put one's ass before other people's kicks". Just think of all the possible editors, each maybe with its own format: if the user (un)knowingly chooses something weird such as "Save in Word 2015 Extra Format (Compressed)", and uploads the file to your server -- are you prepared to understand the file format and do something meaningful with it?
A very common alternative is to implement any one of several Rich Text Editors in HTML - there's CKEdit, for example, or TinyMCE, and so on. They will let the user produce clean HTML and upload it on your server automatically.
I'm working on a biology web based application and trying to figure out what language to use. The features I need to include are:
Image viewing frame - This area will display the current image that the biologists wish to see. The application needs to take in a number of coordinates from a file and draw those points on the image displayed here. When the biologist wishes to change images there needs to be no flickering from the refresh. Will do this using multiple image buffers probably. Content needs to be scrollable and able to be zoomed in.
There need to be labeled buttons that advance, step back, zoom, and play the images displaying in the image frame. There also needs to be some type of list view where images titles can be selected to be displayed.
There will be a bunch of folders of images on the server that can be selected from. The application must allow the user to select which folder of images to be loaded. It also must be able to read from either an txt or xml file and visually display the information there by way of line graph.
Would like to be able to run scripts on the server from the application.
I feel that all these things are doable by a web application but I have no idea what language to use. Most people recommend php, but i don't want to delve deeper until I know what its limitations are. Any suggestions are welcome. Thanks in advance.
-Mike
PHP can do everything you need for the back end, but most of the stuff that you describe is UI based, and this is dependent on the client, which is, of course, the browser. For highly graphical projects, you can do a lot in JavaScript and some JavaScript libraries have a lot of these capabilities built in. You might also consider Flash or Flex.
You might even consider a desktop application that runs outside of the browser. You can use Java, which is easy to deploy, but still requires the user to have the Java Runtime Engine, or you could go with a language that you can compile down to a native application.
Regardless of the front end technology that you choose, you'll still need a back end, and PHP can handle this.
You will find almost every server side platforms such as php , asp.net, asp, etc will do all of the above.
PHP is a language that resides on the server and handles all requests. Javascript (and associated libraries) is a language which is executed by the client's browser and handles (almost) all interaction. PHP is definitely able to do what you want, but for the interaction stuff (particularly the zoom, scrolling, etc.), you'll also need to use Javascript.
So, short answer, PHP is good, but you're going to need to use client-side scripting as well.
PHP is more than capable of doing this. You are going to need to use it in combination with some Javascript to handle the client side effects you describe. I would look into modifying galerific for your needs and then whip up some javascript to write points over the images.
From your concerns about image refresh/flicker, it really sounds like a desktop app is what you are looking for, for a rapid response on image changes. The requirements on this really seem to need to be defined better before you can choose a language... PHP can do all the server side stuff you mentioned, but you might have a harder time getting the image viewing "frame" to provide the functionality you want.
Due to the image manipulation requirements it might be easier to go with something like flash with a php backend or asp.net with silverlight. It might be difficult to prevent flicker and delays with using pure javascript as opposed to flash/silverlight.
Image viewing frame
This will most likely need to be done on the client side using tools/frameworks such as jQuery, the canvas element, silverlight, or any of the other 100's that are out there.
There need to be labeled buttons that advance, step back, zoom, and play the images displaying in the image frame. There also needs to be some type of list view where images titles can be selected to be displayed.
PHP or any other server-side scripting language could pull this off. If this is meant to be a quick project running on free/cheap hardware then PHP would be a good choice. If the plan is a large application that will have to be maintained over the course of many years and hosting/price is not an issue then I would suggest something like ASP.NET
There will be a bunch of folders of images on the server that can be selected from. The application must allow the user to select which folder of images to be loaded. It also must be able to read from either an txt or xml file and visually display the information there by way of line graph.
Again any server side language could do the folder listing portion. As for reading files and creating graphs, this would most likely be a combination of server side and client side programming. jQuery for example, has plugins that could quite easily take a xml file and create a line graph.
Would like to be able to run scripts on the server from the application.
PHP, ASP.NET - both could do this. I'm sure many others could, but these are the ones i use most often
The issue with PHP is that quite often, the code turns into a mess over time. This is maybe not so much an issue with the language as the people using it and the purpose the app was built for (a quick, one time project). Classic ASP also has the same issues.
ASP.NET is a good combination of OOP programming that allows you to separate presentation from logic with minimal effort.