Questions about the status of ICR (intelligent character recognition)

I'm looking for a little advice on a project that I'm considering It is in the scope of OCR / ICR and I wonder how accurate ICR has become. Obviously, there are commercial solutions in Azure and Google, as well as some open source options.

My project would consist of preprinted forms that would be filled with pen by hand. I imagine that essentially all of them would be printed (not italic).

I guess I'm trying to find out at this point if there is a solution (open to a commercial) that, for example, can read letters where the lines can cut the letter (that is, the person who completed it did not write 100% in the space open but instead turned to the field line, etc.). In addition, any of these solutions can handle check boxes and identify elements in a circle. (For example, FT / PT / NA) Full time, part time, not applicable. If a user drew a circle around one of those options, is there a way to identify which of those options are enclosed within a circle?

Does anyone have any ideas also if there is any commercial option that allows them to easily identify fields and then specify what they want to do with the data in those fields?

It seems that perhaps the Azure ink and shape recognizer is a combination of what I am looking for. I'm curious if, for example, the Form Recognizer works with a combination of handwritten and typed text.

Are you looking for someone who may have some idea of ‚Äč‚Äčthis type of project and what is currently possible? Is there any OCR / ICR solution that has achieved human parity?

AUNT!

string – Questions about the Java toString method

Sasaki, you are very wrong about the use of the method. toString. To print something on the console you must use the method print as you did in your question code.

The method toString it is a method present in all objects in Java and is used only for return a rope and do not print it See an example below for a better understanding:

public class Exemplo{
    public static void main(String() args) {

        Integer num = 17;
        System.out.println(num.toString().getClass());
    }
}

The output of the previous code will be java.lang.String because calling the method returned a string of the integer value.

Simple topology questions – Math stack exchange

I have zero topology knowledge to none and need some clarification.

I have trouble understanding what the set of two topological spaces is $ A $ Y $ B $ half. that is to say $ [A, B] $. It's just that sometimes it seems to refer to a class of homotopies and I have trouble finding the definition of the expression.

I also have problems to prove that yes $ A $ it is a collapsible topological space $ implies [A, B] $ It has only one element

Interview questions – Implement a micro service in Rust

Last year I tried to implement a micro service architecture in Rust. The imagined use case was a small izakaya store where you could give or delete digital orders to the tracked or deleted kichen.

Looking for feedback on my coding style and architecture

https://github.com/simonsso/teketeke

Some sketches of the use cases.
usecase1usecase2

and the code

main.rs

#(macro_use)
extern crate serde_derive;
extern crate hyper;
extern crate hyper_staticfile;
extern crate serde_json;

use std::error::Error;

use futures::{future, Future, Stream};
use hyper::{Body, Request, Response, Server, StatusCode};

use hyper::error::Error as hyper_errors;
use hyper::service::service_fn;
use lazy_static::lazy_static;

use regex::Regex;

use futures::task::spawn;
use futures_locks::RwLock;
use hyper_staticfile::FileChunkStream;
use tokio::fs::File;

#(derive(Copy, Deserialize, Clone, Serialize))
enum States {
    PENDING,
    DELIVERD,
    EMPTY,
}
#(derive(Deserialize, Clone, Serialize))
struct Record {
    itemname: String,
    id: usize,
    state: States,
    qty: i32,
    eta: u64,
}

struct Datastore {
    vault: Vec>>,
}

#(derive(Deserialize, Clone, Serialize))
struct TableRequestVec {
    tab: Vec,
}

#(derive(Deserialize, Clone, Serialize))
struct TableRequest {
    itemname: String,
    qty: i32,
    eta: u64,
}

fn datastore_rw_lock(num: usize) -> RwLock {
    let mut v: Vec>> = Vec::with_capacity(100);
    for _ in 0..num {
        v.push(RwLock::new(Vec::new()))
    }
    let d: Datastore = Datastore { vault: v };
    RwLock::new(d)
}

