I'm currently working on some visualizations with Zeppelin and Seaborn, but the display mechanism automatically converts images to HTML and this is eating all my RAM immediately. (Too many data points).
Jupyter on the other hand handles it fairly easily, it looks like it just encodes the image content in a Base64 string.
Is it possible to mimic this behavior in Zeppelin? Or, better yet, configure it as the default image handling mechanism?
I don't know if I can override the default behavior, but this can be achieved manually with html magic. For example:
def show(graphics):
graphics.savefig("../tmp.png")
with open("../tmp.png", "rb") as image_file:
encoded_string = base64.b64encode(image_file.read())
return """%html <img src="data:image/png;base64,{}" />""".format(encoded_string.decode())
Returning the html string with base64 encoded png is much more efficient with my data, and I'll probably use this everywhere.
Related
I am using this (Tiny) text editor in the web platform. Able to integrate basic editor also
Now problem i am facing is how to render output html data(which is in the string format) like this
so output data in string format is like this :
please help me out to render this string formatted data in a separate block.
whole idea is like this i need a rich text editor like stackoverflow/medium and want to render the data in a separate location. I'm little confused about all this please help me out or suggest a better approach to handle this.
I created a logic app which gets the data from restapi. The content type of data is Application/protobuf(protobuf is a binary data made by google https://developers.google.com/protocol-buffers/docs/tutorials) I know that LA uses base64 encoding so it changes the data to base64 encoding. As the data to be deserialised via protoc complier so it needed binary format. So i store this data into a variable and trying to paas this further processing. But unfortunately the data stores in variable changes into boxes and ? So protoc compiler fails to deserialised the same.
I tried base64tobinary and http() as per suggestion mentioned section "other content type" on microsoft https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-content-type#applicationxml-and-applica...
But it did not work. Can anybody help on this?
I tried reproducing the issue and found that the rest API body which we are receiving will be transformed back to string when we use string() i.e.. string(triggerBody()) dynamic expression.
Later, I convert to binary by using the dynamic expression 'binary', i.e. 'binary(outputs('Compose')', which will return a 'application/octet-stream' result. When I tried to convert back to a string, everything worked great for me.
Here is the flow of my logic app
and here is the output
I have changed the way of using. Instead of streaming, I am storing the data into file and processing further.
After testing URL in the google structured data testing tool, I don't know why the question mark character is shown instead of utf-8 characters?
what is wrong? any help really appreciated.
the url is : link
and the result image:
The underlying json is:
don't know why, but the structured data tool doesn't understand your farsi. If farsi is an encoded javascript, like \u0645\u0648\u0633\u0633\u0647 - there is no problem. But if it is written like علائم تیروئید کم کار - something wired happens.
Fast and dirty solution: encode all of your structured data content as encoded javascript. In Notepad++ this makes a plugin named HTML Tag - then ctrl+j.
I'm using fetch to retrieve data from an API, it returns an image in base 64 string format. How can i convert it in to a normal image and show it in a web page using react?
Try to use
<img src="data:image/jpeg;base64,{base64imagestring}" />
Try to use:
<img src={"data:image/png;base64," + Data.Photo} />
this was the solution that worked for me...
I think following information might help you.
So, base64 encoding has encoded binary information into textual data and to decode it back you can use - atob
To show it in a web-page using react - you may consider to use "img" tag itself, as suggested by #tico in comment using data-uri.
In general data uri, let you put your image( and other data) in the form of url.
So, simple steps would be -
1. Fetch the base64 encoded image.
2. Make a data-uri.
3. Load the source into the image tag, using state preferably.
4. And you are done!
Hope this helps.
use this below, make sure there is no comma in between them
<img src={"data:image/png;base64" + base64encodedimg } />
I have a grid and arrived data (Ext Direct), for example (firebug):
But in the grid you see:
If I click double to show full data, in the title of window, this data does not have trouble (come from the record):
The other columns render datas without problem. Do you have any idea to fix it?
I also live in a country where we need the accented characters (Slovakia) and I went through all possible encodings and troubles with localization. After all, UTF-8 is the real solvent. Since I use UTF-8 in database, in apache (Ajax) headers and on the HTML on the page I have no problmes.
Therefore, check if somewhere in the route the encoding does not change, check if UTF-8 is really sent from the server, check all headers, etc. The only problem that UTF-8 ceased to be used somewhere on the route.