Allah

joined 1 month ago
[–] [email protected] -1 points 1 week ago* (last edited 1 week ago)

what? i think you mean drill?

 

try using this code do you think it will work?

Below is a minimal example of how you can add a real‐time chat box that only your authenticated users can use. It uses:

  • Node.js + Express for the web server
  • express‐session to track logged-in users
  • Socket.io for real-time messaging

You’ll need to adapt the authentication check to however you store your users (database, JWTs, etc.), but this will give you the core of “only logged‐in folks see/use the chat.”


1. Install dependencies

npm init -y
npm install express express-session socket.io

2. server.js

const express = require('express');
const http    = require('http');
const session = require('express-session');
const SocketIO = require('socket.io');

const app = express();
const server = http.createServer(app);
const io = new SocketIO(server);

// 1) Session middleware
const sessionMiddleware = session({
  secret: 'YOUR_SESSION_SECRET',
  resave: false,
  saveUninitialized: false,
  // store: you can add a store like connect-mongo here
});
app.use(sessionMiddleware);

// 2) Make session available in socket.handshake
io.use((socket, next) => {
  sessionMiddleware(socket.request, socket.request.res || {}, next);
});

// Serve static files (our chat page + JS)
app.use(express.static('public'));

// 3) A simple “login” route for demo purposes.
//    In real life you’d check a DB, hash passwords, etc.
app.get('/login', (req, res) => {
  // e.g. ?user=alice
  const username = req.query.user;
  if (!username) return res.sendStatus(400);
  req.session.user = { name: username };
  res.redirect('/chat.html');
});

// 4) Protect chat page
app.get('/chat.html', (req, res, next) => {
  if (!req.session.user) return res.redirect('/login.html');
  next();
});

// 5) Handle socket connections
io.on('connection', socket => {
  const req = socket.request;
  if (!req.session.user) {
    // kick out any un‐authenticated socket
    return socket.disconnect(true);
  }

  const user = req.session.user.name;
  socket.broadcast.emit('message', {
    from: 'SYSTEM',
    text: `${user} has joined the chat`
  });

  socket.on('message', msg => {
    io.emit('message', {
      from: user,
      text: msg
    });
  });

  socket.on('disconnect', () => {
    socket.broadcast.emit('message', {
      from: 'SYSTEM',
      text: `${user} has left the chat`
    });
  });
});

server.listen(3000, () => {
  console.log('Listening on http://localhost:3000/');
});

3. public/chat.html

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Chat Room</title>
  <style>
    #messages { list-style: none; padding: 0; max-height: 300px; overflow-y: scroll; }
    #messages li { margin: 5px 0; }
    #form { display: flex; }
    #input { flex: 1; }
  </style>
</head>
<body>
  <h1>Chat Room</h1>
  <ul id="messages"></ul>
  <form id="form">
    <input id="input" autocomplete="off" placeholder="Type a message…" /><button>Send</button>
  </form>

  <script src="/socket.io/socket.io.js"></script>
  <script>
    const socket = io();

    const form = document.getElementById('form');
    const input = document.getElementById('input');
    const messages = document.getElementById('messages');

    socket.on('message', msg => {
      const li = document.createElement('li');
      li.textContent = `${msg.from}: ${msg.text}`;
      messages.appendChild(li);
      messages.scrollTop = messages.scrollHeight;
    });

    form.addEventListener('submit', e => {
      e.preventDefault();
      if (input.value.trim()) {
        socket.emit('message', input.value);
        input.value = '';
      }
    });
  </script>
</body>
</html>

4. How It Works

  1. Session setup We use express-session so that when a user “logs in” (e.g. via your existing form/database), we store { user: { name: '…' } } in req.session.

  2. Socket authentication By re-using the same session middleware in Socket.io’s io.use(…), every incoming socket has access to socket.request.session. If there’s no session.user, we immediately disconnect() them.

  3. Real-time chat

    • On connect/disconnect we broadcast a system message.
    • On client‐side, every message the user sends is emitted and broadcast to all.
  4. Protecting the page We guard chat.html in Express so that if you go there directly, you’ll get bounced to /login.html (you’d build a real login page).


Next Steps

  • Integrate with your real user database. Replace the demo /login route with your own logic.
  • Persist chat history if you want to store messages (e.g. in MongoDB or MySQL).
  • Add rooms or private messaging by namespace or room support in Socket.io.
  • Style it and embed it in your existing layout (lemm.ee) CSS.
 

Sci-Hub alternative websites for accessing academic papers for free:

