Can I get any google user’s profile picture?

I have a big software with thousands of clients. I just thought it would be a nice touch if I could add their google profile picture, just to identify them easier.

I mean, I’m not attempting to hack or intrude anything, I’m just trying to access a low resolution image of their PUBLIC profiles from some URL or API, only using their emails, either to store the pictures or just to request them to display realtime. This has nothing to do with logins or with asking permissions.

What I want is either:

a) an URL I can access via javascript or PHP’s file_get_contents or similar

b) an API I can call via PHP
…so I can loop the entire DB and do this with those who have gmail.

Thank you.

Some Nuxt 3 API endpoints work and some not, same code logic for client and server

I’m making a fully AI made app, for the sake of experimenting and because I needed something fast. One feature is importing a CSV file into a sqlite database (I’m using Bun) and another is adding notes to some row, but I’m facing a problem, one endpoint works and the other doesn’t (among others but I’m using this one as an example), if I import the csv file, it works great, but adding the notes the request doesn’t even reach the server (which is localhost of course) and I’m at the point I don’t even know what the crap is happening, not even Gemini or Grok could solve it.
The api structure is as follows:

  • server/api
    • migrations
      • clear.delete.ts (this one works)
      • notes.put.ts (this one doesn’t work)
      • status.post.ts (works)
    • migrations.get.ts (works)
    • migrations.post.ts (works)
    • pbrimport.post.ts (doesn’t work)
  • server/middleware
    • logRequests.global.ts (logs requests only on endpoints that say it works)

I’ll post just the parts that make the fetch and receive the data, it’s all the same.

ImportModal.vue:

