Skip to content

Instantly share code, notes, and snippets.

@patientplatypus6
patientplatypus6 / file.rs
Last active March 19, 2023 21:57
Not displaying Updated MSG
use yew::prelude::*;
use wasm_bindgen_futures::spawn_local;
use wasm_bindgen::JsCast;
use web_sys::{EventTarget, HtmlInputElement};
// use yew::{html, ChangeData, Html, InputData};
use yew::Callback;
use reqwest::header::USER_AGENT;
use std::collections::HashMap;
use yew_style_in_rs::*;
@patientplatypus6
patientplatypus6 / error.kt
Created July 4, 2021 22:35
Can't init service
//I'm trying to reproduce this repo
//https://github.com/razvn/webflux-r2dbc-kotlin/tree/master/src/main/kotlin/net/razvan/poc/springboot/webfluxr2dbckotlin
//without entirely copying it.
//What I'm getting stuck on is how to initialize a service from a handler when redirected from an http uri
//So here is the http uri
@PostMapping("/addbook")
//Here's the cors error
//Access to fetch at 'http://localhost:8080/comment' from origin 'http://localhost:3000' has been blocked by CORS
//policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present
//on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the
//resource with CORS disabled.
//ive tried using a webfilter and a corsfilter
//neither works, but neither is providing an error
> blog@0.1.0 dev /home/user/NEST/blog/blog
> next dev
ready - started server on http://localhost:3000
event - compiled successfully
event - build page: /
wait - compiling...
fs.js:114
throw err;
@patientplatypus6
patientplatypus6 / error.js
Created January 4, 2021 01:01
MySQL Connection error;
//I have the following connection to MySQL in a node server, using the package https://github.com/mysqljs/mysql
//Here is the function:
function connectionFunc(){
console.log("inside connectionFunc");
var mysql = require('mysql')
var connection = mysql.createConnection({
host: 'localhost',
user: 'root ',
@patientplatypus6
patientplatypus6 / errors.sh
Created October 10, 2020 14:40
pqxx not including
I've installed libpqxx on an ubuntu machine using the directions found here -
https://github.com/jtv/libpqxx/blob/master/BUILDING-configure.md
I've used the following commands (running the configure file at root and then making and the installing):
./configure
make
sudo make install
Then, in my C++ file, following directions I found here -
https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
I'm getting the following error -
error[E0308]: mismatched types
--> src/commands/music.rs:112:119
|
112 | update_postgres(client, "UPDATE errata SET transcription = $1 WHERE foreign_key = $2", &[&string, &music.errata]);
| ^^^^^^^^^^^^^ expected struct `std::string::String`, found `i32`
The function I am calling is this:
I'm using the following packaged (https://doc.rust-lang.org/std/process/struct.Command.html) to run bash scripts in rust
(here ss is an argument). It calls the below bash script. However it never reaches "after commnads has executed" even
though I have an exit statement in my bash file. Does anyone know why this might be or the solution? I've looked through
the commands documentation and nothing seems immediately apparent.
let output = Command::new("sh")
.arg("run_transcript.sh")
.arg(ss)
.spawn()
.expect("failed to execute process");
//This works once, but the function returns the following error if called twice
// Os { code: 2, kind: NotFound, message: "No such file or directory" }
fn python_path() -> std::io::Result<(String)> {
let pathdir = PathBuf::from("./scripts");
let path = fs::canonicalize(&pathdir)?;
println!("value of path {:?}", path.as_path().display().to_string());
Ok((path.as_path().display().to_string()))
}
listen 80 is in my default server so including it in my sites-available file will cause an error.
This file `myproject` in sites-available (and simlinked in sites-enabled) does not show my react app in `my/project/build`
which should load through the index.html file. It shows the welcome screen to nginx. Why is this? I thought this should
work as intended.
server {
server_name www.myproject.com myproject.com;
index index.html index.htm;
root /my/project/build;