lazy_static! {
    // TODO verify the correctness of regexp in tests
    static ref RE_TABLE_NUM: Regex = Regex::new(r"^/table/(d+)(/(.*))?$").unwrap();
    static ref RE_TABLE:     Regex = Regex::new(r"^/table/?").unwrap();
    static ref RE_DOWNLOAD_FILE:Regex = Regex::new(r"^/(index.html|button.js)$").unwrap();
    static ref STORAGE:RwLock =datastore_rw_lock(101);   //init with tables upto 100
                                                                   // TODO this should be done on demand instead
    static ref ITEMNUM:RwLock =RwLock::new(0);             // Global uniq order num
}

fn get_global_num() -> usize {
    let mut retval = 0;
    let lock = ITEMNUM.write().map(|mut cnt| {
        *cnt += 1;
        retval = *cnt;
    });
    match spawn(lock).wait_future() {
        Ok(_x) => {}
        Err(_) => {}
    }
    retval
}

// Encapsulate response for hyper
fn microservice_handler(
    req: Request,
) -> Box, Error = std::io::Error> + Send> {
    let uri: String = req.uri().to_string();
    let method = req.method().to_string();

    if let None = RE_TABLE.captures(&uri) {
        return serve_file(&uri);
    }
    // Parse request URL with stored Regexp
    let (table, path): (Option, Option) = match RE_TABLE_NUM.captures(&uri) {
        Some(m) => {
            // this is checked to be an integer
            let tbl = m.get(1).unwrap().as_str().parse::().unwrap();
            match m.get(3) {
                Some(argument) => (Some(tbl), Some(argument.as_str().to_string())),
                None => (Some(tbl), None),
            }
        }
        None => (None, None),
    };

    match (method.as_ref(), table, path) {
        ("GET", Some(table), None) => {
            // GET all items for table t
            let table = table as usize;
            match table_get_all(table) {
                ApiResult::Ok(s) => Box::new(future::ok(
                    Response::builder().status(200).body(Body::from(s)).unwrap(),
                )),
                ApiResult::Err(code, s) => Box::new(future::ok(
                    Response::builder()
                        .status(code)
                        .body(Body::from(s))
                        .unwrap(),
                )),
            }
        }
        ("GET", None, None) => {
            // Get all items
            let comma: String = ",".to_string();
            let lock = STORAGE.read();
            let v = &spawn(lock).wait_future().unwrap().vault;

            //Reusing get from table code
            let mut bodychunks: Vec = Vec::new();
            bodychunks.push("{"tables":{".to_string());
            for i in 0..v.len() {
                match table_get_all(i) {
                    ApiResult::Ok(s) => {
                        let headerstring = format!(""{}":", i);
                        bodychunks.push(headerstring);
                        bodychunks.push(s);
                        bodychunks.push(comma.clone())
                    }
                    ApiResult::Err(code, msg) => {
                        //TODO This should not occour
                        println!("Enexpected error fetcing all data {} {} {}", i, code, msg);
                    }
                }
            }
            if bodychunks.last() == Some(&comma) {
                bodychunks.pop();
            }
            bodychunks.push("}}".to_string());
            let stream = futures::stream::iter_ok::<_, ::std::io::Error>(bodychunks);
            let body = Body::wrap_stream(stream);
            let resp = Response::builder().status(200).body(body).unwrap();
            Box::new(future::ok(resp))
        }
        ("POST", None, None) => {
            let resp = Response::builder()
                .status(501)
                .body(req.into_body())
                .unwrap();
            Box::new(future::ok(resp))
        }
        ("POST", Some(table), None) => {
            let lock = STORAGE.read();
            let tablelist = &spawn(lock).wait_future().unwrap().vault;
            match tablelist.get(table as usize) {
                //TODO replace None case and Some case here
                Some(_) => {
                    // Sic TODO: this finds the tables vector and then does not use it
                    let boxedresult = table_add_items(req.into_body(), table);
                    let f = boxedresult.map_err(teketeke_to_stdio_err).map(move |s| {
                        match s {
                            Ok(s) => Response::builder().status(200).body(Body::from(s)),
                            Err(TeketekeError::InternalError(s)) => {
                                Response::builder().status(417).body(Body::from(s))
                            }
                            _ => Response::builder()
                                .status(418)
                                .body(Body::from("Unknown error")),
                        }
                        .unwrap()
                    });
                    Box::new(f)
                }
                None => {
                    let err = "I am a tea pot Error: this table is not allocated - build a bigger restaurant";
                    let response = Response::builder()
                        .status(418)
                        .body(Body::from(err))
                        .unwrap();
                    Box::new(future::ok(response))
                }
            }
        }
        ("DELETE", Some(table), Some(path)) => {
            // Remove something from table t
            //Todo find a way to identify items in table tab... maybe with id
            let table = table as usize;
            match table_remove_item(table, path) {
                ApiResult::Ok(s) => Box::new(future::ok(
                    Response::builder().status(200).body(Body::from(s)).unwrap(),
                )),
                ApiResult::Err(code, s) => Box::new(future::ok(
                    Response::builder()
                        .status(code)
                        .body(Body::from(s))
                        .unwrap(),
                )),
            }
        }
        ("UPDATE", Some(_t), Some(_path)) => {
            // Change some object for instance when it is deliverd to table
            // Fall throu default response
            let ans = "Not implemented";
            let resp = Response::builder()
                .status(501)
                .body(Body::from(ans))
                .unwrap();
            Box::new(future::ok(resp))
        }
        _ => {
            // Unsupported operation
            // Fall throu default response
            let ans = "Not implemented";
            let resp = Response::builder()
                .status(501)
                .body(Body::from(ans))
                .unwrap();
            Box::new(future::ok(resp))
        }
    }
}

