56. (android Development) file read / write operations OpenFileOutput and OpenFileInput

In addition to saving key value data, content can also be saved directly in the form of files in android. Data format can be at will, are in the form of strings in the file. Take the longest txt text file you can see as an example. To read and write files, you need to open them. There are two methods: OpenFileOutput and OpenFileInput The storag ...

Posted by apenster on Sat, 02 May 2020 19:08:17 -0700

Sesame HTTP: the pit of scikit learn Bayesian text classification

Basic steps: 1. Training material classification: I refer to the official directory structure: Put the corresponding text, a txt file and a corresponding article in each directory: as follows   It should be noted that the proportion of all materials should be kept at the same proportion (adjusted according to the training results, the ...

Posted by KevinCB on Sat, 02 May 2020 13:36:22 -0700

Bulk merge PDF files with Python (bookmarking)

On the Internet, I found several softwares that combine pdf, which are not very easy to use. Generally, they don't have the function of bookmarking. I went to find the script of python merging pdf, and found that there was no function of bookmarking. So I wrote a small tool by myself, using PyPDF2, the code is as follows: #!/usr/bin/env py ...

Posted by gwolff2005 on Sat, 02 May 2020 00:12:31 -0700

Struts 2 notes -- File Download

Struts 2 provides the stream result type, which is specifically used to support the file download function. The following four properties are required to configure the result of stream type. contentType: Specifies the file type of the downloaded file inputName: Specifies the entry input stream of the downloaded file contentDispositio ...

Posted by greeneel on Fri, 01 May 2020 21:03:00 -0700

New features of C × 9: code generator, compile time reflection

Preface Today, the official blog of. NET announced the release of the first preview version of C 񖓿 9 source generators, a feature that users have been shouting for nearly 5 years, and finally released today. brief introduction Source Generators, as the name implies, allows developers to get and view user code during code compilation and generat ...

Posted by businessman332211 on Fri, 01 May 2020 14:48:51 -0700

js base64 and canvas base64

1, js base64 Get the uploaded file myfile, create a fileRead file object, and use the readAsDataURL method to encode the read file into a Data URL. After the file is loaded successfully, e.target.result is the base64 encoding corresponding to the file image. The image can be displayed by assigning the src of img directly. <body> & ...

Posted by hardius on Fri, 01 May 2020 14:42:21 -0700

Python string encryption

①base64 Base64 is a method of representing arbitrary binary data in 64 characters. When using Notepad to open exe, jpg, pdf files, we will see a lot of garbled code, because binary files contain many characters that cannot be displayed and printed, so if you want text processing software like Notepad to be able to process binary data, you ne ...

Posted by nasty_psycho on Fri, 01 May 2020 07:38:27 -0700

A doodle board control

This time, it brings a doodle control. In the previous project, a function needs to be done: the user signs on the screen, and then saves the signature as a picture. So I wrote this Control, named DrawView, here to share with you. First of all, let's talk about the principle. The principle is actually very simple. The one we draw on the scr ...

Posted by Hexxx on Thu, 30 Apr 2020 23:49:42 -0700

include tag of android UI optimization

It is used to reuse layout and reduce code redundancy. It is simple to use, as follows: Included layout Title bar.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/inner_id" android:layout_width="match_parent" ...

Posted by dgreenhouse on Thu, 30 Apr 2020 21:06:29 -0700

Scan annotator in Spring

Scan annotator in Spring 1. Configure xml file The code is as follows: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLo ...

Posted by SecureMind on Thu, 30 Apr 2020 21:05:38 -0700