StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.4/10 (10 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

most efficient way to create a flatlist table like the github commit

25 April 2024 @ 3:58 am

I'm trying to create a table thats like the github contributions horizontal scroll and data should go column down in order. <ScrollView horizontal showsHorizontalScrollIndicator={false}> <FlatList data={[...Array(100).keys()]} renderItem={({item}) => ( <SmallHistoryBlock /> )} scrollEnabled={false} numColumns={Math.ceil(100 / 7)} contentContainerStyle={{ justifyContent: 'center', paddingHorizontal: 10, }} /> </ScrollView> however if this code isnt divisible by full number, it will create a new row and add the remainder which I dont want. Is the only way to implement this is by Creating a Flatlist inside another flatlist? I dont want to do that because preformace wise its not that efficient. Any help would be appreciated!

Elastic Search nested query does not handle multiple MUST queries

25 April 2024 @ 3:58 am

I have an ES 6.5 index with the following mappings - { "hotel": { "mappings": { "hotel": { "properties": { "hotelAmenities": { "type": "nested", "properties": { "enabled": { "type": "boolean" }, "featured": { "type": "boolean" }, "key": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, "name": { "type": "text", "fields": {

SyntaxError: Unexpected token '<' when loading font with Three.js FontLoader

25 April 2024 @ 3:53 am

I'm working on a Three.js project where I need to add custom fonts. I have placed my .json font file inside a fonts folder located in the static directory. When attempting to load the font using FontLoader, the console logs an error. I've ensured the path to the .json file is correct. I am encountering a syntax error in the console, specifically an Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON. This suggests that the file being loaded is not parsed as JSON. I suspect it might be returning an HTML page instead. What might be causing this issue, and how can I resolve it? Here is the snippet of my code that loads the font: import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js'; const fontLoader = new FontLoader(); fontLoader.load( '/fonts/helvetiker_regular.typeface.json', () => { console.log('font loaded'); } ); Here is my full code:

How to solve the session pool occcupation stuck problem in Apache IoTDB?

25 April 2024 @ 3:52 am

Apache IoTDB often get stuck in SessionPool, and the system reported org.apache.iotdb.session.pool.SessionPool: current occupied size 50, queue size 0, considered size 50. After this information, the system also mentioned that SessionPool has wait for 60 seconds to get a new connection. I checked the official guide and did not find any relevant instruction for this kind of message. Please ask me how to set and configure the parameters for this kind of problem?

How to convert a Series of Strings into an Array or Vec of Strings

25 April 2024 @ 3:52 am

I'm having a hard time converting a Series of strings into an array to iterate in a for loop. Each item in the Series should be passed to the lit expression, to limit the DataFrame on the specific date. Then, the DataFrames are converted into an ndarray for matrix alg, then passed into a new DataFrame that is pushed & collected into a Vec. Here is what I'm trying to do when trying to iterate let dates = &unique_dates["date"]; This will return an error on lit(date) which requires a bound (not being passed as a string). When printing the first iteration, this will return String("2023-02-02") instead of "2023-02-02" #[pyfunction] fn factor_returns(pydf: PyDataFrame, endog: Vec) -> PyResult { let endog_str: Vec<&str> = endog.iter().map(|s| s.as_str()).collect(); let df: DataFrame = pydf.into(); let unique_dates = df.clone() .lazy() .

openpyxl vs pywin32 vs others libraries: copy and paste the value of cells containing the =IMAGE() in Excel

25 April 2024 @ 3:51 am

I'm trying to copy and paste the values of cells containing the formula =IMAGE(Url) in Excel. The result is an image embedded in the cell and no longer linked to the Url. I am able to do it with pywin32 with the following script: ws.Range(f"C2:C{last_row}").PasteSpecial(Paste=win32.constants.xlPasteValues) Given my goal to automate the entire script within an Azure Function App, I understand that pywin32 isn't the ideal solution? Is there an equivalent of the above script using openpyxl or another library? Thanks!

cross entropy loss is over 100 it's crazy

25 April 2024 @ 3:50 am

I tried to train sequential (LSTM and GRU) models to predict the chemical structure of drugs for drug discovery process. I got very large cross entropy loss (>100). The input to the model is SMILES string of chemical structures encoded as a one-hot encoded array. I tried to change parameters like number of epochs, learning rate, played with train/test data split, etc., and also tried to add more layers to the model but the cross-entropy loss still doesn't drop below 100. What do you think it is? I'm stuck guys

JupyterLab, TypeError: getOwnMetadataKeys is not a function

25 April 2024 @ 3:45 am

I’m currently developing an extension for JupyterLab. As part of this process, I’m utilizing the InversifyJS library from npm. To use it, I have to import ‘reflect-metadata’ in my index.ts file, which I have done. However, when I create an injectable class and use it in my extension, I encounter the following error: TypeError: getOwnMetadataKeys is not a function at Object.isProviderFor (Reflect.js:1135:1) at getProviderNoCache (Reflect.js:941:1) at Object.getProvider (Reflect.js:955:1) at GetMetadataProvider (Reflect.js:1158:1) at OrdinaryDefineOwnMetadata (Reflect.js:611:1) at decorator (Reflect.js:195:1) at DecorateConstructor (Reflect.js:549:1) at Reflect.decorate (Reflect.js:143:1) at push.../shared/components/localTelemetry.ts.__decorate (icons.ts:4:72) at ../shared/components/localTelemetry.ts (localTelemetry.ts:7:28) This is part of my code @injectable() export class LocalTelemetry

TypeScript import issue with npm package exporting custom errors

25 April 2024 @ 3:33 am

I have created an npm package where I defined custom error classes and exported them. However, when importing these classes into another project, TypeScript shows an error despite successful import. Here's the structure of my npm package: NotFoundError.ts: import { CustomError } from "./custom-error"; export class NotFoundError extends CustomError { statusCode = 404; constructor() { let message = "Route not found"; super(message); Object.setPrototypeOf(this, NotFoundError.prototype); } serializeErrors() { return [{ message: this.message }]; } } CustomError.ts: export abstract class CustomError extends Error { abstract statusCode: number; constructor(message: string) { super(message); Object.setPrototypeOf(this, CustomError.prototype); } abstract serializeErrors(): { message: string; fields?: string }[]; }

creating a multi-index column from an existing dataframe

25 April 2024 @ 3:31 am

i have data that is coming to me as it appears in a spreadsheet. WHen it arrives it looks like this: import pandas as pd, numpy as np data1 = [['symbol', 'appl', 'goog', None, 'msft', None, None, None], ['date' , 'close', 'close', 'volume', 'close', 'open', 'high', 'low'], ['1999-01-10', 100, 101, 10000, 102, 102, 104, 105], ['1999-01-11', 200, 201, 10000, 202, 202, 204, 205]] df = pd.DataFrame(data1) df this generates a table that looks like this: enter image description here I basically need to iterate over this data by splitting or grouping by symbol. So the first dataframe would consist of only [date, close] column for appl, The 2nd woudl be [date, close, volume] for goog

odysee.com

VN:F [1.9.22_1171]
Rating: 9.0/10 (3 votes cast)

Less censorship more entertainment. Alternative YouTube.

mewe.com

VN:F [1.9.22_1171]
Rating: 9.0/10 (2 votes cast)

Social networks without the ads and invasion of privacy, alternative to Facebook.

Hopefully it will stay this way.

who-called.co.uk

VN:F [1.9.22_1171]
Rating: 9.0/10 (2 votes cast)

Who called me, check with others to see if you have a scam caller.

freedomcells.org

VN:F [1.9.22_1171]
Rating: 9.0/10 (1 vote cast)

Freedom Cells are peer to peer groups organising themselves in a decentralised manner with the collective goal of asserting the sovereignty of group members through peaceful resistance and the creation of alternative institutions.

rumble.com

VN:F [1.9.22_1171]
Rating: 8.7/10 (3 votes cast)

Another alternative to the censorship of YouTube.

en.whotwi.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (6 votes cast)

Graphical twitter user statistics

Flickr.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (2 votes cast)

Almost certainly the best online photo management and sharing application in the world

IMG_8523562

6 March 2024 @ 9:02 pm

Kamay Botany Bay National Park

1 March 2024 @ 3:18 am

IMG_2121

27 February 2024 @ 8:27 pm

NYC hotdogs — gotta have one!

27 February 2024 @ 6:56 am

BLOG #85

22 December 2023 @ 8:58 pm

Riding In The Car

10 December 2023 @ 11:26 pm

Hot Wheels Red Volvo V70 Estate

21 November 2023 @ 2:54 pm

Mille bracciate di malinconia

23 August 2023 @ 8:42 pm

halfbakery.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (2 votes cast)

Half baked ideas going way back.

bitchute.com

VN:F [1.9.22_1171]
Rating: 8.0/10 (4 votes cast)

Video sharing that may not be allowed (censored) on youtube.