#(derive(Debug))
enum ApiResult {
    Ok(T),
    Err(u16, String),
}

fn table_get_all(table: usize) -> ApiResult {
    let lock = STORAGE.read();
    let v = &spawn(lock).wait_future().unwrap().vault;
    match v.get(table) {
        Some(x) => {
            // let vec_lock:RwLock> = *x;
            let read_lock = (*x).read();

            let x1 = spawn(read_lock).wait_future().unwrap();
            //sic!
            let table_vec: Vec = x1.to_vec();

            let bodytext: String = serde_json::to_string(&table_vec).unwrap();
            ApiResult::Ok(bodytext)
        }
        None => ApiResult::Err(
            418,
            "I am a tea pot Error: this table is not allocate - build a bigger restaurant"
                .to_string(),
        ),
    }
}
// Magic tranform of one kind of error to other
fn other(err: E) -> std::io::Error
where
    E: Into>,
{
    std::io::Error::new(std::io::ErrorKind::Other, err)
}

// Magic tranform of one kind of error to other
fn to_stdio_err(e: hyper::Error) -> std::io::Error {
    std::io::Error::new(std::io::ErrorKind::Other, e)
}

enum TeketekeError
where
    E: Into>,
{
    ExternalError(E),
    InternalError(String),
}

fn intoTeketekeError(err: E) -> TeketekeError
where
    E: Into>,
{
    TeketekeError::ExternalError(err)
}

fn teketeke_to_stdio_err(e: TeketekeError) -> std::io::Error {
    match e {
        TeketekeError::ExternalError(err) => err,
        _ => {
            let not_found = std::io::ErrorKind::NotFound;
            std::io::Error::from(not_found)
        }
    }
}

fn table_add_items(
    body: Body,
    table: usize,
) -> Box<
    Future<
            Item = Result>,
            Error = TeketekeError,
        > + Send,
> {
    let res = body
        .concat2()
        .map(move |chunks| {
            serde_json::from_slice::(chunks.as_ref())
                .map(|t| table_store_new_items(table, t.tab))
                .map_err(other)
                .map_err(|e| intoTeketekeError::(e))
                .and_then(|x| {
                    if x == 0 {
                        Err(TeketekeError::InternalError("Nothing modified".to_string()))
                    } else {
                        Ok(x.to_string())
                    }
                })
        })
        .map_err(other)
        .map_err(|e| intoTeketekeError::(e));
    Box::new(res)
}

