instruction stringlengths 0 30k ⌀ |
|---|
I have a gform where the 2nd question is mobile number. I want to make sure the same mobile number is not entered more than once. Responder should get an error when submitting that the number is already registered. How to use app script to do this. I have tried following code,which is executed successfully but didn’t work.
```
function onFormSubmit(e) {
var form = FormApp.getActiveForm();
var itemResponses = e.response.getItemResponses();
var newMobile = itemResponses[1].getResponse();
var previousResponses = form.getResponses();
var isDuplicate = false;
// Check if the new mobile number is a duplicate
for (var i = 0; i < previousResponses.length; i++) {
var previousItemResponses = previousResponses[i].getItemResponses();
var previousMobile = previousItemResponses[1].getResponse();
if (newMobile === previousMobile) {
isDuplicate = true;
break;
}
}
// If duplicate, show an error message and delete the response
if (isDuplicate) {
form.setCustomClosedFormMessage("This mobile number has already been submitted. Please enter a different mobile number.");
form.deleteResponse(e.response);
}
}
```
|
I have a task and I need to copy data from one SQLite table to almost identical postgreSQL table. I wrote a code that doesn't work and I can't figure out what's the problem. It prints that connection was established successfull, shows no errors, but when I go to the terminal to check `content.film_work` table with command `SELECT * FROM content.film_work;` I don't see the data. It shows:
movies_database=# SELECT * FROM content.film_work;
created | modified | id | title | description | creation_date | rating | type | file_path
---------+----------+----+-------+-------------+---------------+--------+------+-----------
(0 rows)
Here are some steps:
1. Connect to the SQLite database and copy data from film_work table to dataclass.
2. Pass list of dataclasses instances with table rows to another function whee I connect to the postgreSQL.
3. Connect to the postgreSQL and get postgreSQL table (content.film_work) column names to pass it to the INSERT SQL query.
4. Before all this I change the order of columns to correctly pass data from SQLite to postgreSQL.
**SQLite table (film_work):**
0|id|TEXT|0||1
1|title|TEXT|1||0
2|description|TEXT|0||0
3|creation_date|DATE|0||0
4|file_path|TEXT|0||0
5|rating|FLOAT|0||0
6|type|TEXT|1||0
7|created_at|timestamp with time zone|0||0
8|updated_at|timestamp with time zone|0||0
**postgreSQL table (content.film_work):**
created | modified | id | title | description | creation_date | rating | type | file_path
**Code snippet:**
psycopg2.extras.register_uuid()
db_path = 'db.sqlite'
@contextmanager
def conn_context(db_path: str):
conn = sqlite3.connect(db_path)
conn.row_factory = sqlite3.Row
try:
yield conn
finally:
conn.close()
@dataclass
class FilmWork:
created_at: date = None
updated_at: date = None
id: uuid.UUID = field(default_factory=uuid.uuid4)
title: str = ''
description: str = ''
creation_date: date = None
rating: float = 0.0
type: str = ''
file_path: str = ''
def __post_init__(self):
if self.creation_date is None:
self.creation_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
if self.created_at is None:
self.created_at = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
if self.updated_at is None:
self.updated_at = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
if self.description is None:
self.description = 'Нет описания'
if self.rating is None:
self.rating = 0.0
def copy_from_sqlite():
with conn_context(db_path) as connection:
cursor = connection.cursor()
cursor.execute("SELECT * FROM film_work;")
result = cursor.fetchall()
films = [FilmWork(**dict(film)) for film in result]
save_film_work_to_postgres(films)
def save_film_work_to_postgres(films: list):
psycopg2.extras.register_uuid()
dsn = {
'dbname': 'movies_database',
'user': 'app',
'password': '123qwe',
'host': 'localhost',
'port': 5432,
'options': '-c search_path=content',
}
try:
conn = psycopg2.connect(**dsn)
print("Successfull connection!")
with conn.cursor() as cursor:
cursor.execute(f"SELECT column_name FROM information_schema.columns WHERE table_name = 'film_work' ORDER BY ordinal_position;")
column_names_list = [row[0] for row in cursor.fetchall()]
column_names_str = ','.join(column_names_list)
col_count = ', '.join(['%s'] * len(column_names_list))
bind_values = ','.join(cursor.mogrify(f"({col_count})", astuple(film)).decode('utf-8') for film in films)
cursor.execute(f"""INSERT INTO content.film_work ({column_names_str}) VALUES {bind_values} """)
except psycopg2.Error as _e:
print("Ошибка:", _e)
finally:
if conn is not None:
conn.close()
copy_from_sqlite() |
Using MathML, inside \<mrow>, I have an expression that is quite big (once rendered, the symbols occupy more space in vertical than the normal text). When I add a \<mo>(\<\mo> inside the same \<mrow>, the parenthesis is enlarged to match the size of the expression.
For example:
<math>
<mrow>
<mo>(</mo>
<mfrac><mrow> <mn>1</mn> </mrow> <mrow> <msqrt><mrow>
<mfrac><mrow> <mi>a</mi> </mrow> <mrow> <mi>b</mi> </mrow>
</mfrac> </mrow> </msqrt> </mrow> </mfrac>
<mo>)</mo>
</mrow>
</math>
is rendered as:
[![expression in parenthesis][1]][1]
Other symbols, such as "+", are not enlarged, not even if they are inside a \<mo>. I would like to have brackets
like "< expr >", but the following code:
<math>
<mrow>
<mo><</mo>
<mfrac><mrow> <mn>1</mn> </mrow> <mrow> <msqrt><mrow>
<mfrac><mrow> <mi>a</mi> </mrow> <mrow> <mi>b</mi> </mrow>
</mfrac> </mrow> </msqrt> </mrow> </mfrac>
<mo>></mo>
</mrow>
</math>
does not enlarge the "<" and ">":
[![expression in < >][2]][2]
It seems that the behavior of the various symbols is automatically selected, so that
"(" is considered as a fence and "<" is not. Is it possible to override this choice,
so that the "<" and ">" are resized? I tried various options of \<mo> but none worked.
[1]: https://i.stack.imgur.com/a8xBG.png
[2]: https://i.stack.imgur.com/9dm6x.png |
Fences (parenthesis, braces) in HTML and MathML |
|html|mathml| |
The problem was the buffer size which was 30720 bytes.
const int BUFFER_SIZE = 500000000;
I just changed the size which is approximately 500MB and now select them from the heap.
char* buffer = new char[BUFFER_SIZE];
|
your postgis host is the name of the postgis service, hence `postgis`
you need to add it as environment variable to your second container or use `psql` client inside the container such as:
```psql -h $POSTGRES_HOST -d $POSTGRES_DB -U $POSTGRES_USER```
|
You have a couple options:
1. Skip the task manually: `./gradlew build -x doSomething`
2. Reconfigure the `check` task to remove any references of `doSomething` task. You can refer to https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:configuring_tasks for more details. |
If somebody looking to do this in expo-router,
const pathName = usePathname();
console.log(pathName); |
I'm encountering an issue where I can access public projects without any problem, but when I attempt to access a private project, I receive an error message stating 'Cannot connect to the remote repository.'
I've verified that my access token is correct and tried using it, but the issue persists. Any insights or suggestions on how to resolve this would be greatly appreciated. Thank you. |
Cant connect to any github repository from my netbeans 20 |
|apache|github|netbeans|repository|git-repo| |
You can install pkg-config via homebrew:
brew install pkg-config |
Take a look at the examples in apollo server doc, on [how to implement resolvers](https://www.apollographql.com/docs/apollo-server/data/resolvers/)
In the schema you have already included `comments` property to the `User` type
```gql
type User {
id: ID!
username: String!
"List of comments authored by the user (optional)"
comments: [Comment]
# ... other fields
}
```
you also defined `userByEmail` to fetch user in top-level type `Query`
```gql
type Query {
userByEmail(email: String): User!
}
```
Next, you need to implement resolvers for this schema. For the type `Query` you need to implement resolver for the method `userByEmail`. You've done this part
```js
import { getUserByEmail } from '../../dataAccessLayer/orm/user';
import { User } from '../../generated/types';
// Use intersection type to combine Resolvers and Query
export const resolvers = {
Query: {
userByEmail: async (_, { email }: { email: string }) => {
console.log('parent', email);
const user = await getUserByEmail(email); // Already includes comments
return user;
},
},
};
```
The next thing you need to do, is to define resolver for `comments` property of `User`, which give you exactly what you want: user comments.
```js
import { getUserByEmail, getCommentsByUserId } from '../../dataAccessLayer/orm/user';
import { User } from '../../generated/types';
// Use intersection type to combine Resolvers and Query
export const resolvers = {
Query: {
userByEmail: async (_, { email }: { email: string }) => {
const user = await getUserByEmail(email); // Already includes comments
return user;
},
},
// User. not Comment.
User: {
// The parent entity for comments field is user
comments: async (parent: User, _: any) {
if (parent.comments !== undefined) {
// you mentioned that user fetched with userByEmail already
// includes comments, so you might not even need to refetch it
return parent.comments
}
const comments = await getCommentsByUserId(user.id)
return comments;
},
}
};
```
And this is an example of the query compatible with our schema
```gql
query userWithComments($email: String!) {
userByEmail(email: $email) {
id
username
# some other fields
comments {
id
content
}
}
}
```
|
The project is the flutter default app and on macOS when I try to run build runner using (command+shift+b) I face this error on output:
Running `flutter pub run build_runner build --delete-conflicting-outputs`
Current working folder: `/Users/saeed/Documents/programming/Projects/flutter_bloc_test`
Error: spawn flutter ENOENT |
This script tries to add or remove checkboxes from column A if columns B-D are populated or not. If every cell in those three columns of that row is populated then a checkbox is inserted in column A. If even one cell in those three columns of that row is not populated, then no checkbox is inserted.
column A = checkboxes
column B = title
column C = tstart
column D = tstop
```
function refreshCheckboxes(){
let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheet_name');
var rows = sheet.getDataRange().getValues();
var headers = rows.shift();
var checkbox = row[0]
var title = row[1];
var tstart = row[2];
var tstop = row[3];
for (var i = 0; i < rows.length; i++) {
if (rows[[title][tstart][tstop]] !== "") {
checkbox.insertCheckboxes();
} else {
checkbox.clearDataValidations();
checkbox.clearContent();
}
}
}
```
CURRENT OUTCOME:
*ReferenceError: row is not defined* is occurring when the row variables are being set. I'm not sure why I'm getting that error because I have similar functions that define the row variables in this way. My other worry with this script is about how columns B-D are set up. Is an array appropriate here and and is there an better way to set this up?
DESIRED OUTCOME:
To identify what is causing the row definition error and correct it. To verify if that AND() functionality works.
I already have an onEdit() that works perfectly other than it applying to only one row at a time thus I wanted to make a [custom]() to run as needed.
Thanks! |
App script to prevent duplicate form submission |
|forms|google-apps-script|google-forms| |
null |
I wrote a PHP function which can be used without Phar.
It also works with long filenames and was tested with big TAR archives. Compatible with PHP 5 to 8.
Usage:
```
<?php
$ret = tar_extract ("filename.tar", "./path-to-extract/");
if (empty ($ret["errText"])) {
print ($ret["fileCnt"]." files extracted.");
print ($ret["log"]);
}
else {
print ("Error: ".$ret["errText"]);
print ($ret["log"]);
}
?>
```
TAR archive functions:
```
<?php
function tar_truncate_name (&$str) {
for ($i=0;$i<strlen ($str);$i++) {
if (0==ord (substr ($str, $i, 1)))
break;
}
$str = substr ($str, 0, $i);
}
function tar_checksum (&$str, $size) {
$checksum = 0;
for ($i=0;$i<$size;$i++) {
$checksum += ord (substr ($str, $i, 1));
}
return $checksum;
}
function tar_read_header ($fh)
{
$header = array (
"name" => 100,
"mode" => 8,
"uid" => 8,
"gid" => 8,
"size" => 12,
"mtime" => 12,
"chksum" => 8,
"linkflag"=> 1,
"linkname"=> 100,
"magic" => 8,
"uname" => 32,
"gname" => 32,
"devmajor"=> 8,
"devminor"=> 8,
"rest" => 167
);
$dataPos = ftell ($fh)+512;
$stat = fstat($fh);
$filesize = $stat['size'];
if ($dataPos>$filesize) {
return -1;
}
$checksum = 0;
foreach ($header as $key => $len) {
$header[$key] = fread ($fh, $len);
$read = strlen ($header[$key]);
if ($read<$len)
return -1;
if ($key=="chksum") {
$empty = " ";
$checksum+=tar_checksum ($empty, 8);
}
else
$checksum+=tar_checksum ($header[$key], $len);
}
tar_truncate_name ($header["chksum"]);
if (empty ($header["chksum"])) {
return false; // Last TAR header
}
// Checksum
if ($header["chksum"]!=sprintf ("%06o", $checksum)) {
return -1;
}
// Parse form octal to decimal
if (sscanf ($header["size"], "%o", $header["size"])!=1)
return false;
if (sscanf ($header["mtime"], "%o", $header["mtime"])!=1)
return false;
// Truncate names
tar_truncate_name ($header["name"]);
tar_truncate_name ($header["linkname"]);
tar_truncate_name ($header["uname"]);
tar_truncate_name ($header["gname"]);
fseek ($fh, $dataPos);
if ($header["linkflag"]=="L" && $header["name"]=="././@LongLink") {
// Read long filename
$longFilename = fread ($fh, $header["size"]);
if (strlen ($longFilename)!=$header["size"])
return -1;
// Skip 512 Byte block
$size=(512-($header["size"] % 512));
fseek ($fh, ftell ($fh)+$size);
// Now comes the real block
$header = tar_read_header ($fh);
if (!is_array ($header)) {
return -1;
}
else {
$header["name"]=trim ($longFilename);
}
}
// Remove relative paths for security
$header["name"] = str_replace (["../", "..\\"], ["./", "./"], $header["name"]);
return $header;
}
function tar_extract ($tarFilename, $dstPath=".", $options=array ()) {
$ret = array (
"fileCnt" => 0,
"dirCnt" => 0,
"size" => 0,
"log" => "",
"errText" => ""
);
$fh = fopen ($tarFilename, "r");
if (!$fh) {
$ret["errText"] = "Cannot open TAR file: ".$tarFilename;
$ret["log"].=$ret["errText"]."\r\n";
return $ret;
}
while (!feof ($fh)) {
$header = tar_read_header ($fh);
if (!is_array ($header)) {
if ($header==-1) {
$ret["errText"] = "TAR header corrupt.";
$ret["log"].=$ret["errText"]."\r\n";
}
break;
}
else
if ($header["linkflag"]==0) {
$ret["log"].=$header["name"].", ".$header["size"]."\r\n";
// Read file
$dstFilename = $dstPath."/".$header["name"];
$fh2 = fopen ($dstFilename, "w+");
if (!$fh2) {
$ret["errText"] = "Cannot create file: ".$dstFilename;
$ret["log"].=$ret["errText"]."\r\n";
break;
}
else {
$size = $header["size"];
$buf = "";
while ($size>0) {
$bufSize = 0xFFFF;
if ($size<$bufSize)
$bufSize=$size;
$buf = fread ($fh, $bufSize);
$read = strlen ($buf);
if ($read<=0)
break;
fwrite ($fh2, $buf);
$size-=$read;
}
fclose ($fh2);
// Set file time and mode
touch ($dstFilename, $header["mtime"], $header["mtime"]);
chmod ($dstFilename, octdec($header["mode"]));
if ($size>0) {
$ret["errText"] = "Filesize incorrect: ".$dstFilename;
$ret["log"].=ret["errText"]."\r\n";
break;
}
}
// Skip 512 Byte block
if (($header["size"] % 512)!=0) {
$rest = 512-($header["size"] % 512);
fseek ($fh, ftell ($fh)+$rest);
}
$ret["fileCnt"]++;
$ret["size"]+=$header["size"];
}
else
if ($header["linkflag"]==5) {
$dstDir = $dstPath."/".$header["name"];
if (!is_dir ($dstDir) && !mkdir ($dstDir)) {
$ret["errText"] = "Cannot create directory: ".$dstDir;
$ret["log"].=$ret["errText"]."\r\n";
break;
}
// Set directory time and mode
touch ($dstDir, $header["mtime"], $header["mtime"]);
// chmod ($dstDir, octdec($header["mode"]));
$ret["dirCnt"]++;
}
else
{
// Unknown linkflag
// Ignore header but skip size
if ($header["size"]>0) {
$size = $header["size"];
// Skip 512 Byte block
if ($header["size"]<512)
$size=512;
else
$size+=(512-($header["size"] % 512));
fseek ($fh, ftell ($fh)+$size);
}
}
}
fclose ($fh);
return $ret;
}
?>
``` |
I’ve created a image from my partition with the e2image tool like this:
e2image -rap /dev/sdb2 /backup/sdb2.e2image
The Partitions size is around 870GB, but it used only around 25GB. When I do a `ls -laht` to check it size, I get this:
-rw------- 1 root root 868G 31. Mär 10:36 sdb2.e2image
Then I check the size with `du`
25G /backup/sdb2.e2image
now I created a lvm:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
arch_root vg_arch -wi-a----- 30.00g
Now i want to restore my old part backup, to this lv, so I do:
e2image -rap /backup/sdb2.e2image /dev/mapper/vg_arch_root
But i always get an error during the restoring process:
e2image no space left
What i'm doing wrong?
|
How to restore a e2image image backup |
|backup|restore|ext4|lvm| |
2024 method
-----------
Use **defaultSuccessUrl** to redirect users after successfull login. You could add a second argument (boolean alwaysUse), but I would not recommand it, it will always redirect users after success login.
.formLogin((form) -> form
.loginPage("/login")
.defaultSuccessUrl("/home")
.permitAll())
.logout((logout) -> logout.permitAll()); |
Should your assignment demand a "purely functional" approach, then you might want to look into recursive solutions or into the `fold` function. Below the same algorithm in three versions.
```
let f1 eq1 vars =
let mutable x = eq1
for v in vars do
x <- A (B v) x
x
let rec f2 x vars =
match vars with
| [] -> x
| h::t -> f2 (A (B h) x) t
let f3 eq1 vars =
(eq1, vars) ||> List.fold (fun x v -> A (B v) x)
```
Both the recursive solution `f2` and the `fold` in `f3` are quite common in the functional world. But, as mentioned by @smoothdeveloper, in F# you are free to also use other paradigms. |
The `-n` option cannot be overridden, so you can't exclude a single tag when extracting all data. It can be activated on a per tag basis by appending a hash tag to the end if a tag name e.g `-TAG#`, but that requires listing only specific tags, not all of them.
To override PYExiftool's default use of `-n`, see the [FAQ under "Ways to make the ouptut match"](https://sylikc.github.io/pyexiftool/faq.html#ways-to-make-the-ouptut-match)
- Disable print conversion and group name in PyExifTool:
`import exiftool`
`with exiftool.ExifTool(common_args=None) as et:`
` print(et.execute("-JFIF:all", "rose.jpg"))`
|
You can split your text into sentences make each clickable and then change the bg color
fun ClickableSentences() {
val paragraph = "This is the first sentence. This is the second sentence. This is the third sentence."
val sentences = paragraph.split(". ").map { "$it." }
var selectedSentence by remember { mutableStateOf(-1) }
Column {
sentences.forEachIndexed { index, sentence ->
val backgroundColor = if (index == selectedSentence) Color.LightGray else Color.Transparent
BasicText(
text = buildAnnotatedString {
withStyle(style = SpanStyle(backgroundColor = backgroundColor)) {
append(sentence)
}
},
modifier = Modifier
.clickable { selectedSentence = index }
.padding(4.dp)
)
}
}
} |
**Summary**
I wrote a simple Class (InteractableObject) to help highlight when my hand is interacting with an object. What is a performant and Idiomatic way to script this interaction?
I'm using the latest version 63 of both "meta all in one sdk" and Interaction SDK"
https://assetstore.unity.com/packages/tools/integration/meta-xr-all-in-one-sdk-269657
https://assetstore.unity.com/packages/tools/integration/meta-xr-interaction-sdk-264559
**Here is some loose pseudocode to help describe what I"m trying to do.**
```
using UnityEngine;
public class InteractableObject : MonoBehaviour
{
public bool highlightOnHover = true; // Should the object change appearance when hovered over?
public Material highlightMaterial; // Material to use for highlighting
private Renderer myRenderer; // Stores a reference to our renderer
private Material originalMaterial; // Stores the object's original material
void Start()
{
myRenderer = GetComponent<Renderer>();
originalMaterial = myRenderer.material;
}
// Replace with the actual Interactor component type
void OnCollisionEnter(Collision collision)
{
OVRInteractor interactor = collision.collider.GetComponent<OVRInteractor>();
if (interactor != null)
{
HandleInteraction();
}
}
// Replace with the actual Interactor component type
void OnCollisionExit(Collision collision)
{
OVRInteractor interactor = collision.collider.GetComponent<OVRInteractor>();
if (interactor != null)
{
HandleInteractionEnd();
}
}
void HandleInteraction()
{
Debug.Log("Interactable object collided with OVR hand!");
if (highlightOnHover)
{
myRenderer.material = highlightMaterial;
}
// ... Add your custom interaction logic here ...
// Play sounds, trigger events, etc.
}
void HandleInteractionEnd()
{
if (highlightOnHover)
{
myRenderer.material = originalMaterial;
}
}
} |
How to script a simple collision using hands in OVRCameraRigInteraction? |
|c#|unity-game-engine|oculus| |
You can use the following code to get seconds and minutes from the miliseconds
fun main() {
val mili = 150000
val min = mili/1000/60
val sec: Double = (mili.toDouble()/60000.0 - 2.0) * 60
println(mili)
println(min)
println(sec)
}
|
Next.js not updating state during OnClick after router.push to same page with different ID |
i have this page component for each product information:
```
export default function Product() {
const { data } = useContext(ShopContext);
const { id } = useParams();
if (!data) {
return <div>Loading product...</div>;
}
const product = data.find((item) => item.id === id);
return (
<div>
{product.title}
</div>
);
}
```
somehow product is undefined though data and id can be logged into console and their value is available, i made sure of it like this:
```
export default function Product() {
const { data } = useContext(ShopContext);
const { id } = useParams();
if (!data) {
return <div>Loading product...</div>;
}
console.log(id);
return (
<div>
{data.map(item => (
<div key={item.id}>
{item.title}
</div>
))}
</div>
);
}
```
i really can't find a solution when i even don't understand what's going on but i did it this way too and still nothing on the page (the url is correct and loading div is displayed):
```
export default function Product() {
const { data } = useContext(ShopContext);
const { id } = useParams();
if (!data) {
return <div>Loading product...</div>;
}
return (
<div>
{data.map(item => (
<div key={item.id}>
{item.id === id ? item.title : null}
</div>
))}
</div>
);
}
```
for additional information i'm fetching the data from [fakestoreapi.com](fakestoreapi.com) in the app component and it works fine in other components. here's the fetching piece:
```
useEffect(() => {
async function FetchData() {
try {
const response = await fetch("https://fakestoreapi.com/products");
if (!response.ok) {
throw new Error(`HTTP error: Status ${response.status}`);
}
let postsData = await response.json();
postsData.sort((a, b) => {
const nameA = a.title.toLowerCase();
const nameB = b.title.toLowerCase();
return nameA.localeCompare(nameB);
});
setData(postsData);
setError(null);
} catch (err) {
setData(null);
setError(err.message);
} finally {
setLoading(false);
}
}
FetchData();
}, []);
```
i really don't know what is the problem and what to search.
|
{"Voters":[{"Id":1145388,"DisplayName":"Stephen Ostermiller"}],"SiteSpecificCloseReasonIds":[13]} |
I'm trying to send an object to my api but i always get null values.
Here is my angular method:
`createNormalPost(post: CreateNormalPostInterface) {
const formData = 'ceasdasdas'
return this.httpClient.post<any>(this.API, formData,
{headers: {'Content-Type': 'multipart/form-data'}}
);
}`
And here is my controller:
`[Route("api/[controller]")]
[ApiController]
[AllowAnonymous]
public class PostController : ControllerBase
{
private readonly IPostService _postService;
private readonly ILogger<AuthController> _logger;
public PostController(IPostService postService, ILogger<AuthController> logger)
{
_postService = postService;
_logger = logger;
}
[HttpPost]
public async Task<IActionResult> CreatePostNormalAsync([FromForm] string formData)
{
try
{
Console.WriteLine(formData);
//var response = await _postService.CreatePostNormalAsync(post);
return Ok(formData);
}
catch (Exception ex)
{
_logger.LogError(ex, ex.Message);
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
}
}`
I'm currently trying to send a string just to check if the data is being sent but i still get null.
EDIT:I think i found the problem, somehow the request is sent as 'application/json' not as form data. |
From your code, it seems your `SelectedItem` component is being rerendered (as you could assess by placing a console.log statement in the component), but the selected item is being cached by your useState:
```
let [item, setItem] = useState(CurrentSelectedItem);
```
The first argument of useState is the initial value; this value is only read on the initial render (i.e. when the component is mounted). Any rerenders afterwards will not update the value of `item`. Since you're reading the state's value in `{item.name}`, you'll always see the initial value. If you replace that line with `{CurrentSelectedItem.name}` (and maybe remove that useState), you will start seeing new value when an item is selected. |
My current challenge revolves around Azure Test Plan's robust test management features, which unfortunately [do not include built-in support for importing JUnit test results](https://learn.microsoft.com/en-us/azure/devops/test/associate-automated-test-with-test-case?view=azure-devops#test-types). This poses an obstacle for teams relying on JUnit for testing, as it disrupts the seamless integration and comprehensive reporting within Azure DevOps.
To address this issue, one potential remedy involves harnessing annotations and REST APIs within the test framework itself. By embedding annotations into the test code and utilizing REST APIs to interact with Azure Test Plan, teams can create a tailored integration that bridges the gap between JUnit and Azure Test Plan. However, successfully implementing this solution necessitates careful consideration of both the capabilities of the test framework and the complexities of Azure Test Plan's APIs.
This is why I created this simple [`PowerShell module`](https://powershellgallery.com/packages/Import-JUnitToAzTestPlan) that will assist anyone interested in publishing their JUnit Test Report to Azure TestPlan.
### PowerShell Command for Importing JUnit Results
The [`Import-JUnitToAzTestPlan`](https://www.powershellgallery.com/packages/Import-JUnitToAzTestPlan) PowerShell module simplifies the process of importing JUnit test results into Azure Test Plan, streamlining the integration of JUnit tests into your CI/CD pipelines.
### Getting Started: Step-by-Step Guide
1. **Install the Module**: Begin by installing the "Import-JUnitToAzTestPlan" module from the PowerShell Gallery using the [`Install-Module`](https://learn.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershellget-3.x) cmdlet.
```
Install-Module -Name Import-JUnitToAzTestPlan
```
2. **Execute the Import Command**: Utilize the [`Import-JUnitToAzTestPlan`](https://www.powershellgallery.com/packages/Import-JUnitToAzTestPlan) command, specifying the required parameters such as the Azure DevOps organization URL, project URL, test plan ID, and JUnit test result file path.
```
Import-JUnitToAzTestPlan -Token $(System.AccessToken) -ProjectUrl "https://dev.azure.com/yourorganization/yourproject" -TestPlanID 1 -TestSuiteID 11 -TestConfiguration "Windows 10" -ExecutionReport "path/to/your/junit-results.xml"
```
3. **Customize Parameters**: Adjust the parameters according to your project's configuration and requirements. For example, specify the appropriate test configuration and test suite ID.
4. **Integration with CI/CD Pipelines**: Incorporate the import command into your CI/CD pipeline workflow, ensuring seamless execution of JUnit tests and automatic import of test results into Azure Test Plan.
- Task on Azure Pipeline YAML
```yaml
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Import-JUnitToAzTestPlan -Token <PAT> `
-ProjectUrl "https://dev.azure.com/yourorganization/yourproject" `
-TestPlanID "<TargetTestPlanID>" `
-TestSuiteID "<TargetTestSuiteID>" `
-TestConfiguration "<TargetTestConfiguration" `
-ExecutionReport "path/to/your/junit-results.xml"
pwsh: true
```
- `pwsh` is set to True as powershell core required for the module.
## Results:
[](https://i.stack.imgur.com/5Vd0R.png) |
onEdit() 'row is not defined' error using checkboxes |
|google-apps-script|checkbox|undefined| |
Have you tried wrapping the Editor inside `ClientOnly` (from remix-utils)? |
hello you should do like this
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
import mysite.wsgi
application = mysite.wsgi.application
<!-- end snippet -->
|
For posterity, a guide to HTTP 1.1 *multipart/byteranges* `Response` implemented in Django. For more information on *multipart/byteranges* see *RFC 7233*.
The format of a *multipart/byteranges* payload is as follows:
<pre><code>HTTP/1.1 206 Partial Content
Content-Type: multipart/byteranges; boundary=3d6b6a416f9b5
--3d6b6a416f9b5
Content-Type: application/octet-stream
Content-Range: bytes 0-999/2000
<octet stream data 1>
--3d6b6a416f9b5
Content-Type: application/octet-stream
Content-Range: bytes 1000-1999/2000
<octet stream data 2>
--3d6b6a416f9b5
Content-Type: application/json
Content-Range: bytes 0-441/442
<json data>
--3d6b6a416f9b5
Content-Type: text/html
Content-Range: bytes 0-543/544
<html string>
--3d6b6a416f9b5--</code></pre>
You get the idea. The first two are of the same binary data split into two streams, the third is a JSON string sent in one stream and the fourth is a HTML string sent in one stream.
In your case, you are sending a `File` together with your `HTML` template.
<pre><code>from io import BytesIO, StringIO
from django.http import StreamingHttpResponse
def stream_generator(streams):
boundary = "3d6b6a416f9b5"
for stream in streams:
if isinstance(stream, BytesIO):
data = stream.getvalue()
content_type = 'application/octet-stream'
elif isinstance(stream, StringIO):
data = stream.getvalue().encode('utf-8')
content_type = 'text/html'
else:
continue
stream_length = len(data)
yield f'--{boundary}\r\n'
yield f'Content-Type: {content_type}\r\n'
yield f'Content-Range: bytes 0-{stream_length-1}/{stream_length}\r\n'
yield f'\r\n'
yield data
yield f'\r\n'
yield f'--{boundary}--\r\n'
def multi_stream_response(request):
streams = [
excel_file, # The File provided in the OP. It is a BytesIO object.
StringIO(render_to_string('index.html', request=request))
]
return StreamingHttpResponse(stream_generator(streams), content_type='multipart/byteranges; boundary=3d6b6a416f9b5')</code></pre>
See this [example <sup>[stackoverflow]</sup>][1] on parsing a *multipart/byteranges* on the client.
[1]: https://stackoverflow.com/a/41351254/16770846 |
null |
null |
null |
null |
null |
null |
I have an application that uses Pub/Sub on GCP. Subscribing works without an issue however whenever I add
private final PubSubTemplate pubSubTemplate;
I get get an error that reads
Error creating bean with name 'pubSubTemplate' defined in ut.importer.eventprocessor.EventApplication: Unsatisfied dependency expressed through method 'pubSubTemplate' parameter 0: No qualifying bean of type 'com.google.cloud.spring.pubsub.core.publisher.PubSubPublisherTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
I know that the pubsubTemplate should come with the dependency but I added the bean anyway thinking it could be clashing with another dependency
@Bean
@Primary
public PubSubTemplate pubSubTemplate(PubSubPublisherTemplate pubSubPublisherTemplate,
PubSubSubscriberTemplate pubSubSubscriberTemplate) {
return new PubSubTemplate(pubSubPublisherTemplate, pubSubSubscriberTemplate);
}
However this did not work, I received the same error.
Then I tried
@Import({GcpPubSubAutoConfiguration.class})
with both imports
import org.springframework.cloud.gcp.autoconfigure.pubsub.GcpPubSubAutoConfiguration;
and
import com.google.cloud.spring.autoconfigure.pubsub.GcpPubSubAutoConfiguration;
And still received the same error.
pom.xml
<spring-cloud.version>2023.0.0</spring-cloud.version>
<spring-cloud-gcp.version>5.1.0</spring-cloud-gcp.version>
---
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>${spring-cloud-gcp.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-pubsub</artifactId>
</dependency>
< added spring gcp autoconfig but it had no effect - removed>
---
import com.google.cloud.spring.pubsub.core.PubSubTemplate;
import com.google.cloud.spring.pubsub.core.publisher.PubSubPublisherTemplate;
import com.google.cloud.spring.pubsub.core.subscriber.PubSubSubscriberTemplate;
Reading the documentation one of these above solutions should have worked. Has anyone had a similar issue or any suggestions on something else to try? |
Getting right answer on console.log but return function not giving right answer |
Setting up the `android:paddingEnd="0dp"` parameter on Spinner xml tag solved my issue.
Now the dropdown items list takes the width equal to the Spinner's whole width including it's dropdown arrow. |
{"OriginalQuestionIds":[4660142],"Voters":[{"Id":14868997,"DisplayName":"Charlieface","BindingReason":{"GoldTagBadge":"c#"}}]} |
How about dynamically creating a regular expression based on the user's input and using it to parse and format the matching parts of the suggestions:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
const searchBar = document.querySelector('#search-bar');
const searchList = document.querySelector('#search-list');
searchBar.addEventListener('click', () => {
searchList.style.display = "block";
});
const updateListState = e => {
const targetId = e.target.id;
if (targetId !== 'search-bar' && targetId !== 'search-list' && targetId !== 'search-bar-filler' && targetId !== 'search-bar-container' && targetId !== 'search-item-names' && targetId !== 'search-submit' && targetId !== 'search-submit-container') {
searchList.style.display = "none";
}
}
document.addEventListener('mousemove', updateListState);
function search_items() {
let input = document.getElementById('search-bar').value;
input = input.toLowerCase();
let x = document.getElementsByClassName('search-item-names');
const regex = new RegExp(input, 'gi');
for (let i = 0; i < x.length; i++) {
let originalText = x[i].getAttribute('data-original-text');
if (!originalText) {
originalText = x[i].textContent;
x[i].setAttribute('data-original-text', originalText);
}
if (!originalText.toLowerCase().includes(input)) {
x[i].style.display = "none";
} else {
x[i].style.display = "list-item";
const formattedText = originalText.replace(regex, match => `<b>${match}</b>`);
x[i].innerHTML = formattedText;
}
}
}
document.getElementById('search-bar').addEventListener('input', function () {
if (this.value === '') {
search_items();
}
});
<!-- language: lang-css -->
#filler {
position: absolute;
background-color: red;
width: 20px;
height: 20px;
}
#search-list {
margin-top: 20px;
width: 150px;
height: 150px;
display: none;
}
<!-- language: lang-html -->
<div id="search-bar-container">
<input id="search-bar" type="text" name="search" onkeyup="search_items()" placeholder="Search items..">
<div id="search-bar-filler"></div>
<div id='search-list'>
<div id="search-item-names" class="search-item-names">Automotive Degreaser</div>
<div id="search-item-names" class="search-item-names">Beats by Dre</div>
<div id="search-item-names" class="search-item-names">JBL Partybox</div>
<div id="search-item-names" class="search-item-names">Makeup</div>
<div id="search-item-names" class="search-item-names">Mr Potato Head</div>
<div id="search-item-names" class="search-item-names">Olympus Camera</div>
<div id="search-item-names" class="search-item-names">Pillow</div>
<div id="search-item-names" class="search-item-names">RC Race Car</div>
<div id="search-item-names" class="search-item-names">Simon Rabbit</div>
<div id="search-item-names" class="search-item-names">Truth Hoodie</div>
</div>
</div>
<!-- end snippet -->
|
|python|job-scheduling|or-tools|cp-sat| |
I'm trying to write a simple parser for some yml config files (with serde) which involves some additional parsing for custom formats inside many params. My additional parsers are based on simple Regex'es, and I created a registry so that they are "compiled" only once. The registry is essentially a ```HashMap<String, _>```.
Now of course the method registering a Regex first checks if the same was already inserted, by means of the ```HashMap::entry()``` method.
Problem is, if I write something like this:
```
fn register_pattern(&mut self, pattern: &str) {
if let Vacant(entry) = self.regex_registry.entry(pattern.to_string()) {
let asc = self.parse_locale_pattern(pattern.to_string(), ParseLocale::Ascii);
let jap = self.parse_locale_pattern(pattern.to_string(), ParseLocale::Japanese);
let parse_localized_regex = ...expression involving asc, jap...;
}
}
```
...the compiler yells at me like this:
```
error[E0499]: cannot borrow `*self` as mutable more than once at a time
--> src/parsing/parsers/parser_service.rs:65:23
|
63 | if let Vacant(entry) = self.regex_registry.entry(pattern.to_string()) {
| ------------------- first mutable borrow occurs here
64 | let asc = self.parse_locale_pattern(pattern.to_string(), ParseLocale::Ascii);
65 | let jap = self.parse_locale_pattern(pattern.to_string(), ParseLocale::Japanese);
| ^^^^ second mutable borrow occurs here
66 | let parse_localized_regex = ParseLocalized::new(asc, jap);
67 | entry.insert(parse_localized_regex);
| ----- first borrow later used here
```
The solution I've found works, but seems too complex to me:
```
fn register_pattern(&mut self, pattern: &str) {
if let Vacant(_) = self.regex_registry.entry(pattern.to_string()) {
let asc = self.parse_locale_pattern(pattern.to_string(), ParseLocale::Ascii);
let jap = self.parse_locale_pattern(pattern.to_string(), ParseLocale::Japanese);
if let Vacant(entry) = self.regex_registry.entry(pattern.to_string()) {
entry.insert(ParseLocalized::new(asc, jap));
}
}
}
``` |
Rust - mutable borrow problem with inserting Vacant entry into HashMap |
|rust|borrow-checker| |
1.at first register `@nuxtjs/tailwindcss` in nuxt.config.ts|js by putting module array.
2.back to the project and create `main.css` in this directory => `assets/css/main.css` then import your font in this file like this:
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: normal;
src: url('../css/Font/Montserrat-Regular.ttf') format('ttf');
}
3.then register this file in Nuxt configuration by adding `css` property:
// nuxt.config.ts
export default defineNuxtConfig({
css: [
'@/assets/css/main.css',
],
modules: [
'@nuxtjs/tailwindcss',
],
});
4.then change your tailwind configuration to this:
/** @type {import('tailwindcss').Config} */
export default {
content: [],
theme: {
extend: {
fontFamily: {
sans: ['Montserrat', 'sans-serif']
}
},
},
}
|
I'm having trouble correctly rendering my quarto document to HTML - it renders, but my tables aren't appearing. I'm using `DT::datatable()` because I want to have the flexibility to sort/filter rows - there isn't the same problem if I render using `kable`.
I have data from a large survey and I want to create a document that contains the question as a heading, followed by summary tables for that question, and then subheadings and summaries breaking down responses to that question by each demographic.
To simplify for now, I'm just looking at how to get the subheadings and demographic summaries for one question.
So far I've tried the following:
```
for (i in 1:length(test_list)){
cat(sprintf("\n#### %s\n", attributes(test_data[[names(test_list[[i]][1])]])$label))
if (is.null(test_list[[i]])){
next}else{
print(test_list[[i]] |> DT::datatable(rownames = F, escape = F))
}
}
```
I also tried the same without using `print()`, and attempted to use `htmltools` to get the raw code for the tables - this printed but I couldn't figure out how to get that raw code to render so just ended up with raw code under headings. ChatGPT recommended saving each table and then printing that but since it's such a large dataset this isn't really an option.
Here is the example data:
```
test_list <- list(structure(list(Q1 = structure(c(1L, 2L, 3L, NA), levels = c("A",
"B", "C"), label = "Label 1", class = "factor"),
N = c(67L, 28L, 6L, 20L), Mean = c(1, 1, NaN, NaN), SD = c(0,
0, NA, NA), `ResponseY` = c(2.99, 7.14, NA, NA), `NA` = c(97.01,
92.86, 100, 100)), class = "data.frame", row.names = c(NA,
-4L)), structure(list(Q2 = structure(c(1L, 2L, NA), levels = c("D",
"E"), label = "Label 2", class = "factor"),
N = c("98", "Insufficient number of responses",
"21"), Mean = c(1, NA, NaN), SD = c(0, NA, NA), `ResponseY` = c(4.08,
NA, NA), `NA` = c(95.92, NA, 100)), class = "data.frame", row.names = c(NA,
-3L)), structure(list(Q3 = structure(c(1L, 2L, 3L, 4L, 5L, 6L,
NA), levels = c("F_", "G", "H", "I", "J",
"K"), label = "Label 3", class = "factor"),
N = c("Insufficient number of responses",
"25", "33", "24", "11", "Insufficient number of responses",
"23"), Mean = c(NA, 1, 1, NaN, NaN, NA, NaN), SD = c(NA,
0, NA, NA, NA, NA, NA), `ResponseY` = c(NA, 12, 3.03,
NA, NA, NA, NA), `NA` = c(NA, 88, 96.97, 100, 100, NA, 100
)), class = "data.frame", row.names = c(NA, -7L)))
test_data <- structure(list(Q1 = structure(c(2, 2, 1, 1, 2, 2), labels = c(A = 1,
B = 2, C = 3), label = "Label 1", class = c("haven_labelled",
"vctrs_vctr", "double")), Q2 = structure(c(1, 1, 1, 1, 1, 1), labels = c(D = 1,
E = 2), label = "Label 2", class = c("haven_labelled", "vctrs_vctr",
"double")), Q3 = structure(c(3, 3, 2, 2, 4, 4), labels = c(F_ = 1,
G = 2, H = 3, I = 4, J = 5, K = 6), label = "Label 3", class = c("haven_labelled",
"vctrs_vctr", "double"))), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
```
This is an example of the output format I'm looking for:
[![enter image description here][1]][1]
Which was achieved with:
```
cat(sprintf("\n#### %s\n", attributes(test_data[[names(test_list[[1]][1])]])$label))
test_list[[1]] |> DT::datatable(options = list(pageLength = 10), rownames = F, escape = F)
cat(sprintf("\n#### %s\n", attributes(test_data[[names(test_list[[2]][1])]])$label))
test_list[[2]] |> DT::datatable(options = list(pageLength = 10), rownames = F, escape = F)
cat(sprintf("\n#### %s\n", attributes(test_data[[names(test_list[[3]][1])]])$label))
test_list[[3]] |> DT::datatable(options = list(pageLength = 10), rownames = F, escape = F)
```
I just need to get it working in the for loop.
EDIT:
-----
Through sheer luck I've managed to get the tables to appear with the following code, though it's also giving me a bunch of text that I don't want:
```
for (i in 1:length(test_list)){
cat(sprintf("\n#### %s\n", attributes(test_data[[names(test_list[[i]][1])]])$label))
print(htmltools::renderTags(DT::datatable(test_list[[i]])))
}
```
[1]: https://i.stack.imgur.com/NhWzY.png |
url :-> `https://www.greenblottmetal.com/scrap-metal-prices`
problem is :->
<iframe>---> #document(another url) ---> new <html> <table></table> </html>
after inspect data avilable into <iframe> tag and inside iframe there is #document is there this is subtype of iframe and holding url inside "()" and holding <html>...<table>.....</table></html> I want to scrap data from table but not able to read from Beautifoup library object data from this url and its html content please help for more visit url : `https://www.greenblottmetal.com/scrap-metal-prices`
data showing on webpage after inspect
<html>
<head>
</head>
<body>
<iframe class="nKphmK" title="Table Master" aria-label="Table Master" scrolling="no" src="https://wix-visual-data.appspot.com/index?pageId=ee1kv&compId=comp-iokfptn7&viewerCompId=comp-iokfptn7&siteRevision=148&viewMode=site&deviceType=desktop&locale=en&regionalLanguage=en&width=569&height=2957&instance=J_m2kTqVpMO94dlz4vhUuD232Kbag0irUNTSTGpGJmM.eyJpbnN0YW5jZUlkIjoiNDJjNzg3YWYtOTgwYi00MWNlLThmMGQtMjgxMzhmMDVkOTY5IiwiYXBwRGVmSWQiOiIxMzQxMzlmMy1mMmEwLTJjMmMtNjkzYy1lZDIyMTY1Y2ZkODQiLCJtZXRhU2l0ZUlkIjoiZTBmNDk5MWQtN2MxNS00ODU5LWIyYjktMzllZThhMDljZWRjIiwic2lnbkRhdGUiOiIyMDI0LTAzLTI4VDA3OjQxOjU4LjY5N1oiLCJkZW1vTW9kZSI6ZmFsc2UsImFpZCI6IjdmNGVhMTVkLTcxMzctNGZjOC05YzAwLWUwMmNmNDE3YTAwOSIsImJpVG9rZW4iOiJhMjMzMWViMi1lNDFlLTA5OTctM2RiNC0xMWZkMDUwYzE3YjUiLCJzaXRlT3duZXJJZCI6ImI0NmJjNTExLTVlMzYtNDQ3NS05NjEzLWFhNzhmZGVkYzRiZSJ9&commonConfig=%7B%22brand%22%3A%22wix%22%2C%22host%22%3A%22VIEWER%22%2C%22bsi%22%3A%2221aec005-387a-4cdb-bc29-79c09bd8fb5a%7C1%22%2C%22BSI%22%3A%2221aec005-387a-4cdb-bc29-79c09bd8fb5a%7C1%22%7D&currentRoute=.%2Fscrap-metal-prices&vsi=236d7927-567f-4b22-bd97-6cea740fe681" allowfullscreen="" allowtransparency="true" allowvr="true" frameborder="0" allow="autoplay;camera;microphone;geolocation;vr">
#document (https://wix-visual-data.appspot.com/index?pageId=ee1kv&compId=comp-iokfptn7&viewerCompId=comp-iokfptn7&siteRevision=148&viewMode=site&deviceType=desktop&locale=en®ionalLanguage=en&width=569&height=2957&instance=J_m2kTqVpMO94dlz4vhUuD232Kbag0irUNTSTGpGJmM.eyJpbnN0YW5jZUlkIjoiNDJjNzg3YWYtOTgwYi00MWNlLThmMGQtMjgxMzhmMDVkOTY5IiwiYXBwRGVmSWQiOiIxMzQxMzlmMy1mMmEwLTJjMmMtNjkzYy1lZDIyMTY1Y2ZkODQiLCJtZXRhU2l0ZUlkIjoiZTBmNDk5MWQtN2MxNS00ODU5LWIyYjktMzllZThhMDljZWRjIiwic2lnbkRhdGUiOiIyMDI0LTAzLTI4VDA3OjQxOjU4LjY5N1oiLCJkZW1vTW9kZSI6ZmFsc2UsImFpZCI6IjdmNGVhMTVkLTcxMzctNGZjOC05YzAwLWUwMmNmNDE3YTAwOSIsImJpVG9rZW4iOiJhMjMzMWViMi1lNDFlLTA5OTctM2RiNC0xMWZkMDUwYzE3YjUiLCJzaXRlT3duZXJJZCI6ImI0NmJjNTExLTVlMzYtNDQ3NS05NjEzLWFhNzhmZGVkYzRiZSJ9&commonConfig=%7B%22brand%22:%22wix%22,%22host%22:%22VIEWER%22,%22bsi%22:%2221aec005-387a-4cdb-bc29-79c09bd8fb5a%7C1%22,%22BSI%22:%2221aec005-387a-4cdb-bc29-79c09bd8fb5a%7C1%22%7D¤tRoute=.%2Fscrap-metal-prices&vsi=236d7927-567f-4b22-bd97-6cea740fe681)
<html>
<head></head>
<body class="js-focus-visible">
<div id="appContainer">
<section class="main-content ng-scope" ng-if="!main.hasError" ng-class="{'show-sortable': main.settings.tableParams.sortable}">
<div footable="" class="direction-right" style="height: 100%; width:100%; display: block" data-settings="main.settings" data-instance-id="main.instanceId" data-comp-id="main.compId" data-fixed-height="main.isFixedHeight()" data-filter-position="main.getFilterPosition()"><!-- ngIf: fixedHeight -->
<!-- ngIf: !fixedHeight --><div class="adjust-height-view ng-scope" adjust-height-view="" ng-if="!fixedHeight"><section style="width:100%;" ng-show="settings.tableParams.showHeaderFooter && !isEmptyTable" class="ng-hide">
<table id="filterTable" class="filter outerBorder" style="width:100%;" ng-class="{'mobile':isMobile}">
<thead>
<tr>
<th colspan="100%">
<div id="filterBox" ng-show="settings.tableParams.filter" class="ng-hide"></div>
</th>
</tr>
</thead>
</table>
</section>
<div id="tableWrapper" style="min-height: 2757px; height: 100%;">
<table id="theTable" style="width: 100%; display: table; height: 100%;" dir="auto" data-paging="false" data-cascade="true" data-filter-min="3" data-paging-size="5" data-useparentwidth="true" data-filter-container="#filterBox" data-filter-connectors="false" data-use-parent-width="false" data-sorting="" data-filtering="" data-filter-filters="[]" data-filter-placeholder="Search" data-filter-position="right" data-show-header="true" ng-class="{'empty-table':isEmptyTable}" class="footable table outerBorder footable-1 breakpoint-x-small"><thead><tr class="footable-header"><th class="wixColumns footable-first-visible" style="display: table-cell;">COPPER & BRASS</th><th class="wixColumns footable-last-visible" style="display: table-cell;"></th></tr></thead><tbody><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">#1 Bare Bright Wire </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$3.10/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">#1 Copper Tubing / Flashing </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$3.00/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">#2 Copper Tubing / Bus Bar </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.75/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">#3 Roofing Copper </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.40/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Brass (Plumbing, Pipe) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.15/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Red Brass or Bronze </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.25/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Brass Shells </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.15/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Brass Water Meter </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.15/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Clean Brass Auto Radiators </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.00/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum/Copper Coil (Clean) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$1.48/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum/Copper Coil (Dirty) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$.85/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;"> </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">COPPER BEARING MATERIAL </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Copper Transformers </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.30/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Electric Motors </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.30/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Alternators/Starters </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.22/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Sealed Units/Compressors </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.25/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;"> </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">INSULATED COPPER WIRE </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Insulated Copper Wire (Cat 5/6) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.85/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">THHN Cable </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$1.55/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">500-750 MCM (Bare Bright Inside) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$1.70/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Hollow Heliax Wire </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$1.10/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Romex Wire </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$1.35/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Insulated Cable </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.55/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Steel BX </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.45/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum BX </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.90/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">low grade insulated wire 30% </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.45/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;"> </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">ALUMINUM </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum Siding </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.47/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Sheet Aluminum </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.47/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum Rims </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.74/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum Truck Rims </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.47/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum Chrome Rims </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.47/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum Windows frames </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.47/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Cast Aluminum </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.42/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Bare Aluminum Wire </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.57/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">AL Thermo-pane/break (Not Glass) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.47/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">AL Litho Plates </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.60/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">AL Machine Cuts </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.60/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Aluminum Transformers </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.06/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">AL Turnings </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.18/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Unprepared aluminum </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> $0.40/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Irony aluminum </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> $0.11/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;"> </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">MISCELLANEOUS SCRAP </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Car Batteries </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.17/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Steel Case Battery (forklift) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.12/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Lead </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.50/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">304 Stainless Steel (Non-Magnetic) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.35/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">316 Stainless Steel (Non-Magnetic) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.65/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Lead Wheel Weights </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.10/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Ballasts </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.06/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Scrap Generators </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.06/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Catalyic Converter </td><td class="wixColumns footable-last-visible" style="display: table-cell;">Prices Vary </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;"> </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">STEEL & IRON </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Short Steel </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$225/G.t. ($0.10/lb) </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Light Iron & Tin & appliances </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$ 160/G.t. ($0.07/lb) </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Cast Iron </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$ 225/G.t. ($0.10/lb) </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Plate & Structural </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$ 235/G.t. ($0.10/lb) </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Unprepared steel torching </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> $ 160/G.t. ($0.07/lb) </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Unprepared steel shearing </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> $ 215/g.t. ($.095/lb) </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;"> </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">COMPUTER SCRAP </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Motherboards </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$.60/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Power Supplies (w/Wires) </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.05/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Harddrive PC Board </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.10/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Telecom Equipment </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.07-$0.25/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Servers </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.07-$0.25/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;"> </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">RARE EARTH METALS </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Carbide Inserts/Shapes </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.00-$8.50/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Monel </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$2.00-$2.80/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Titanium </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.40/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Nickel </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$3.00 and up </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;">Inconel </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$ 2.50/lb </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">Tin Solder </td><td class="wixColumns footable-last-visible" style="display: table-cell;">$0.40-$3.00/lb </td></tr><tr class="footableOdd"><td class="wixColumns footable-first-visible" style="display: table-cell;"> </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr><tr class="footableEven"><td class="wixColumns footable-first-visible" style="display: table-cell;">PRICES SUBJECT TO CHANGE WITHOUT NOTICE ... </td><td class="wixColumns footable-last-visible" style="display: table-cell;"> </td></tr></tbody></table>
</div>
<section style="width:100%;margin:0;">
<table id="pagerFilter" class="footable footer outerBorder ng-hide" style="width: 100%; margin: 0px;" ng-show="settings.tableParams.showHeaderFooter">
<tfoot id="noPager">
<tr>
<td colspan="100%" style="height:26px;"></td>
</tr>
</tfoot>
</table>
</section>
</div><!-- end ngIf: !fixedHeight -->
</div>
</section>
</div>
</body>
</html>
</iframe>
</body>
</html>
I have tried using beautifoup libray in python but <iframe> tag hold only below data for iframe is
<iframe class="nKphmK" title="Table Master" aria-label="Table Master" scrolling="no" src="./Scrap Metal Prices _ Greenblott Metal Co. _ Binghamton, NY_files/index.html" allowfullscreen="" allowtransparency="true" allowvr="true" frameborder="0" allow="autoplay;camera;microphone;geolocation;vr"></iframe>
for data for either for #document nor for table inside #document. |
Try this:
from keras import Sequential
from keras.layers import Conv2D, ReLU, BatchNormalization
model = Sequential(
[
Conv2D(filters=10, kernel_size=3, strides=1)
BatchNormalization()
ReLU()
]
) |
In my Zephyr DTS binding I have a node with a given compatibility, let's call it `my_compatibilty`, with an optional property of type `phandles`, let's call it `things`, allowed to have up to two elements. In my driver code I can build up an array of the leaves of this tree; for instance, I can make an array of the values of a string entry `flibble` within `things`, or `NULL` if not present, for all compatible nodes with:
```
#define GET_THINGS_LIST(i, name) {DT_PROP_BY_PHANDLE_IDX_OR(i, things, 0, name, NULL), \
DT_PROP_BY_PHANDLE_IDX_OR(i, things, 1, name, NULL)},
static const char *const leafValueFlibble[][2] = {
DT_FOREACH_STATUS_OKAY_VARGS(my_compatibilty, GET_THINGS_LIST, flibble)
};
```
This is now easy to manage, a nice ordered list I can work with from C.
HOWEVER, I now need `flibble` to be a `phandle`-type property. How do I extend the macrobatics above so that I can still get at the leaves of the tree, i.e. for all compatible nodes, create arrays of the values of the named properties within `flibble` (or `NULL`/`-1`/`some-known-value` if not present to keep the order)? |
If the packageManger field in package.json is not specified, Corepack will download the **global** version of the package manager that Corepack is configured with (Corepack also calls these 'Known Good Releases'). To use a different version of yarn, you can either:
- Set the packageManger field in your project's package.json to your preferred version (e.g. `"packageManger": "yarn@4.1.1"`), then run `yarn` to install the dependencies using that package manager version.
- Update Corepack's Known Good Release for yarn with `corepack up -g yarn@4.1.1`.
----------
## Links
- Useful issue on the Corepack Github discussing upgrading globally installed package managers: https://github.com/nodejs/corepack/issues/395
- Known Good Releases Corepack documentation: https://github.com/nodejs/corepack?tab=readme-ov-file#known-good-releases |
I'm trying to set up a Nginx reverse proxy and I'm slowly losing my mind trying to figure it out.
I have my Nginx server listening at 80, and it performs great. I have a page with a form where I want to be able to send `.json` POSTs from that page to a Python HTTP server that can process the requests. I have the server at port 8000.
On the website, I want to be able to reach the server by navigating to `<IP>:/sub/folder/` so that I can send the `.json` POSTs from my `<IP>:/sub/index.html` page by making a simple relative request to `./folder`.
When I send a curl to `<IP>:8000`, I reach the server and get the correct response.
I have tried to set up Nginx `proxy_pass` with the following configuration:
location /sub/folder/ {
proxy_pass http://127.0.0.1:8000/;
}
This results in a 301 which sends me from `<url>/sub/folder` to `/sub/folder/`, followed by a 404 at `/sub/folder/`.
If I go back to the Nginx config and turn `/sub/folder/` into `/sub/folder`, navigating to `<url>/sub/folder` returns a 404.
I've tried using `https`, I've tried changing out `127.0.0.1` for `localhost`, I've tried removing the final `/` in the `proxy_pass` line, I've tried proxying to `https://<IP>:<port>/sub/folder` even though the HTTP server is at root, among more.
|
null |
I have a problem with `drop_na()` function. I wanted to clean the dataset and erase the "NA" values, but when I entered the code, all datas are disseapperad. I do not understand why it happens.
You can see clearly what my codes are in this picture:
[![enter image description here][1]][1]
```
library(tidyverse)
WDI_GNI<read_csv("C:/Users/sudes/Downloads/P_Data_Extract_From_World_Development_Indicators/a7b778c6-9827-4c45-91b7-8f497087ca17_Data.csv")WDI_GNI <- WDI_GNI %>%
mutate(across(contains("[YR"),~na_if(.x, ".."))) %>%
mutate(across(contains("[YR"), as.numeric))
WDI_GNI <- drop_na(WDI_GNI)
```
[1]: https://i.stack.imgur.com/lbgDg.png |
Okay, so I have fixed it!
Here is my updated, and completely rewritten code:
/* Reset margins and padding */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Main wrapper for the layout */
.wrapper {
display: flex;
justify-content: space-between;
height: 100vh;
padding: 16px;
background: #806c50;
}
/* Common styles for sidebars and main content */
.container {
background-color: #806c50;
overflow-y: auto;
}
/* Styles for the left sidebar */
.sidebar-left {
flex: 1;
margin-right: 10px;
}
/* Styles for the main content area */
.main-content {
flex: 3;
margin-right: 10px;
}
/* Styles for the right sidebar */
.sidebar-right {
flex: 1;
}
/* Apply the borders */
.container {
border-style: solid;
border-width: 16px;
border-image-source: url('/static/border.png');
border-image-slice: 30 fill;
border-image-width: 16px;
border-image-outset: 0;
border-image-repeat: stretch;
}
/* Responsive design adjustments for smaller screens */
@media (max-width: 768px) {
.wrapper {
flex-direction: column; /* Stack containers vertically on small screens */
}
.sidebar-left,
.sidebar-right {
order: 1; /* Put sidebars after main content on small screens */
margin-right: 0;
margin-bottom: 10px;
}
.main-content {
order: 0;
margin-right: 0;
}
}
Here's my index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My RPG Game</title>
<link
rel="stylesheet"
href="{{ url_for('static', filename='style.css') }}"
/>
</head>
<body>
<div class="wrapper">
<div class="container sidebar-left">
<!-- Character's location and stats go here -->
</div>
<div class="container main-content">
<div class="chat">
<!-- Chat content goes here -->
</div>
<div class="inventory">
<!-- Inventory list goes here -->
</div>
<!-- Add additional sections as needed -->
</div>
<div class="container sidebar-right">
<!-- Additional information or ads could go here -->
</div>
</div>
<script src="{{ url_for('static', filename='script.js') }}"></script>
</body>
</html>
While it's not perfect yet, I think I now understand how to do what I need to do.
|
Why array find returns nothing? using context and params |
|reactjs|react-hooks|fetch-api|react-context| |
null |
```
static double CalculateMontlyRepayment(double loanAmount, double annualInterestRate, int loanTermYears)
{
//convert yearly interest into monthly interest.
double monthlyInterestRate = annualInterestRate / 12.0;
//Figure out number of monthly payments.
int loanTermMonths = loanTermYears * 12;
//The formula to get the monthly payment amount.
double monthlyPayment = loanAmount * (monthlyInterestRate * Math.Pow(1 + monthlyInterestRate, loanTermMonths)) /
(Math.Pow(1 + monthlyInterestRate, loanTermMonths) - 1);
return monthlyPayment;
}
```
I could do it on a piece of paper but translating it into code is something I'm struggling with. Even tried using AI but it just made it worse.
|
Can't figure out to properly implement formula to get monthly payment for a mortgage into C# |
|c#|finance| |
null |
{"Voters":[{"Id":4657412,"DisplayName":"DavidW"}]} |
I have a List of class/objects and I need to get a random item from the list. In a particular case I need to take a random item from a specific range OR a specific index. Meaning it's not just a
Item item = List[Random.Next(2,10)]; //take one random item between index 2 and index 9
(to make an example) but I'd need something like "the random value must be between 2 and 9 (like in the example) OR be 15". I just need to add also the index 15 to the random range. Is there a simple way to do this without creating a new List that comprehends the range items and the other one? Always for that matter, is there a way to exclude some values from the base range (2,9)? |
C# Random getting vakue from a range or a specific value |
|c#|list|random| |
So I have a grid of 12 buttons with a set of 12 divs. when i click button 1 div 1 appears ! correct. however when i click button 2 div 2 appears, great. However button one still exists. How do I make it so that when i click button 2 div 1 is display none and div 2 is displaying.
Below is what I have tried, I have thought about adding the remove class to every click function for every div if that makes sense.
```
<script>
document.addEventListener('DOMContentLoaded', function() {
jQuery(function($){
$('.clicktoshow').click(function(){
if($('.service-wrapper-box').hasClass('showclick')){
$('.service-wrapper-box').removeClass('showclick')
}else{
$('.service-wrapper-box').addClass('showclick')
}
});
});
jQuery(function($){
$('.clicktoshow2').click(function(){
if($('.service-wrapper-box2').hasClass('showclick2')){
$('.service-wrapper-box2').removeClass('showclick2')
}else{
$('.service-wrapper-box2').addClass('showclick2')
}
});
});
jQuery(function($){
$('.clicktoshow3').click(function(){
if($('.service-wrapper-box3').hasClass('showclick3')){
$('.service-wrapper-box3').removeClass('showclick3')
}else{
$('.service-wrapper-box3').addClass('showclick3')
}
});
});
jQuery(function($){
$('.clicktoshow4').click(function(){
if($('.service-wrapper-box4').hasClass('showclick4')){
$('.service-wrapper-box4').removeClass('showclick4')
}else{
$('.service-wrapper-box4').addClass('showclick4')
}
});
});
jQuery(function($){
$('.clicktoshow5').click(function(){
if($('.service-wrapper-box5').hasClass('showclick5')){
$('.service-wrapper-box5').removeClass('showclick5')
}else{
$('.service-wrapper-box5').addClass('showclick5')
}
});
});
jQuery(function($){
$('.clicktoshow6').click(function(){
if($('.service-wrapper-box6').hasClass('showclick6')){
$('.service-wrapper-box6').removeClass('showclick6')
}else{
$('.service-wrapper-box6').addClass('showclick6')
}
});
});
jQuery(function($){
$('.clicktoshow7').click(function(){
if($('.service-wrapper-box7').hasClass('showclick7')){
$('.service-wrapper-box7').removeClass('showclick7')
}else{
$('.service-wrapper-box7').addClass('showclick7')
}
});
});
jQuery(function($){
$('.clicktoshow8').click(function(){
if($('.service-wrapper-box8').hasClass('showclick8')){
$('.service-wrapper-box8').removeClass('showclick8')
}else{
$('.service-wrapper-box8').addClass('showclick8')
}
});
});
jQuery(function($){
$('.clicktoshow9').click(function(){
if($('.service-wrapper-box9').hasClass('showclick9')){
$('.service-wrapper-box9').removeClass('showclick9')
}else{
$('.service-wrapper-box9').addClass('showclick9')
}
});
});
jQuery(function($){
$('.clicktoshow0').click(function(){
if($('.service-wrapper-box0').hasClass('showclick0')){
$('.service-wrapper-box0').removeClass('showclick0')
}else{
$('.service-wrapper-box0').addClass('showclick0')
}
});
});
jQuery(function($){
$('.clicktoshow1').click(function(){
if($('.service-wrapper-box1').hasClass('showclick1')){
$('.service-wrapper-box1').removeClass('showclick1')
}else{
$('.service-wrapper-box1').addClass('showclick1')
}
});
});
jQuery(function($){
$('.clicktoshow10').click(function(){
if($('.service-wrapper-box10').hasClass('showclick10')){
$('.service-wrapper-box10').removeClass('showclick10')
}else{
$('.service-wrapper-box10').addClass('showclick10')
}
});
});
});
</script>
<style>
.clicktoshow, .clicktoshow2, .clicktoshow3, .clicktoshow4, .clicktoshow5, .clicktoshow6, .clicktoshow7, .clicktoshow8, .clicktoshow9, .clicktoshow0, .clicktoshow1, .clicktoshow10{
cursor: pointer;
}
.showclick, .showclick2, .showclick3, .showclick4, .showclick5, .showclick6, .showclick7, .showclick8, .showclick9, .showclick0, .showclick1, .showclick10{
display: flex !important;
}
.service-wrapper-box, .service-wrapper-box2, .service-wrapper-box3, .service-wrapper-box4, .service-wrapper-box5, .service-wrapper-box6, .service-wrapper-box7, .service-wrapper-box8, .service-wrapper-box9, .service-wrapper-box0, .service-wrapper-box1, .service-wrapper-box10{
display: none;
}
</style>
<body>
<div class="clicktoshow"> CLick to show</div>
<div class="clicktoshow2"> click to show</div>
<div class=".service-wrapper-box" style="background-color:red;"></div>
<div class="service-wrapper-box2" style="background-color:blue;"></div>
<body>
```
|
[STPyV8][1]
[1]: https://github.com/cloudflare/stpyv8
It’s the successor to PyV8, owned by Cloudflare. |
I'm currently trying to figure out what the six passcode integers are for this function. Every other example I've looked at, on this site and others, has used a "je" instruction for the first comparison, which allows us to deduce what the first integer input should be, however, the "bomb" that I'm working on seems to be using a "js" after the first comparison. I can't for the life of me figure out what the first input should be, let alone the other 5. Any help or guidance would be much appreciated.
Here is assembly for the phase_2:
```
=> 0x0000555555555474 <+0>: push %rbp
0x0000555555555475 <+1>: push %rbx
0x0000555555555476 <+2>: sub $0x28,%rsp
0x000055555555547a <+6>: mov %fs:0x28,%rax
0x0000555555555483 <+15>: mov %rax,0x18(%rsp)
0x0000555555555488 <+20>: xor %eax,%eax
0x000055555555548a <+22>: mov %rsp,%rsi
0x000055555555548d <+25>: call 0x555555555c34 <read_six_numbers>
0x0000555555555492 <+30>: cmpl $0x0,(%rsp)
0x0000555555555496 <+34>: js 0x5555555554a2 <phase_2+46>
0x0000555555555498 <+36>: mov $0x1,%ebx
0x000055555555549d <+41>: mov %rsp,%rbp
0x00005555555554a0 <+44>: jmp 0x5555555554b3 <phase_2+63>
0x00005555555554a2 <+46>: call 0x555555555bf8 <explode_bomb>
0x00005555555554a7 <+51>: jmp 0x555555555498 <phase_2+36>
0x00005555555554a9 <+53>: add $0x1,%rbx
0x00005555555554ad <+57>: cmp $0x6,%rbx
0x00005555555554b1 <+61>: je 0x5555555554c6 <phase_2+82>
0x00005555555554b3 <+63>: mov %ebx,%eax
0x00005555555554b5 <+65>: add -0x4(%rbp,%rbx,4),%eax
0x00005555555554b9 <+69>: cmp %eax,0x0(%rbp,%rbx,4)
0x00005555555554bd <+73>: je 0x5555555554a9 <phase_2+53>
0x00005555555554bf <+75>: call 0x555555555bf8 <explode_bomb>
0x00005555555554c4 <+80>: jmp 0x5555555554a9 <phase_2+53>
0x00005555555554c6 <+82>: mov 0x18(%rsp),%rax
0x00005555555554cb <+87>: xor %fs:0x28,%rax
0x00005555555554d4 <+96>: jne 0x5555555554dd <phase_2+105>
0x00005555555554d6 <+98>: add $0x28,%rsp
0x00005555555554da <+102>: pop %rbx
0x00005555555554db <+103>: pop %rbp
0x00005555555554dc <+104>: ret
0x00005555555554dd <+105>: call 0x555555555090 <__stack_chk_fail@plt>
```
I've been able to figure out that the read_six_numbers function is expecting six integers seperated by a space as input. Though, without the first correct integer input, I can't step through the function enough to examine any register values that might hold the next correct integers that the input is compared against. I'm at a loss. |
This is more a hint than a question:
The goal is to parse a command line **AND** create a useful *usage* message
code:
for arg in "$@" ; do
case "${1:-}" in
--edit) # edit file
cd "$(dirname $0)" && exec $0;;
--noN) # do NOT create 'NHI1/../tags'
let noN=1;;
--noS) # do NOT create 'HOME/src/*-latest/tags'
let noS=1;;
*) echo -e "usage: $(basename $0) options...\n$(awk '/--?\w+\)/' "$0")" && exit ;;
esac
done
this create the *usage* message:
> build_tags.bash -x
usage: build_tags.bash options...
--edit) # edit file
--noN) # do NOT create 'NHI1/../tags'
--noS) # do NOT create 'HOME/src/*-latest/tags'
the clue is that the *definition* of the *case* target is also the *documentation* of the *case* target.
|
You'd have to edit file `gradle/libs.versions.toml` and add in TOML format:
[versions]
androidx_compose_bom = '2024.03.00'
androidx_compose_uitest = '1.6.4'
androidx_media3 = '1.3.0'
# ...
[libraries]
androidx_compose_bom = { module = "androidx.compose:compose-bom", version.ref = "androidx_compose_bom" }
androidx_compose_uitest = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "androidx_compose_uitest" }
androidx_media3_exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "androidx_media3" }
androidx_media3_exoplayer_dash = { module = "androidx.media3:media3-exoplayer-dash", version.ref = "androidx_media3" }
androidx_media3_exoplayer_ui = { module = "androidx.media3:media3-exoplayer-ui", version.ref = "androidx_media3" }
# ...
As one can see, one sometimes can use the version reference for multiple entries.
And one can even bundle these (optional):
[bundles]
exoplayer = ["androidx_media3_exoplayer", "androidx_media3_exoplayer_dash", "androidx_media3_exoplayer_ui"]
Which means, you can't just copy & paste, but have to convert to TOML.<br/>
Be aware that for BOM dependencies, this only works for the BOM itself.<br/>
When there's no version number, one can use: `//noinspection UseTomlInstead`.
The names of the definitions of the default empty activity app are kind of ambiguous, since they're not explicit enough. There `androidx` should better be called `androidx_compose`, where applicable... because eg. `libs.androidx.ui` does not provide any understandable meaning (low readability), compared to `libs.androidx.compose.ui`. Proper and consistent labeling is important there.
Further reading:
- [Sharing dependency versions between projects](https://docs.gradle.org/current/userguide/platforms.html)
- [Migrate your build to version catalogs](https://developer.android.com/build/migrate-to-catalogs) |
Faced the same issue today when I updated my Kotlin version to **1.9.23**. After updating the hilt and moshi to the latest version it solved the problem.
Moshi version -> **1.15.1**
Hilt dagger version -> **2.51.1** |
{"Voters":[{"Id":2386774,"DisplayName":"JeffC"},{"Id":9214357,"DisplayName":"Zephyr"},{"Id":20292589,"DisplayName":"Yaroslavm"}]} |
in my RKE cluster(v1.3.14) there is no kube-proxy pod but kube-proxy container then how I install metallb give any solution for that
.it is possible to install without kube-proxy pod then how??
Give me solution if someone faces same issue
|
null |
{"Voters":[{"Id":21137419,"DisplayName":"Hang"}]} |
Oooookay. And what do you want to achieve with this setup? :)
Don't get me wrong but from my place it looks as if you were dispatching a job from controller, to be processed by a processor that doesn't do anything except for console.logging, but controller needs to wait until the job is done and returns some data.
Also, the code from inside a promise:
```typescript
if (jobInstance.id == job.id) {
responseData = result
job.remove()
resolve(result)
}
```
is supposed to change the `responseData` which is outside of its scope, and rather inaccessible from there, as that promise is not even executed in the context of the `sendData`, but run from within another promise function, also this is never defined, as your processor returns nothing. Plus, `job.remove()` is a promise itself.
Also you have a `if-else` clause, that says:
1. if `jobInstance.id` is equal-ish to `job.id`, then do sth,
2. in other case if we have an error, then reject,
3. in all other cases (`jobInstance.id` isn't equal-ish to `job.id`, but there's no error) - do nothing. Wait. Wait. Wait. Just wait ;)
Also a promise function with `async` inside of an `async` function that's something that might lead to many weird stuff going on. Besides, when you do `async function xyz(...) { this.requestQueue...}`, what do you mean by `this`?
---
If your intention was to withhold controller until job is finished, then mutate some data inside of the controller method, to display it to the end-user, then it's absolutely not the way. But I can't determine if that was actually your intention, so I don't know if that's the direction you're interested in :)
|
You can not send multiple responses for one single HTTP request. However, you can achieve this by using web sockets or sending a stream of data. In frontend you will need to process this stream.
def simulate_draft():
def generate_picks():
for pick, info in draft_results.items():
if team == user_team:
yield f"data: {jsonify({pick: info})}\n\n"
else:
yield f"data: {jsonify({pick: info})}\n\n"
return Response(generate_picks(), content_type='text/event-stream') |
I don't believe so. The reason why this is bad in Pandas is that it can trigger consolidation within [BlockManager](https://uwekorn.com/2020/05/24/the-one-pandas-internal.html).
Polars lacks an equivalent of BlockManager. I don't believe there's any situation where it stores two columns within the same backing Arrow array. |
My dataset is ethogram responses. I had 5 raters score the same 53 videos each. These 53 videos contain 28 different dogs. I now have a dataset consisting of 55 columns and 265 rows. The first three columns are to identify which rater has scored that ethogram and which video that ethogram is from. I have divided my ordinal and categorical data into their own subsets.
```
# Melt the data----
# Convert all non-identifier columns to character type
ordinal <- ordinal %>%
mutate(across(-c(Code, Data.Collection.Number, Assessor), as.character))
ordinal_melted_data <- ordinal %>%
pivot_longer(cols = -c(Code, Data.Collection.Number, Assessor),
names_to = "variable",
values_to = "value")
##Categorical
# Convert all non-identifier columns to character type
categorical <- categorical %>%
mutate(across(-c(Code, Data.Collection.Number, Assessor), as.character))
# Melt the data
categorical_melted_data <- categorical %>%
pivot_longer(cols = -c(Code, Data.Collection.Number, Assessor),
names_to = "variable",
values_to = "value")
```
Using my melted data I attempted to use Fleisskappa and ICC. Fleisskappa on my categorical data is giving me the incorrect number of raters and subjects, i should have 5 raters, 53 subjects. Instead I am getting 3 raters and 28 subjects.
```
# Get unique variable names from categorical_melted_data
variable_names <- unique(categorical_melted_data$variable)
# Initialize a list to store results
results <- list()
# Iterate over each variable
for (variable in variable_names) {
# Subset data for the current variable
variable_data <- categorical_melted_data[categorical_melted_data$variable == variable, ]
# Print unique raters and subjects
cat("Variable:", variable, "\n")
cat("Unique raters:", unique(variable_data$Assessor), "\n")
cat("Unique subjects:", unique(variable_data$Code), "\n")
# Create the contingency table
contingency_table <- table(variable_data$Code, variable_data$value)
# Calculate Fleiss' Kappa
fleisskappa_result <- kappam.fleiss(contingency_table)
# Store the results
results[[variable]] <- fleisskappa_result$value
}
# Print results along with raters and subjects details
for (variable in variable_names) {
cat("Variable:", variable, "\n")
# Display details on raters and subjects
cat("Number of raters:", ncol(contingency_table), "\n")
cat("Number of subjects:", nrow(contingency_table), "\n")
# Display Fleiss' Kappa value for the variable
cat("Fleiss' Kappa:", results[[variable]], "\n\n")
}
```
And just to clarify, my melted data format is 5 columns (Video Code, Assessor, Data Collection Number, variable, value)
|
I have an array list of Location objects that I want to find the max and min value of. However, when calling collections.max(listN, PopulationComparator) it gives me the minimum value whereas for collection.min() it returns the max value. The problem is resolved once changing the order to be descending, but I don't understand why this would even matter.
static class PopulationComparator implements Comparator <Location>{
public int compare(Location a, Location b){
// ascending order
if(a.getPop() > b.getPop()){
return 1;
}else if(a.getPop() < b.getPop()){
return -1;
}else{
return 0;
}
}
}
public static void main(String[] args){
Location maxArea = Collections.max(listN, new PopulationComparator());
}
|
Collections.max with custom Comparator on list |
|java|collections|interface| |
null |
SOLVED! - Assistance with sum for multiple separate rows using multiple criteria please |
I have a project with multiple configuration files, I need to be able to read a specific configuration file (`MyTest.exe.config`).
The file looks like this:
<appSettings>
<add key="Setting1" value="1.1.1.1"/>
<add key="Setting2" value="34567"/>
<add key="Setting3" value="blue"/>
<add key="Setting4" value="plastic"/>
</appSettings>
Code to read it looks like this:
try
{
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = "MyTest.exe.config";
Configuration configFile = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
var appSettings = configFile.AppSettings.Settings;
if (appSettings.Count == 0)
{
Console.WriteLine("AppSettings is empty.");
}
else
{
foreach (var key in appSettings.AllKeys)
{
Console.WriteLine("Key: {0} Value: {1}", key, appSettings[key].ToString());
}
}
}
catch (ConfigurationErrorsException)
{
Console.WriteLine("Error reading app settings");
}
But I only get the keys and no values
Output:
Key: Setting1 Value: System.Configuration.KeyValueConfigurationElement
Key: Setting2 Value: System.Configuration.KeyValueConfigurationElement
Key: Setting3 Value: System.Configuration.KeyValueConfigurationElement
Key: Setting4 Value: System.Configuration.KeyValueConfigurationElement
I also tried to get one value at a time:
try
{
String key = "Setting1";
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = "MyTest.exe.config";
Configuration configFile = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
var appSettings = configFile.AppSettings.Settings;
string result = appSettings[key].ToString();
Console.WriteLine(result);
}
catch (ConfigurationErrorsException)
{
Console.WriteLine("Error reading app settings");
}
But same thing - the output is:
System.Configuration.KeyValueConfigurationElement
Any help is greatly appreciated |
Use debounce function from npm packages which will make delay while user types then make request to API.
`
const debounceDelay = 300;
const handleDebouncedChange = debounce((event) => {
console.log('Debounced value:', event.target.value);
}, debounceDelay);
<input
type="text"
onChange={(e) => handleDebouncedChange(e)}
/>
` |
you can use keyboard shortcut shift + command + A to toggle appearance of simulator. |