Hi i have a requirement to send a daily email to customers with latest information. This weather information is on an image on the message body. The readings on the image will be dynamic. Any pointers on how i can achieve this.
Same image is below
As seen above all the text will change dynamically based on the weather forecast and this has to go as a mail body.
I use java for programming, but i am ok to use any programming language based on suggestion on how this can be archived quickly
You can create inline images within HTML like this: https://en.wikipedia.org/wiki/Data_URI_scheme .
A little more effort is required to create MIME attachments, which you would reference from your HTML. This also results in inline images. How to create an email with embedded images that is compatible with the most mail clients
These are two alternatives for creating a dynamic image at the time of your email's creation. For more dynamic behaviour, you would either use proper image urls (which will be blocked by clients) or you could use Javascript (which should not work for any client for security reasons).
Related
I am implementing qsjava application of docusign, as part of the application it is taking the pdf file from local folder i.e,World_Wide_Corp_lorem.pdf. I want to take that file from my accound Link.
I have created the Template and I have added the standard fields like text box.
Here my question is in the api link i.e, https://demo.docusign.net/restapi/v2.1/accounts/accountid/templates/teplateid, I am not getting the statndard fild that I have added in the template, from which api I will get it.
Once I got that field how can I read that my account template api and use that template in my application.
I'll answer your question, but I don't think that's what you are trying to do.
To retrieve the bits of documents inside templates, you can use this endpoint:
GET /restapi/v2.1/accounts/{accountId}/templates/{templateId}/documents/{documentId}
You need to know the documentId of your document, which is typically a number, if you set it yourself you can use "1", "2" etc.a
Now, I wonder if what you want to do is use this template to have someone sign an envelope using that template? that doesn't require you to download the bits.
See this code example that shows how to do this with your template if that's what you're after.
Is it possible to send extra data attached to a http response via Java or Php?
My Website is a homework-platform: One User enters homeworks into a database, and all users can then see the homeworks on the website. The current load is very inefficient, as the browser makes two requests for eveything to load: One for the index file and one for the homeworks. For the homeworks request the client also sends settings of the user to the server, based on which the returned homeworks are generated by a Php script.
Now, I wonder, if it is possible, to combine those two requests into one? Is it maybe possible to detect the http request with Java or Php on the server, read the cookies (where the settings are saved), then get the homeworks from the database and send the data attached to the http response to the client? Or, even better, firstly only return the index file and as soon as possible and the homework data afterwards as a second response, because the client needs some time to parse the Html & build the DOM-tree when it can't show the homeworks anyway.
While browsing the web I stumbled across terms like "Server-side rendering" and "SPDY", but I don't know if those are the right starting points.
Any help is highly appreciated, as I'm personally very interested in a solution and it would greatly improve the load time of my website.
A simple solution to your problem is to initialize your data in the index file.
You would create a javascript object, and embed it right into the html, rendered by your server. You could place this object in the global namespace (such as under window.initData), so that it can be accessed by the code in your script.
<scipt>
window.initData = {
someVariable: 23,
}; // you could use json_encode if you use php, or Jackson if you use java
</script>
However, it is not a huge problem if your data is fetched in a separate server request. Especially when it takes more time to retrieve the data from the database/web services, you can provide better user experience by first fetching the static content very quickly and displaying a spinner while the (slower) data is being loaded.
Currently I am sending images between an IOS app and Java web service as Strings - is there a better way to do this and if so what method is it - the Strings to represent images are huge and its quite hard to manage.
Thanks
If the image implementation you're using is serializable, serialize it.
I understood that you are currently using BASE64 encoded images being represented as strings, correct?
This approach is reasonable for small binaries/images and also to avoid many individual calls for each image in case of an list of images for example.
Anyway - a proper way would be to use a POST or PUT request to send an image to a Java web service in form of an x-www-form-urlencoded request. This is similar to what you do in a typical upload form.
Look at the example in this answer:
Send image to server as binary data
For the download of an image you can use a GET NSURLRequest (include required headers, authentication or other information to the request) and convert the received NSData to an image.
[UIImage imageWithData:dataReceivedFromURLRequest];
Or directly create the NSData for simple http requests like this and convert it to an image:
NSData *urlData = [NSData dataWithContentsOfURL:[NSURL URLWithString:#"http://my-web-service/image.png"]];
On the server side you could create an image REST endpoint using JAX-RS for example.
Please note that frameworks like AFNetworking help a lot providing convenient ways sending and receiving image/binary data.
I've written a java applet which sends longitudes and latitudes trough POST requests. I need to write a server page which will receive this data and dynamically shows a google map with the received points on it. (php/etc...)
I don't know how to start with this, because I really don't know what to do first.
https://developers.google.com/maps/documentation/imageapis/ has all the information you need.
So you simply need to get a server page to recieve your POST data, parse the longitude and latitude and then get the image result from the URL below (look inside the src attribute).
Should be fairly obvious what all the parameters are, zoom level on google maps and the size of the map in pixels. Alternatively if you just want this map displaying on a webbrowser you just output the img tag shown below
<img src="http://maps.googleapis.com/maps/api/staticmap?center=-15.800513,-47.91378&zoom=11&size=200x200&sensor=false">
EDIT:
The URL will dynamically generate the map each time you send a POST request. If you need the data to continuously change then maybe using POST requests isnt the best way to do it. POST is best used for data which you want to send off to a server then do something with (generate a single map etc).
As an example...
The user wants a map of where a particular street is that they have clicked on
>
Send POST request
>
Get the map using the Google Maps URL and send this back/output to a webpage.
As an alternative you might want to look at the various Maps APIs on the site. A better link for this would be https://developers.google.com/maps/
It's not quite clear what you are aiming to do so providing an example usage would help with a better answer.
I'm using the h:graphicImage tag in JSF. Is there a way to show a blank image (i.e. blank.jpg) if there is a broken or not found image?
There are two ways:
client side - with javascript, see here
server side (less preferable) make an ImageServlet which takes an image url, loads it and sees if it exists. If it exists, it is streamed to to client. If not - the blank.jpg is streamed to the client. Verification can be done via new File(fullPathToImage).exists(), or, if the image is not on your server, using URL.openConnection().