fn table_remove_item(table: usize, path: String) -> ApiResult {
    let removethis = match path.parse::() {
        Ok(x) => x,
        Err(_x) => return ApiResult::Err(503, "Illegal table number".to_string()),
    };
    let outerlock = STORAGE.read().map(|outer| {
        // range check done is outside
        let innerlock = (*outer).vault(table as usize).write().map(|mut inner| {
            // *inner is now the handle for table vector

            match (*inner).iter().position(|c| (*c).id == removethis) {
                Some(x) => {
                    (*inner).remove(x);
                }
                None => {}
            }
        });
        spawn(innerlock).wait_future()
    });
    match spawn(outerlock).wait_future() {
        Ok(_) => 0,
        Err(_) => 0,
    };
    ApiResult::Ok("".to_string())
}

fn table_store_new_items(table: usize, v: Vec) -> u32 {
    let mut target: Vec = Vec::with_capacity(v.len());
    for i in v {
        target.push(Record {
            itemname: i.itemname,
            id: get_global_num(),
            qty: i.qty,
            state: States::PENDING,
            eta: i.eta,
        })
    }
    let retval = target.len();
    // Get lock for data store
    let outerlock = STORAGE.read().map(|outer| {
        // range check done is outside
        let innerlock = (*outer).vault(table as usize).write().map(|mut inner| {
            (*inner).append(&mut target);
        });
        spawn(innerlock).wait_future()
    });
    match spawn(outerlock).wait_future() {
        Ok(_) => retval as u32,
        Err(_) => 0,
    }
}

fn serve_file(path: &str) -> Box, Error = std::io::Error> + Send> {
    // Only serv the hard coded files needed for this project
    if let Some(cap) = RE_DOWNLOAD_FILE.captures(path) {
        let filename = format!("client/{}", cap.get(1).unwrap().as_str());
        let open_file = File::open(filename);
        let body = open_file.map(|file| {
            let chunks = FileChunkStream::new(file);
            Response::new(Body::wrap_stream(chunks))
        });
        Box::new(body)
    } else {
        let ans = "Thou shalt not read forbidden files";
        let resp = Response::builder()
            .status(403)
            .body(Body::from(ans))
            .unwrap();
        Box::new(future::ok(resp))
    }
}

fn main() {
    let portnum = 8888;
    println!(
        "Starting server port at http://localhost:{}/index.html",
        portnum
    );
    let addr = ((127, 0, 0, 1), portnum).into();

    let server = Server::bind(&addr).serve(|| service_fn(move |req| microservice_handler(req)));

    let server = server.map_err(drop);
    hyper::rt::run(server);
}

#(cfg(test))
mod tests {
    use super::*;

    // TODO/Note add unit test on handler level, when there is time to add
    // a request struct and check the response struct. Have to figure out
    // how to achive this.
    //
    // For now this must be tested at system level by usage.
    #(test)
    fn check_post_ans() {
        let chunks = vec!("hello", " ", "world");
        let stream = futures::stream::iter_ok::<_, ::std::io::Error>(chunks);
        let body = Body::wrap_stream(stream);
        let table: usize = 1;
        let ans = table_add_items(body, table);
        let ans = spawn(ans).wait_future();
        match ans {
            Err(_) => {}
            Ok(_) => assert!(true, "should have failed"),
            _ => assert!(true, "test case took unexpected path"),
        }
        //assert!(r.status() == 422);

        let order = r#"{"tab":({"itemname": "Edamame","qty" : 100 ,"eta":100 },{"itemname": "Nama biru","qty" : 5 ,"eta":200} )}"#;
        let chunks = vec!(order);
        let stream = futures::stream::iter_ok::<_, ::std::io::Error>(chunks);
        let body = Body::wrap_stream(stream);
        let table: usize = 1;
        let ans = table_add_items(body, table);
        let ans = spawn(ans).wait_future();
        match ans {
            Err(_) => assert!(true, "should not have failed"),
            Ok(Ok(x)) => assert_eq!(x, 2.to_string()),
            _ => assert!(true, "test case took unexpected path"),
        }
    }
    #(test)
    fn check_store_values() {
        let mut v: Vec = Vec::new();
        v.push(TableRequest {
            itemname: "Something".to_string(),
            qty: 1,
            eta: 100,
        });

        let table_get_all_res = match table_get_all(10) {
            ApiResult::Ok(x) => x,
            _ => panic!(),
        };
        let before: Vec = serde_json::from_slice(table_get_all_res.as_bytes()).unwrap();
        let storednum = table_store_new_items(10, v);
        assert_eq!(1, storednum);
        let table_get_all_res = match table_get_all(10) {
            ApiResult::Ok(x) => x,
            _ => panic!(),
        };
        let after: Vec = serde_json::from_slice(table_get_all_res.as_bytes()).unwrap();

        // Should be one more entry
        assert!(after.len() - before.len() == 1);
        table_remove_item(10, "1".to_string());

        let table_get_all_res = match table_get_all(10) {
            ApiResult::Ok(x) => x,
            _ => panic!(),
        };
        let _after: Vec = serde_json::from_slice(table_get_all_res.as_bytes()).unwrap();

        //TODO Should be back where we started but item ide can not be guessed as they are world uniq now
        //assert_eq!(after.len(),before.len());
    }

