Skip to main content

Posts

Refresh kendo grid within a partial?

I have the following partial: @model List<PrintedCheckInvoice> <div> @Html.Kendo().Grid(Model).Name("PrintedCheckInvoiceList").DataSource(dataSource => dataSource .Ajax() .ServerOperation(true) .Model(model => { model.Id(o => o.actionItemID); }).Read(read => read.Action("PrintedCheckInvoiceList_Read", "Assoc").Data("getInvoicesFilter")) ).Columns(columns => { columns.Bound(o => o.ledgerID).Width(90); columns.Bound(o => o.actionItemID).Width(100); columns.Bound(o => o.invoiceNo).Width(130); columns.Bound(o => o.description).Width(180); columns.Bound(o => o.glDetail).Width(230); columns.Bound(o => o.checkNo).Width(90); columns.Bound(o => o.amount).Format("{0:c}").Width(100); }).Resizable(resize => resize.Columns(true)).Scroll

Problem with accordion's toggle when combining it with navtabs (Bootstrap)

So, I'm creating this navigation thing using Bootstrap which will be present in the form of tabs in desktop and for mobile it will be an accordion. It's almost finished except there's this error I am not able to resolve. Problem: If I click on any of the tabs (say Link #3) in the desktop version and then I switch to mobile, the correct tab is opened (i.e. Link #3) BUT when I click on it to close the tab and hide the content even though the content gets hidden, the button and toggle remains in "open state". This problem can be seen in desktops or tablets (as they'll show the navtabs). To view the problem on desktop just decrease the viewport size after clicking the nav tab. I thought that if I could use "classList.contains()" to somehow keep track of when the content has "show" class and when it does not I'd be able to control it. But, I think it only keeps track of the class if I mentioned the class inline (it keeps on alerting true f

useState does not set

First of all, yes, I talked with ChatGPT, it does not give a working answer. The main is that I want an image to be rendered. Why in my case the setter does not work? Probably the error lies on the surface, I am a newbie so please do not be strict. I am trying to set setMeme in two places, but it does not work. What's horroring for me is that I do not receive any error. I screened a few sites, but solutions mostly rely on "useEffect", and did not help this did not help: The useState set method is not reflecting a change immediately import React from "react"; import memesData from "../memesData.js"; import { useState, useEffect } from "react"; import front_img from "../../public/images/front_meme.png"; function importAll(r) { return r.keys().map(r); } const images = importAll(require.context('./', false, /\.(png|jpe?g|svg)$/)); //alert(images); // Create a require.context for the images folder //const images

React native not persisting user data from firebase

So i am buidling a mobile app using Expo react native and firebase, i am having a issue with current user not presisting data. following are a few code snippets: App.js: import { AuthContextProvider } from "./context/AuthContext"; import MainNavigator from "./screens/MainNavigator"; export default function App() { return ( <AuthContextProvider> <MainNavigator /> </AuthContextProvider> ); } AuthContext.js: import React from "react"; import { onAuthStateChanged, getAuth } from "firebase/auth"; import firebase_app from "../firebase/config"; const auth = getAuth(firebase_app); import { Text } from "react-native"; export const AuthContext = React.createContext({}); export const useAuthContext = () => React.useContext(AuthContext); export const AuthContextProvider = ({ children }) => { const [user, setUser] = React.useState(null); const [loading, setLoading] = React.useState(true

How to create multiple paths of different colour using Google StaticMap in Google Apps Script?

I am trying to create a small app that will take x number of lists of locations (in the form of Geocodable Addresses) and displaying them on a StaticMap as x different paths. To change the style of the paths the documentation says to use setPathStyle(weight, color, fillColor) When doing this though I cannot find a way to make the fill colour fully transparent, or to have no fill colour at all. I build the map and retrieve the URL using this Google Apps Script code (The real app is connected to a Google Sheets document with changing addresses which is why I am using GAS): function mainFn() { addressList = [[['London, UK'],['Milton Keynes, UK'],['Cambridge, UK']], [['Reading, UK'],['Oxford, UK'],['Bristol, UK']], [['Gloucester, UK'],['Worcester, UK'],['Birmingham, UK']]]; //would normally be sourced from a Google Sheets document directions = getDirections(addressList); map

Generating a Gaussian point spread function using Python

I wrote this function to generate a Gaussian point spread function using Python, I wonder if my approach is correct or needs modification. I wrote this function, but not sure if my approach is correct: def generate_PSF(size, sigma): """ Generates a Gaussian Point Spread Function (PSF). """ x, y = np.meshgrid(np.linspace(-size/2, size/2, size), np.linspace(-size/2, size/2, size)) d = np.sqrt(x*x + y*y) psf = np.exp(-d**2 / (2*sigma**2)) psf /= np.sum(psf) # Normalize the PSF return psf source https://stackoverflow.com/questions/76745253/generating-a-gaussian-point-spread-function-using-python

How to write a cafe program in Python [closed]

I have to write a simple cafe program as a task to first ask the user which one of the three types of pizza he wants and display the price next to it. After that, we ask them if they want something else, for example, sauce, soft drink, or water, and their price should be as well. Finally, display the total purchase price I tried different ways but to no avail. source https://stackoverflow.com/questions/76745368/how-to-write-a-cafe-program-in-python