let fetchOptions: RequestInit = {
        method: "POST",
        headers: { "Content-Type": "application/json" }, // Always JSON now
    };

    try {
        if (currentUploadType === "main") {
            apiUrl = "/api/migrations";
            payload = { data: dataToUpload };
        } else {
            // PBR upload
            apiUrl = "/api/pbr_import";
            payload = { data: dataToUpload };
        }

        fetchOptions.body = JSON.stringify(payload);
        const payloadSize = fetchOptions.body.length;
        console.debug(`[UploadModal] Sending JSON payload (${payloadSize} bytes) to ${apiUrl}`);

        const response = await $fetch(apiUrl, fetchOptions);

NotesModal.vue

// THIS DOESN'T WORK
try {
            const response = await $fetch(apiUrl, {
                // <-- Use full URL
                method: "PUT",
                body: {
                    virtual_server: props.virtualServerName,
                    notes: notesToSave,
                },
                // Content-Type: application/json is usually added automatically by $fetch for object bodies
            });

            if (response.success) {

migrations.post.ts — This endpoint is for the ImportModal.vue, the one that works

import { db, dbReady } from "@/server/db/index";
// Import Kysely specific types if needed for stricter validation, or use Partial
import type { WafMigracionTable } from "@/server/db/types";
import logger from "@/server/utils/logger";

// Define type for incoming records more strictly based on Kysely Insertable if desired
// This helps catch issues earlier if CSV parsing yields unexpected types
type IncomingRecord = Partial<Omit<WafMigracionTable, "id">>;

export default defineEventHandler(async (event) => {
    const requestInfo = { url: event.node.req.url, method: event.node.req.method };
    logger.info("[POST /api/migrations] Received request.", requestInfo);

    try {
        // Ensure DB setup is complete
        await dbReady;

pbrimport.post.ts — This is the api endpoint for the ImportModal.vue, the else which posts to /api/pbr_import

// File: server/api/pbr_import.post.ts

import { db, dbReady } from "@/server/db/index";
import type { NewFirewallPbr, FirewallPbrUpdate } from "@/server/db/types";
import logger from "@/server/utils/logger";
// Remove readRawBody import if present
// import { readRawBody } from 'h3';
// Remove papaparse import
// import Papa from 'papaparse';

// Type for expected data row within body.data
interface PbrDataRow {
    node_ip?: string | null;
    priority?: number | string | null;
    waf?: string | null;
    [key: string]: any; // Allow other columns from client parsing
}

export default defineEventHandler(async (event) => {
    const requestInfo = { url: event.node.req.url, method: event.node.req.method };
    // Log expecting JSON now
    logger.info("[POST /api/pbr_import] Received request (expecting JSON body).", requestInfo);

    try {
        await dbReady;

notes.put.ts — This endpoint is for the NotesModal.vue, this one doesn’t work, not even the logger.info or the middleware logs.

import { db, dbReady } from "@/server/db/index";
import type { NewVsNotes, VsNotesUpdate } from "@/server/db/types";
import logger from "@/server/utils/logger";

interface RequestBody {
    virtual_server: string;
    notes: string | null; // Allow null to clear notes
}

export default defineEventHandler(async (event) => {
    const requestInfo = { url: event.node.req.url, method: event.node.req.method };
    logger.info("[PUT /api/migrations/notes] Received request.", requestInfo);

    try {
        await dbReady;

At first I tought there was something wrong with the csv file, but I made a separate script to put the data in the database and it works ok, I just don’t know how or why one works and the rest doesn’t, maybe is something wrong with the file hierarchy or naming? For every case, the request is made on the client but it’s forever pending, and they doesn’t even reach the middleware let alone the endpoint, but the migrations.post.ts works ok. I tried axios for fetching, I also even tried downgrading nuxt and nothing.

Counter variable inside for/while loop [duplicate]

For loop with counter:

for(let i = page; i < numPages + 1; i++){
  const fn = async() => {
    const res = await xxx(i);
    console.log("page", i);
    return res;
  }

  promises.push(fn);
}

While loop with same type of counter:

while(page < numPages + 1){
  page++;
  const fn = async() => {
    const res = await xxx(page);
    console.log("page", page);
    return res;
  }

  promises.push(fn);
}

They are producing different results.
For is display the counter normally.

But while is displaying the last value every time.

why?

Setting axis label width in Billboard JS

I have a set of billboard JS charts on a page, in a bootstrap row and column grid layout. So all the ‘cells’ of this layout have the same width. But billboard is deciding how much width to give the axis labels. Ideally what I’d like is to be able to force-set the width of the vertical axis label width so the charts line up nicely when stacked on top of each other.

So far, I haven’t been able to find a way to set the width of axis labels in billboard JS. Would love some help if someone knows how.

example chart - data blurred out

Cannot remove outline in input

import React, { useState } from 'react';
import "./styles/input.css";
import { CiSearch } from 'react-icons/ci';

interface SearchProps {
  isMobile: boolean;
  onSearch?: (query: string) => void;
}

const Search: React.FC<SearchProps> = ({ isMobile, onSearch = () => {} }) => {
  const [searchQuery, setSearchQuery] = useState('');
  const [isFocused, setIsFocused] = useState(false);

  const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
    setSearchQuery(e.target.value);
  };

  const handleSearchSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    onSearch(searchQuery);
  };

  const handleFocus = (e) => {
    setIsFocused(true);
    console.log('Focused');
  };

  const handleBlur = () => {
    setIsFocused(false);
    console.log('Blurred');
  };

  const borderClass = isFocused ? 'border-b-2 border-main_theme' : 'border-b border-gray-300';
//   console.log('Applied class:', borderClass);

  return (
    <form onSubmit={handleSearchSubmit} className="relative w-[350px] lg:w-[500px]">
      <div className={`flex items-center`}>
        
        <input
          type="text"
          placeholder="Поиск"
          className="w-full p-2 border-none"
          value={searchQuery}
          onChange={handleSearchChange}
          onFocus={handleFocus}
          onBlur={handleBlur}
        />
        <button
          type="submit"
          className="p-2 text-gray-400 focus:outline-hidden"
        >
          <CiSearch className="h-5 w-5" />
        </button>
      </div>
      <hr className={`${borderClass}`} />
    </form>
  );
};

export default Search;

This is my code, the problem occurs with an input element, tried to style it both with Tailwind CSS, inline styles and additional css as in example, but none of variants helped(additional styling for it below) –

input.css

input {
    outline: none; 
    border: none;  
    box-shadow: none; 
}

input:focus {
    outline: none; 
    border-bottom: none;
}

For some reason after all corrections and additions I get this result when focused(screen). Meanwhile I need to completely remove an outline while focused

Problem screen

How can i add sprites to my raycaster, and various walls textures?

Here’s my RayCast algorythm, not so complicated:

var currentAngle = playerAngle + HALF_FOV;
        var rayStartX = Math.floor(playerX / MAP_SCALE ) * MAP_SCALE;
        var rayStartY = Math.floor(playerY / MAP_SCALE) * MAP_SCALE;
        for(var ray = 0; ray < WIDTH; ray++){
            var currentSin = Math.sin(currentAngle); currentSin = currentSin ? currentSin : 0.000001;
            var currentCos = Math.cos(currentAngle); currentCos = currentCos ? currentCos : 0.000001;      
        
            //vertical collisions
            var rayEndX, rayEndY, rayDirectionX, verticalDepth, textureEndY, textureX;
            if(currentSin > 0) { rayEndX = rayStartX + MAP_SCALE; rayDirectionX = 1}
            else { rayEndX = rayStartX; rayDirectionX = -1}
            for (var offset = 0; offset < MAP_RANGE; offset += MAP_SCALE) {
                verticalDepth = (rayEndX - playerX) / currentSin;
                rayEndY = playerY + verticalDepth * currentCos;
                var mapTargetX = Math.floor(rayEndX / MAP_SCALE);
                var mapTargetY = Math.floor(rayEndY / MAP_SCALE);
                if(currentSin <= 0) mapTargetX += rayDirectionX;
                var targetSquare = mapTargetY * MAP_SIZE + mapTargetX;
                if(targetSquare < 0 || targetSquare > map.length - 1) break;
                if(map[targetSquare] == 1 || map[targetSquare] == 2) { textureY = map[targetSquare]; break;}
                rayEndX += rayDirectionX * MAP_SCALE;
            }
            textureEndY = rayEndY;

            var tempY = rayEndY;
            var tempX = rayEndX;

            
            //horizontal collisions
            var rayEndY, rayEndX, rayDirectionY, horizontalDepth, textureEndX, textureY;
            if(currentCos > 0) { rayEndY = rayStartY + MAP_SCALE; rayDirectionY = 1}
            else { rayEndY = rayStartY; rayDirectionY = -1}
            for (var offset = 0; offset < MAP_RANGE; offset += MAP_SCALE) {
                horizontalDepth = (rayEndY - playerY) / currentCos;
                rayEndX = playerX + horizontalDepth * currentSin;
                var mapTargetX = Math.floor(rayEndX / MAP_SCALE);
                var mapTargetY = Math.floor(rayEndY / MAP_SCALE);
                if(currentCos <= 0) mapTargetY += rayDirectionY;
                var targetSquare = mapTargetY * MAP_SIZE + mapTargetX;
                if(targetSquare < 0 || targetSquare > map.length - 1) break;
                if(map[targetSquare] == 1 || map[targetSquare] == 2) {texturex = map[targetSquare]; break;}
                rayEndY += rayDirectionY * MAP_SCALE;
            }
            textureEndX = rayEndX;
            
            var endX = verticalDepth < horizontalDepth ? tempX : rayEndX;
            var endY = verticalDepth < horizontalDepth ? tempY : rayEndY;


            //3D projection
            var textureImg = verticalDepth < horizontalDepth ? textureY : textureX;
            var depth = verticalDepth < horizontalDepth ? verticalDepth : horizontalDepth;
            var textureOffset = verticalDepth < horizontalDepth ? textureEndY : textureEndX;
            textureOffset = textureOffset - Math.floor(textureOffset / MAP_SCALE) * MAP_SCALE;
            depth *= Math.cos(playerAngle - currentAngle)
            var WallHeight = Math.min(Math.floor(MAP_SCALE * 300 / (depth + 0.001)), 50000);
            context.globalAlpha = 1;
            context.fillStyle = verticalDepth < horizontalDepth ? "#aaa" : '#555';
            context.fillRect( 148 + ray, 46 + ( HEIGHT / 2 - WallHeight / 2), 1, 
            WallHeight); 
            var textureImg = verticalDepth < horizontalDepth ? textureY : textureX;
            //textures
            context.drawImage(
                WALLS[0],
                textureOffset,
                0,
                1,
                64,
                ray + 148,
                46 + (HALF_HEIGHT - WallHeight / 2),
                1,
                WallHeight
            );

Well, I want to add some sprites at game. How can I do it, using html canvas and based on it raycaster? Is it even possible? I tried to draw a circle on 2D map, as a result I get another wall, it’s kinda strange. Also I tried to make a different textures on the walls, by replacing WALLS[0] to WALLS[textureImg] thats not worked(I get an error).

How to write an HTTP/2 SETTINGS frame – from server to client – in runtime agnostic JavaScript?

I’m trying to create an HTTP/2 SETTINGS frame per https://datatracker.ietf.org/doc/html/rfc7540#section-6.5 and https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.1.

If I’m reading this correctly a SETTINGS frame can have zero parameters

The payload of a SETTINGS frame consists of zero or more parameters,
each consisting of an unsigned 16-bit setting identifier and an
unsigned 32-bit value.

Given an ArrayBuffer and a DataView instance in JavaScript, for example, in the console of the browser, how to write the most basic HTTP/2 SETTINGS frame – from server to client?

Execute JavaScript in Android Kotlin WebView to find an element’s coordinates on the screen

I have an Android app which I am creating with the Kotlin language. I am trying to get a specific <div> element within the webpage I am displaying and then put the coordinates of the element into Kotlin variables. In my case, I’m displaying a YouTube page and trying to get the coordinates of the video player (I will be later displaying a button over it). I’m using the following code to initialize my WebView:

mainWebView.webViewClient = CustomWebViewClient(...) // This custom class doesn't do anything other than check if the user leaves the YT website.
mainWebView.webChromeClient = WebChromeClient()
mainWebView.settings.javaScriptEnabled = true
mainWebView.settings.domStorageEnabled = true

Then, I load the page:

mainWebView.loadUrl("https://www.youtube.com/watch?app=desktop&v=lh7WIW3pcso")

Next, I execute some JavaScript on the click of a specific button and display the result. I tested the JavaScript code in my browser’s console and it worked fine. (It gave the result of {"x":0,"y":56}.)

mainWebView.evaluateJavascript(
    "(function() { var element = document.getElementById('full-bleed-container'); var rect = element.getBoundingClientRect(); return JSON.stringify({ x: rect.left, y: rect.top }); })();"
) { result ->

    if (result == "null") {
        Toast.makeText(this, "NULL!", Toast.LENGTH_SHORT).show()
    } else {
        val coordinates = JSONObject(result)
        val x = coordinates.getDouble("x")
        val y = coordinates.getDouble("y")
        Toast.makeText(this, "Coordinates: X: $x, Y: $y", Toast.LENGTH_SHORT).show()
    }
}

However, my app crashes with the following exception: org.json.JSONException: Value {"x":0,"y":56} of type java.lang.String cannot be converted to JSONObject.

I also checked to see if the page wasn’t done loading with the following code (and I received the Toast saying it was done):

    override fun onPageFinished(view: WebView?, url: String?) {
        super.onPageFinished(view, url)

        Toast.makeText(context, "Loaded '$url'!", Toast.LENGTH_SHORT).show()
    }

First of all, why isn’t the JSON response string being converted into the JSONObject successfully, and secondly, the app shouldn’t be giving the same JSON response on different device sizes, should it? Not sure what’s going on here, but I need to get the coordinates in such a format that I can display a button over that <div> element.

why is app jsx not displaying everything?

i am trying to write a react code but
app .jsx doesn’t display anything except the (♥) no matter what i do

here is the first file……….
moviecard.jsx

  import React from "react"
function Moviecard (Movie) {
   function onFavouriteClick () {
    alert("clicked")
   }
return (
    <div className="movie-card">

        <div className="movie-poster">
        <img src={Movie.url} alt={Movie.title} />

            <div className="movie-overlay">
        <button className="favourite-btn" onClick={onFavouriteClick} >
        ♥
        </button>
             </div>

        </div>
        <div className="movie-info">
            <h3>{Movie.title}</h3>
            <p>{Movie.release_date}</p>
        </div>
    </div>
)
}

export default Moviecard

second file………..
home.jsx
…………………………………

    import React from "react";
import Moviecard from "../components/Moviecard";
function Home() {
 const movies = [
        {id: 1, title: "john wick", release_date:"2020"},
        
        {id: 2, title: "john wick 2", release_date:"2021"},
        
        {id: 3, title: "john wick 3", release_date:"2022"},
        
        {id: 4, title: "john wick 4", release_date:"2023"},
    ]
 return (
    <div className="home">
        <div className="movies-grid">
            {movies.map((Movie) => ( 
            <Moviecard key={Movie.id}/>
            ))}
        </div>
    </div>
    )
}

export default Home;

third file……..
app.jsx
……………………………….

    import React from "react";
import './App.css';
import Home from "./pages/home";
function App() {
  return (
  <>
  <Home/>
  </>
  )
};
export default App;

……..

Eraser.js on Readymag

I’m trying to add this code above my website on readymag. It places an image above the website that can be erased, but when I insert the code, the website doesn’t scroll. I tried using pointer-events: none;, and while it allows scrolling, the eraser function doesn’t work. Can someone help me?

HTML

       <div class="wrapper">
            
            <img id="img2" src="https://freight.cargo.site/t/original/i/Z2283582099087810873620708068841/stelline-rettangolo.svg"> </div>        


    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script src="https://freight.cargo.site/m/K2262565859332669963966899162601/jquery.eraser.js"></script>
    <script type="text/javascript">
        
        $('#img2').eraser({ size: 200 });

    </script>

CSS

.wrapper {
    position: relative;
}

#img2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    object-fit: cover;
}

#img2 {
    z-index: 99;
}

SVG & Web Responsivity

this took me too long so I come here for help. I want to have multiple lines like this, connected to the text. But they dont on other monitor sizes. Anyone who can help??

:root {
  --color-background: black;
  --color-on-background: white;
}

body {
  width: 100vw;
  height: auto;
  background-color: var(--color-background);
}

.hero_page {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-flow: column nowrap;
  justify-content: center;
  align-items: center;
}

.hero_page_title {
  font-family: title;
  font-size: 25vh;
  fill: var(--color-on-background);
  text-align: center;
  text-anchor: middle;
  dominant-baseline: middle;
}

.line {
  fill: none;
  stroke: var(--color-on-background);
  stroke-width: 0.3vh;
}

.filled {
  fill: var(--color-on-background);
  stroke: none;
}
<html>

<body>
  <div class="hero_page">
    <svg width="100vw" height="100vh" viewbox="0 0 2000 1000" preserveAspectRatio="xMidYMid meet">
      <polyline class="line" points="0,170 300,170 320,192 370,192 390,170 600,170 691,400"></polyline>
      <text class="hero_page_title" x="50%" y="50%">OSKAR KOPČIL</text>
    </svg>
  </div>
</body>

</html>

enter image description here

D3.js interpolate coordinates between two points forming an arc instead of a straight line

My goal is simple, I want to add direction markers on a path (like so).
The code that I’ve implemented gives the result on the initial load.

lineCoords.forEach(coords => {

    for (let i = 1; i < coords.length; i++) {
      const A = (coords[i - 1]);
      const B = (coords[i]);

      const interpolateA = d3.interpolate(A[0], B[0]);
      const interpolateB = d3.interpolate(A[1], B[1]);

      const spacing = 3;
      const distance = Math.hypot(A[0] - B[0], A[1] - B[1]);
      const numPoints = Math.max(1, Math.floor(distance / spacing));
      const range = d3.range(1, numPoints + 1);
      const points = range.map(j => {
        const t = j / (numPoints + 1);
        const interpolatedA = interpolateA(t);
        const interpolatedB = interpolateB(t);

        return [interpolatedA, interpolatedB];
      });

      onewayCoords.push(points);
    }

  })

However, when I zoom the map, the markers form an arc instead of a straight line.
Since the code above runs inside the drag event, I don’t think that’s the issue.
I suspect the problem is related to the coordinates not being precise.

If there’s a better way to achieve the desired result, please share your insights.

My browser is not showing some of the content i write inside my ejs file

i am working on a full stack web developement project and i’m stuck where localhost:3000 in my browser can’t show the before and after mentioned in the layout.ejs file, which are outside the <%- body %> code. The localhost:3000 can show what’s inside the index.ejs file which have been included in the <%- body %> code but it can’t show what’s outside <%- body ->

code inside my layout.ejs file

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Mybrary</title>
</head>
<body>
    Before
    <br>
    <%- body %>
    <br>
    After
</body>
</html>

code inside my index.ejs file

Middle

code inside my server.js file

const express = require('express')
const app = express()
const expressLayouts = require('express-ejs-layouts')

const indexRouter = require('./routes/index')

app.set('view engine', 'ejs')
app.set('views', __dirname + '/views')
app.set('layouts', 'layouts/layout')

app.use(express.static('public'))

app.use('/', indexRouter)
app.use(expressLayouts)

app.listen(process.env.PORT || 3000)

React 19’s use hook is running in an endless loop but should only run once [duplicate]

I am using react 19’s use function, but the problem that I am running into is that it seems to be called in an endless loop, and I am not sure why or what I am doing wrong.

I created an async function that makes an http request to my graphql server. The response returns a 200 with the correct data, but then the console.log never executes, and the fetch gets called endlessly making lots of http requests.

Stackblitz Example (See console for output).

// The http request
export const getDistance = async (start, end) => {
  const res = await fetch(environment.hasura.v2.url, {
    method: 'POST',
    headers: { /* API Headers */ },
    body: JSON.stringify({ query: /* Graphql query */, variables: { start, end } }),
  });
  const json = await res.json();
  return json.data;
};

// The header to display
export default function UserHeader() {
  const distance = use(getDistance(1, 20));
  console.log('distance', distance);

  return <>{distance}</>;
}

// The page root
export default function App() {
  return (
    <Suspense fallback={<>Loading...</>}>
      <UserHeader />
    </Suspense>
  );
}

I thought that this was because of re-rendering but if I remove the use function the console.log only displays twice (due to strict mode):

export default function UserHeader() {
  console.log('distance');
}

What is causing this endless call?