    #(test)
    fn check_regexp() {
        let ans = RE_TABLE_NUM.captures("/table/100");

        match ans {
            Some(m) => {
                assert_eq!(m.get(1).map_or("Unknown", |m| m.as_str()), "100");
            }
            _ => {
                assert!(false);
            }
        }
        match RE_TABLE_NUM.captures("/table/100/open") {
            Some(m) => {
                assert_eq!(m.get(1).map_or("Unknown", |m| m.as_str()), "100");
                assert_eq!(m.get(2).map_or("Unknown", |m| m.as_str()), "/open");
            }
            _ => {
                assert!(false);
            }
        }
    }
}

altcoin – Building a Litecoin fork and I have some questions

I am following YouTube tutorials (yes, multiple because each one is incomplete in some way) to build a Litecoin fork. So far I have been able to render my coin wallet on Linux. Excellent. Nevertheless…

  • In one of the tutorials, the boy suggests, after making the Linux wallet work, use a vm or a vps to clone the currency (I'm using a vps, he uses a vm), set up a mycoin. conf in .mycoin for both the local machine and the vm / vps, and then run ./mycoin-qt on both (how am I supposed to run this on a vps terminal?) Supposedly, this will allow mining. Can anyone clarify things for me? Will I ever have to do this again? This is not the seed node, right?

  • How can I make it possible to extract, for example, 10k blocks per minute, then change it to its normal configuration (say, 20 for 5 minutes starting)? This is so that I can extract some millions of blocks by myself. I will also post this on the site of my currency, for transparency.

  • I need help configuring seed nodes. In my opinion, I am supposed to have 2. How do I configure this (what code do I need to edit, what should I do in each vps)?

  • I am trying to save money. Would it be advisable to configure a seed node (or task 1 of this publication) on the same server where I host a DNS server?

  • What is the least stressful way to create a Windows wallet?

  • Thanks in advance. Litecoin 0.8 fork

    Questions about New Zealand

    I need to know how the nine-month visa works for tourists going to New Zealand, too, if I fall in love with the place and decide to take a job, what are the conditions or requirements to change the visa status?

    Add dynamic questions on Google forms

    I am using Google forms to punch orders in my Google Sheets.

    Although I face a challenge since the quantity of products is variable.

    For example

    Question 1: Item Name 
    Question 2: Quantity
    

    I want the responder to add as many items and quantities as he wants.

    Is it possible to do the same with the main functions or application scripts? If it is not possible with Google forms, is there any other form application that does the same?

    What is the best way to ask questions about the amount of rewards through a survey?

    Since there is probably a commercial cost that increases with a greater number of points offered, you must calculate the amount of points where giving them away is not viable and generate options based on that value. In that sense, you should avoid wasting others' time and time by asking "stupid questions" (in this case, asking if they would prefer an amount that is not viable is a waste of time and theirs).

    windows – Questions about the emptying process

    When the time comes to write the malicious image into the emptied process, apparently the goal is to allocate memory exactly in the base address of the image of the emptied process. Why? Why not allocate memory according to the malicious address's base address, that way the code already has the correct addresses?

    Example: Notepad.exe -> base image address: 0x00260000
    , mal.exe -> iba: 0x00400000.
    Now, instead of allocating space for mal.exe at address 0x00260000 (Notepad memory space) and having all instructions and data inside mal.exe changed from 0x00400000 base to 0x00260000 base, you can simply allocate space at 0x00400000 to start with