How upload text file in Vaadin to textField? - upload

I know how upload and save file. But how to upload the file without saving on disk and display text-data in TextArea or TextField.

When using the vaadin upload you should be able to use a ByteArrayOutputStream instead of a FileOutputStream.
So just use the sample from the book of vaadin but use a ByteArrayOuputStream instead.
When the uploadSucceeded method is called, you take the ByteArrayOutputStream, convert it into a string (Beware of the correct encoding) and set it as the value of your TextArea/Field.

Related

How to save the code and the formatting properties of ace editor to the database in Rails

The value in the editor is formatted only on the client side but when the value is sent to the database it is saved without the formatting.
How to save both the code and the formatting properties so that they both can be retrieved during display of the code snippet
Are you using raw action? If not, then read it.
I was using another editor (probably codemirror) and I saved the text in it to database in <pre> </pre> tag and then it would save as a string of html but later render properly too. Go through documentation of ace-editor. It must have a similar solution.
pre tag gives me this here:
Gems for ace-editor:
gem 'jquery-ace-rails'
gem 'ace-rails-ap'

how to use tika for extracting the content from ppt?

fellow programmers!I extract a ppt file with using tika,which has only plain text.However,the result that tika give a content type is a jpg format!So my question is how to deal with it for I only want that case to be detected as a plain text type.
I change some source code in the tika,so I can get what content I want.In this way,I extract the ppt file and get the right result.

Finding file type of NSData recieved from server

I am receiving a text file from a socket over TCP/IP. There is no file extension (or filename for that matter) as the data is received as bytes. I can take the data from this (in the form of NSData) and load it into a UITextView and display it fine.
I want to persist this data to a file. However, I don't know what format the data is in (txt, rtf, doc, docx)? I assume it as .txt and save it in the documents directory, but is there a programmatic way of finding out for sure? I've looked around StackOverflow and at the documentation and haven't been able to find anything.
And is there a way to get the details of the file attributes like the file creation date.
Thanks in advance.
When you send a file over a TCP/IP connection, only the file contents will be converted to data and be passed across. If you want the filename,extension and the file attributes, then you will have to add those details separately and append it with the data to be sent. Then you can parse it at the receiver end and use the results inside your app.
You can choose the file type you want when you save the data, you can get attributes from file,please refer to Get file creation date.

How to store content of text area from nicEdit with formatted text in a database

I am using the nicEdit editor for a text area, which may have text, image, links and other formated text. I don't know what datatype to use in a MySQL database to store its content.
If there is any other way to handle this stuff, please suggest.
You can try to save the data in a text column. I think it is a good idea to encode the data before saving. For example, save it as base64 (if you don't have to search in the content), or as url encoded string.
If the images are uploaded to the server, you have to save the images on the webserver too. A few options are:
Use Blob fields (binary large objects) to save the images
Convert the images to an base64 string directly for use in the html code.
Save the images on the file system, not the database
In my tests, options 1 and 2 create a lot of data. So it is better to save the images on outside the database.
Hope this Helps.

What Character encoding is this?

When i backup my blackberry using blackberry desktop mananger, it saves it as an .ipd file.
its in hex... Not sure if its any particular type. But i used software called ABC amber Text Converter to convert this .ipd file into plain text format. And some of it comes out as plain text, Like all the messages saved in the backup file. But some of the text in the file looks like this:
qÖ²u_+;¢õ¿B[[¤†D`Ø,>p
|Cñ:ÌQ†nÁä¼sÒ®sKDv©{(]
)++³É«.gsn>
z
'‚51o4Kq
8Ütâ¯cí¿þ2´Õ|5kl$S,H
dbiIjz
*!~k$|
&*OÝ>0ðî­wã
+zno%q
2k;
YnÁÅŸ5|Xñ7Ú<}y2
A
V܉lO5‰<œtÅRI-I
Does anybody have any idea What the hell this is or if there is Any way i can decode this?
Thanks
It's just binary data. You may have been able to extract some text from the file where strings of text were stored, but the rest will be just bytes of data.
You'll need a specific program that understands these backup files. A quick google reveals a few choices, such as MagicBerry.
One of the Blackberry developers has helpfully blogged a bit of information about the binary format, so you could try using that to write your own program to parse it:
http://us.blackberry.com/devjournals/resources/journals/jan_2006/ipd_file_format.jsp

Resources