Unpaywall (https://unpaywall.org/) Browser extension for Chrome.

Allows legal, free access to research papers directly on journal websites.

Open Access Button (OAB) (https://openaccessbutton.org/)

Copy and paste a paper’s link or DOI into the OAB website.

Provides legal access to the paper on the subsequent page. PaperPanda (https://paperpanda.app/)

Chrome extension similar to Unpaywall. Enables one-click access to millions of research papers. DOAJ (Directory of Open Access Journals) (https://doaj.org/)

Offers free access to millions of scientific papers globally. Focuses on open-access journals. OA.mg (https://oa.mg/)

Search engine designed specifically for academic papers. Provides access to over 250 million papers. Core (https://core.ac.uk/)

World’s largest database of research papers. Contains over 298 million papers available for free. arXiv (https://arxiv.org/)

Specializes in natural sciences and economics. Offers free access to 2.4 million academic papers.

Tip: Remove any spaces in the URLs if there are issues accessing the websites.

[–] [email protected] -3 points 1 week ago (1 children)

YOU have no basis in reality

 

cross-posted from: https://lemm.ee/post/64866073

Absolute Nuclear (Light Yellow)
Definition: A family structure consisting only of parents and their children, with no extended relatives living together. Once children marry, they form their own independent households.

Regions: Predominantly in the UK, Ireland, and parts of Scandinavia. This reflects a cultural emphasis on individualism and early independence.

Egalitarian Nuclear (Orange)
Definition: Similar to the absolute nuclear family, but with more equality in inheritance and gender roles between spouses. Children still leave to form independent households, but there’s less rigid hierarchy within the family.

Regions: Found in Spain, Portugal, southern France, and parts of Italy. This structure aligns with Mediterranean cultural norms of balanced familial roles.

Stem Family (Light Blue)
Definition: A family where one child (usually the eldest son) remains in the parental home with their spouse and children, while other siblings leave to form their own households. The stem family ensures the continuity of the family estate.

Regions: Common in central Europe, including Germany, Austria, and parts of France. This reflects a tradition of preserving family property through one heir.

Incomplete Stem Family (Gray)
Definition: A variation of the stem family where the designated heir might not always stay with the parents, or the system is less rigid. Extended family involvement is limited compared to a full stem family.
Regions: Seen in parts of central and eastern Europe, like Poland and Hungary. This indicates a transitional family structure between stem and nuclear models.

Communitarian (Dark Blue)
Definition: A family structure where multiple generations live together, often with brothers and their families sharing a household. Inheritance is typically divided equally among siblings, and communal living is emphasized.

Regions: Predominantly in southern Italy, parts of the Balkans, and eastern Europe, including Finland. This reflects a collectivist culture prioritizing extended family unity.

 

cross-posted from: https://lemm.ee/post/64402908

cross-posted from: https://lemm.ee/post/64402838

TLDR:

  • Theoretical and experimental evidence now strongly supports the possibility of energy extraction from spinning objects, including black holes.

  • Creating a “black hole bomb” is no longer just science fiction—lab-scale analogs exist.

  • Realizing a full-scale version (especially around a real black hole) is still far in the future, but the groundwork is being laid.

Main Idea

It is theoretically and experimentally possible to extract energy from spinning black holes, and under specific conditions, this could be amplified to create what’s known as a “black hole bomb.”


Theoretical Background

Penrose Process (1969)

  • Proposed by Roger Penrose.

  • Energy can be extracted from a spinning black hole via its ergosphere.

  • The ergosphere is a region just outside the event horizon where spacetime is dragged due to the black hole’s spin.

  • Inside this region:

    • Objects cannot remain stationary.
    • Energy can be gained if mass is ejected in the right way.
    • A spacecraft, for instance, could enter the ergosphere and leave with more energy than it had.

Zeldovich Effect (1971)

  • Proposed by Yakov Zeldovich.
  • Rotating bodies (not just black holes) can amplify electromagnetic waves via rotational energy.
  • Predicted that light or sound aimed at a spinning object could gain energy upon reflection.
  • Required extremely high rotational speeds—nearly relativistic—for noticeable effects.

Experimental Verification

Sound Waves (2020)

  • Spinning absorptive disc increased the energy of low-frequency sound waves.
  • Proved the Zeldovich effect using acoustics.

Electromagnetic Waves (2023–2024)

  • A spinning aluminum cylinder with surrounding magnetic coils showed energy amplification of EM waves.
  • Rotation direction affected energy gain/loss.
  • First real-world proof of the superradiance concept from Zeldovich's theory.

Black Hole Bomb Concept (1972)

Key Mechanism

  • Enclose a spinning black hole (or any rotating energy source) with a reflective mirror.

  • Waves bounce between the mirror and ergosphere, each time gaining energy from the black hole’s spin.

  • This creates a positive feedback loop:

    • Energy builds exponentially.
    • Could result in an enormous explosion (i.e., a “black hole bomb”).
    • Or energy could be released in a controlled burst, like a black hole plasma gun.

Recent Experiments (2024)

  • Miniature black hole bomb analog was created:

    • A metal cylinder was rotated.
    • Surrounded by coils acting as magnetic mirrors.
    • EM waves were amplified exponentially when rotation threshold was met.
    • Verified theoretical predictions experimentally for the first time.

Challenges & Future Research

For Actual Black Holes

  • Creating a real reflective mirror around a black hole is still theoretical.
  • Stabilizing such a structure near a black hole is currently beyond our technology.

Next Step: Quantum Foam

  • Researchers aim to attempt amplification using quantum vacuum energy (quantum foam).

  • If successful:

    • Could demonstrate energy extraction from spacetime itself.
    • Would confirm another Zeldovich prediction.
    • Potential Nobel Prize-level breakthrough.

source

 

cross-posted from: https://lemm.ee/post/64402838

TLDR:

  • Theoretical and experimental evidence now strongly supports the possibility of energy extraction from spinning objects, including black holes.

  • Creating a “black hole bomb” is no longer just science fiction—lab-scale analogs exist.

  • Realizing a full-scale version (especially around a real black hole) is still far in the future, but the groundwork is being laid.

Main Idea

It is theoretically and experimentally possible to extract energy from spinning black holes, and under specific conditions, this could be amplified to create what’s known as a “black hole bomb.”


Theoretical Background

Penrose Process (1969)

  • Proposed by Roger Penrose.

  • Energy can be extracted from a spinning black hole via its ergosphere.

  • The ergosphere is a region just outside the event horizon where spacetime is dragged due to the black hole’s spin.

  • Inside this region:

    • Objects cannot remain stationary.
    • Energy can be gained if mass is ejected in the right way.
    • A spacecraft, for instance, could enter the ergosphere and leave with more energy than it had.

Zeldovich Effect (1971)

  • Proposed by Yakov Zeldovich.
  • Rotating bodies (not just black holes) can amplify electromagnetic waves via rotational energy.
  • Predicted that light or sound aimed at a spinning object could gain energy upon reflection.
  • Required extremely high rotational speeds—nearly relativistic—for noticeable effects.

Experimental Verification

Sound Waves (2020)

  • Spinning absorptive disc increased the energy of low-frequency sound waves.
  • Proved the Zeldovich effect using acoustics.

Electromagnetic Waves (2023–2024)

  • A spinning aluminum cylinder with surrounding magnetic coils showed energy amplification of EM waves.
  • Rotation direction affected energy gain/loss.
  • First real-world proof of the superradiance concept from Zeldovich's theory.

Black Hole Bomb Concept (1972)

Key Mechanism

  • Enclose a spinning black hole (or any rotating energy source) with a reflective mirror.

  • Waves bounce between the mirror and ergosphere, each time gaining energy from the black hole’s spin.

  • This creates a positive feedback loop:

    • Energy builds exponentially.
    • Could result in an enormous explosion (i.e., a “black hole bomb”).
    • Or energy could be released in a controlled burst, like a black hole plasma gun.

Recent Experiments (2024)

  • Miniature black hole bomb analog was created:

    • A metal cylinder was rotated.
    • Surrounded by coils acting as magnetic mirrors.
    • EM waves were amplified exponentially when rotation threshold was met.
    • Verified theoretical predictions experimentally for the first time.

Challenges & Future Research

For Actual Black Holes

  • Creating a real reflective mirror around a black hole is still theoretical.
  • Stabilizing such a structure near a black hole is currently beyond our technology.

Next Step: Quantum Foam

  • Researchers aim to attempt amplification using quantum vacuum energy (quantum foam).

  • If successful:

    • Could demonstrate energy extraction from spacetime itself.
    • Would confirm another Zeldovich prediction.
    • Potential Nobel Prize-level breakthrough.

source

 

Michael Rubin, a former Pentagon official and senior fellow at the American Enterprise Institute, took a jibe at US President Donald Trump's tendency to claim credit for almost every achievement, saying that Trump might as well have "invented the Internet" and "cured cancer."

view more: next ›