Social Media Search Api [closed]

I am making social media sentiment analysis as my mini project for ongoing semester . I want to fetch textual data related to a certain keyword from platforms like facebook,twitter,instagram and other social media platform so that i can perform sentiment analysis on that data .

How do I fetch data from keywords . If there are free public api’s or let me know method so that i can fetch data

Fast processing of large text files in NodeJS

I have to process large text files efficiently in NodeJS and can’t seem to improve further than the code below.

The input file is a ~50 Gb files of text, the processing logic is to compute some type of sums and produce an output file of aggregated data.

At first, i hit the Heap Space limit trying to read the whole file at once, so I partionned the reading part into chunks of 1,000,000 lines but that’s as fast as I could go, namely 1 hour and 20 mins for 300,000,000 lines. I tried to a promise based approach where the aggregation of the chunks happen in parallel with the next chunk reading, also thought about workers but that’s not ideal for passing large data over to the threads.

I would like help in reviewing and improving this code, I am not sure the aggregation does run in parallel of the next read phase or does it?

I am using the line-reader convenience library.

async function parseFileFast(fileName_) {
    var end, start = Date.now();
   ///... basic checks omitted

    var chunkSize = 3000000;
    var chunkIndex = 0; 
    var chunkCounter = 0;
    var lineCounter = 0;
    var chunkData = []; 
    console.log("processing .. " + fileName_);

    var result = [];
    // return new Promise((ok, ko) => {
    lineReader.eachLine(fileName_, async function(line) {
        chunkData.push(line);
        chunkCounter++;
        lineCounter++;

        if (chunkCounter >= chunkSize) {
            console.log("reaching boundary .. " + chunkIndex);
            console.log("processed lines so far .. " + lineCounter); 
            aggregate(chunkData, chunkIndex).then((data) => {
                result.push(...data.frames); 
            }); 
            chunkData = [];
            chunkCounter = 0;
            chunkIndex++;
        }
    }, async function(err) {
        if (err) throw err; 
        var status = writeOutput2(result, fileName_.replace(".csv", "3.csv"));
        end = Date.now();
        console.log("finished processing everything in sec: " + ((end - start) / 1000));
        return status;
    }); 
}

function aggregate(dataSet, index){ 
    return new Promise((resolve, reject)=>{
        var frames = new Map(); 
        dataSet.forEach((line) => {
            frames = processFrames(line, frames);
        }); 
        var result = { frames: frames, index: index};
        resolve(result);
    })
}

How do I make an about:blank cloak work automatically similiar to Interstellars?

I already got an about; blank cloak, but you have to click it for it to work, is there any way to cloak the site right as you open it?

The script I used was

<button onclick="openGame()">about:blank cloak</button>
    <script>
        function openGame() {
    var win = window.open()
    var url = "https://learnmathswithme.weebly.com"
    var iframe = win.document.createElement('iframe')
    iframe.style.width = "100%";
    iframe.style.height = "100%";
    iframe.style.border = "none";
    iframe.src = url
    win.document.body.appendChild(iframe)
    }
    </script>

which I found off the internet (since I’m not a coder), is there a change I can make to cloak the site automatically?

Journaya Script Integration in Elementor Form WordPress

I have integerated Journaya script in my wordpress landing page as described in Journaya. I am facing issue to save leadid token in my submissions. I inspected the hidden input it is running fine and generating input value dynamically but its not saving the value in entries of elementor form. This Highlighted part is not saving in submissions.

I am facing issue to save leadid token in my submissions. I inspected the hidden input it is running fine and generating input value dynamically but its not saving the value in entries of elementor form. This Highlighted part is not saving in submissions.

How to bind scroll event with angularJS on mobile

I want to trigger a function when a user scrolls down the page, both on desktop and mobile:

const doc = $document;
const viewport = angular.element(doc);

viewport.bind('scroll', myFunc);

myFunc is correctly invoked on desktop. Mobile doesn’t work (both device or emulator on chrome).

any idea why please?

CSS span effect not working when you rewrite span text with JS

So i was just creating a effect in css, and using js to rewrite what was in the text, but it broke the effect. without using js, and just writing the text in html works though.

I tried using element.textContent, and element.innerText, but still didnt work.

here is what i’ve gotten so far:

<div class='button default'><span>TEXT</span></div>
<div class='button changed'><span>DIFF</span></div>
.button {
  width: 75px;
  height: 20px;
  background: rgba(0, 0, 0, 1);
  color: white;
  position: absolute;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease, color 0.25s ease;
  top: 175px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.button:hover {
  transform: scale(1.25);
  background: rgba(200, 200, 200, 1);
  color: black;
}

.button span {
  position: relative;
  display: inline-block;
  overflow: hidden;
  z-index: 1;
}

.button span::before {
  content: " ";
  position: absolute;
  top: 15%;
  left: -5px;
  width: 15px;
  height: 15px;
  background-image: linear-gradient(to right, gold, yellow);
  transition: left 0.25s linear;
  overflow: hidden;
}

.button span:hover::before {
  left: 95%;
}

.button span:hover::before,
.button span::before {
  opacity: 1;
}

.button span::before {
  opacity: 0;
}

.default{
    position: absolute;
    top: 100px;
    left: 100px;
}

.changed{
    position: absolute;
    top: 200px;
    left: 100px;
}

let diff = document.querySelector('.button.changed');
diff.textContent = 'CHANGED'

Show chatboxes in popup windows just like in facebook web as well as in fullscreen view mode

I have setup conversejs in fullscreen view mode. Like in Facebook when you click on a chat it opens the chat in a popup window, i want the same functionality in Conversejs as well. Chat boxes will be in fullscreen view mode always but I can open the chatbox in popup window also, any help would be really appreiciated

I tried the overlayed view mode but than the chat is only in popup window not in fullscreen, I want it in both places at once.
I also tried making plugins for that by copy pasting chatbox views etc but that’s a very long way.

Creating a new xr event

I am trying to implement the equivalent of a “double-click” event for a hand-input controller to interact with a mesh in my three-js app. I wish to do this the following way :

-> I listen to a click

-> I check when was last click

-> if time between last click and current click < threshold

I dispatch an event

My issue is when I try to dispatch my custom event, I want to dispatch my event from my controller : XRTargetRaySpace. I can dispatch my event when I use the document to dispatch it.

Here is the interface that discribes the event map :

enter image description here

Here is my code

let deltaTime = 0,
    lastclick = 0,
    MAX_DELTA_TIME = 500;
const doubleClickEvent = new CustomEvent("sandbox:doubleClick", {
    bubbles: true,
    cancelable: true,
    composed: true,
    detail: {
        deltaTime,
    },
});

controller1.addEventListener("squeezestart", (_) => {
    deltaTime = window.performance.now() - lastclick;

    if (deltaTime < MAX_DELTA_TIME) {
        controller1.dispatchEvent(doubleClickEvent);
        lastclick = 0;
    }
    lastclick = window.performance.now();
});
controller2.addEventListener("squeezestart", (_) => {
    deltaTime = window.performance.now() - lastclick;

    if (deltaTime < MAX_DELTA_TIME) {
        document.dispatchEvent(doubleClickEvent);
        lastclick = 0;
    }
    lastclick = window.performance.now();
});

I expect to have something like :

controller1.addEventListener('sandbox:doubleClick', (e) => console.log(e)) 

where controller : XRTargetRaySpace | XRGripSpace | XRHandSpace

Alexa Skill cant reach file?

I’m encountering some difficulty while creating a new file to act as an Intent Handler for my Alexa skill. I’ve been trying to debug the issue but haven’t been able to pinpoint the exact cause. Due to confidentiality reasons, I’m unable to share the entire code snippet.

However, I can provide the relevant parts of my skill-handlers/test.js and index.js files:

skill-handlers/test.js:

const test = {
canHandle(handlerInput) {
const { request } = handlerInput.requestEnvelope;
return request.type === ‘IntentRequest’ && request.intent.name === ‘test’;
},
};

module.exports = test;

In the index.js file, I’ve imported everything correctly, as shown below:

const test = require(‘./skill-handlers/test’);

And here’s how I’ve set up the exports.handler in index.js:

exports.handler = Alexa.SkillBuilders.custom()
.addRequestHandlers(
test,
)

I isolated a functional intent handler into a Old file, keeping it in the same directory. Surprisingly, the handler starts to work in this old location. This suggests a potential issue with index.js’s ability to import code from new files.

Any insights into what might be causing the issue would be greatly appreciated! Thank you in advance for your help.

Fixing Programming Errors in Arduino project

i am currently working on my final year project here the system is intended to perform smart irrigation and send message when specific action is triggered, by the way the code is not working properly as it does not send the message , at some point it does not display information at all what it does is displaying unreadable characters, what could be wrong with the code? any improvements will be appreciated

#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
// Setup SoftwareSerial pins
SoftwareSerial mySerial(10, 11); // Change this to your correct TX and RX pins
// Initialize LCD
LiquidCrystal lcd(9, 8, 5, 4, 3, 2); // RS, EN, D4, D5, D6, D7
// Moisture Sensor Pins
int area_one_moisture_sensor = A0;
int area_two_moisture_sensor = A1;
int area_three_moisture_sensor = A2;
int area_four_moisture_sensor = A3;
// Relay Pins
int area_one_relay = 12;
int area_two_relay = 13;
int area_three_relay = 14;
int area_four_relay = 15;
// LED Pins
int LED1 = 6; // Indicate irrigation is on
int LED2 = 7; // Indicate irrigation is off
// SMS configuration
const char* recipient_number = "+255627410551";
bool is_area_one_irrigating = false; // Track irrigation status
bool is_area_two_irrigating = false; // Track irrigation status
bool is_area_three_irrigating = false; // Track irrigation status
bool is_area_four_irrigating = false; // Track irrigation status
void SendSMS(const char* message) {
  mySerial.println("AT+CMGF=1"); // Set SMS mode to TEXT
  delay(200); // Increase delay for GSM stability
  mySerial.print("AT+CMGS="");
  mySerial.print(recipient_number);
  mySerial.println("""); // Specify recipient
  delay(200); // Small delay
  mySerial.println(message); // SMS content
  mySerial.write(26); // Send ASCII 26 (Ctrl+Z) to end message
  delay(200); // Wait for GSM to process
}
void setup() {
  Serial.begin(9600); // Initialize Serial monitor
  mySerial.begin(9600); // Initialize GSM connection
  // Setup pin modes
  pinMode(area_one_moisture_sensor, INPUT);
  pinMode(area_two_moisture_sensor, INPUT);
  pinMode(area_three_moisture_sensor, INPUT);
  pinMode(area_four_moisture_sensor, INPUT);
  pinMode(area_one_relay, OUTPUT);
  pinMode(area_two_relay, OUTPUT);
  pinMode(area_three_relay, OUTPUT);
  pinMode(area_four_relay, OUTPUT);
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  // Initial LCD display
  lcd.begin(16, 2); // Initialize LCD
  lcd.print("Precision Irrigation");
  lcd.setCursor(0, 1);
  lcd.print("System");
  delay(2000); // Display welcome message for 2 seconds
}
void displayMoistureLevels(int m1, int m2, int m3, int m4) {
  lcd.clear();
  lcd.print("A1:");
  lcd.print(m1);
  lcd.print(" A2:");
  lcd.print(m2);
  lcd.setCursor(0, 1);
  lcd.print("A3:");
  lcd.print(m3);
  lcd.print(" A4:");
  lcd.print(m4);
}
void loop() {
  // Read moisture sensor values
  int area_one_moisture = analogRead(area_one_moisture_sensor);
  int area_two_moisture = analogRead(area_two_moisture_sensor);
  int area_three_moisture = analogRead(area_three_moisture_sensor);
  int area_four_moisture = analogRead(area_four_moisture_sensor);
  // Display moisture levels on LCD
  displayMoistureLevels(area_one_moisture, area_two_moisture, area_three_moisture, area_four_moisture);
  // Relay and SMS logic for area one
  if (area_one_moisture >= 400) { // High moisture, start irrigation
    digitalWrite(area_one_relay, LOW); // Relay ON
    digitalWrite(LED1, HIGH); // LED indicating irrigation is on
    digitalWrite(LED2, LOW); // Off LED on
    if (!is_area_one_irrigating) { // If not already irrigating
      SendSMS("Area One is being irrigated."); // Send SMS
      is_area_one_irrigating = true; // Set flag
    }
  } else { // Low moisture, stop irrigation
    digitalWrite(area_one_relay, HIGH); // Relay OFF
    digitalWrite(LED1, LOW); // Irrigation LED off
    digitalWrite(LED2, HIGH); // Off LED on
    if (is_area_one_irrigating) { // If was irrigating, send SMS about stopping
      SendSMS("Area One has stopped irrigation."); // SMS indicating irrigation stop
      is_area_one_irrigating = false; // Reset flag
    }
  }
  // Relay and SMS logic for area two
  if (area_two_moisture >= 600) { // High moisture, start irrigation
    digitalWrite(area_two_relay, LOW); // Relay ON
    digitalWrite(LED1, HIGH); // LED indicating irrigation is on
    digitalWrite(LED2, LOW);

    if (!is_area_two_irrigating) { // If not already irrigating
      SendSMS("Area Two is being irrigated."); // Send SMS
      is_area_two_irrigating = true; // Set flag
    }
  } else {
    digitalWrite(area_two_relay, HIGH); // Relay OFF
    digitalWrite(LED1, LOW); // Irrigation LED off
    digitalWrite(LED2, HIGH);
    if (is_area_two_irrigating) { // If was irrigating, send SMS about stopping
      SendSMS("Area Two has stopped irrigation."); // SMS indicating irrigation stop
      is_area_two_irrigating = false; // Reset flag
    }
  }
 // Relay and SMS logic for area three
  if (area_two_moisture >= 800) { // High moisture, start irrigation
    digitalWrite(area_three_relay, LOW); // Relay ON
    digitalWrite(LED1, HIGH); // LED indicating irrigation is on
    digitalWrite(LED2, LOW);
    if (!is_area_three_irrigating) { // If not already irrigating
      SendSMS("Area Three is being irrigated."); // Send SMS
      is_area_three_irrigating = true; // Set flag
    }
  } else {
    digitalWrite(area_three_relay, HIGH); // Relay OFF
    digitalWrite(LED1, LOW); // Irrigation LED off
    digitalWrite(LED2, HIGH);

    if (is_area_three_irrigating) { // If was irrigating, send SMS about stopping
      SendSMS("Area Three has stopped irrigation."); // SMS indicating irrigation stop
      is_area_three_irrigating = false; // Reset flag
    }
  }
   // Relay and SMS logic for area four
  if (area_two_moisture >= 1000) { // High moisture, start irrigation
    digitalWrite(area_four_relay, LOW); // Relay ON
    digitalWrite(LED1, HIGH); // LED indicating irrigation is on
    digitalWrite(LED2, LOW);
    if (!is_area_four_irrigating) { // If not already irrigating
      SendSMS("Area Two is being irrigated."); // Send SMS
      is_area_four_irrigating = true; // Set flag
    }
  } else {
    digitalWrite(area_four_relay, HIGH); // Relay OFF
    digitalWrite(LED1, LOW); // Irrigation LED off
    digitalWrite(LED2, HIGH);
    if (is_area_four_irrigating) { // If was irrigating, send SMS about stopping
      SendSMS("Area Four has stopped irrigation."); // SMS indicating irrigation stop
      is_area_four_irrigating = false; // Reset flag
    }
  }
  delay(2000); // Delay before next loop iteration
}

button on image with grids(Flutter)

im trying to make an image into multiple grids like one image into 9 equal parts or anything based on the shape of a door or a model of a door but the problem is i’m not understanding how to add a button over that and when i click on it,different dropdown should open for every single image grid and doing this using flutter.Please help me.Thank you

i tried using html still a lot of errors so just give a sample code

How to send buffer in Node.js via fetch without get any warning?

I get this warning when seding buffer:

(node:12) ExperimentalWarning: buffer.File is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

Here the code, how can I make it right, not get the Node.js warning?

    const blob = new Blob([xml], { type: 'text/plain' })
    const formData = new FormData()
    formData.append('action-xmlagentxmlfile', blob, 'xmlfile.xml')
    const response = await fetch(`https://www.szamlazz.hu/szamla/`, {
        method: 'POST',
        body: formData,
    })
    const text = await response.text()
    await db.collection('logs').insertOne({
        service: 'prepareAndSendInvoice',
        createdAt: new Date(),
        severity: 'log',
        message: 'Sending invoice response received',
        status: response.status,
        text,
    })
    if (response.status === 200 && !response.headers.has('szlahu_error')) {

How to force new line by textarea in textFit library create by STRML

Since about a week I try to solve that problem. I’m using this library https://github.com/STRML/textFit and I’m try to report this problem but nobody response.

My code: https://codepen.io/Mativve/pen/RwmwRxa

<textarea id="my_field" cols="30" rows="4"></textarea>

<div id="preview"></div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/textfit/2.4.0/textFit.min.js"></script>
<script>
let my_field = $("#my_field");
let preview = $("#preview");

my_field.on("input", () => {
    preview.text( my_field.val().replace(/n/g, 'n') );
    
    textFit( preview[0], {alignHoriz: false, alignVert: false, minFontSize:10, maxFontSize: 30, reProcess: true, multiLine: true, detectMultiLine: false, widthOnly: false, alignVertWithFlexbox: false} );
});
</script>

I’m tried to replace n with regex etc. I don’t want to using .html to fill the preview because the bad users could use this to XSS (I think).

I don’t know what I’m doing wrong :/ Anybody has any idea how to solve this problem?

Toast In PHP native not working on Success Side

I have this code in my PHP server side block that defines the TOAST functionality


 // Define the HTML code for the toast element
echo '<div class="toastNotif hide">
    <div class="toast-content">
        <i class="bx bx-check check"></i>
        <div class="message">
            <span class="text text-1"></span>
            <!-- this message can be changed to "Success" and "Error"-->
            <span class="text text-2"></span>
            <!-- specify based on the if-else statements -->
        </div>
    </div>
    <i class="bx bx-x close"></i>
    <div class="progress"></div>
</div>';

// Define JavaScript functions to handle the toast
echo '<script>
    function showToast(type, message) {
        var toast = document.querySelector(".toastNotif");
        var progress = document.querySelector(".progress");
        var text1 = toast.querySelector(".text-1");
        var text2 = toast.querySelector(".text-2");
        
        if (toast && progress && text1 && text2) {
            // Update the toast content based on the message type
            if (type === "success") {
                text1.textContent = "Success";
                toast.classList.remove("error");
            } else if (type === "error") {
                text1.textContent = "Error";
                toast.classList.add("error");
            } else {
                console.error("Invalid message type");
                return;
            }
            
            // Set the message content
            text2.textContent = message;
            
            // Show the toast and progress
            toast.classList.add("showing");
            progress.classList.add("showing");
            
            // Hide the toast and progress after 5 seconds
            setTimeout(() => {
                toast.classList.remove("showing");
                progress.classList.remove("showing");
                 window.location.href = "staff_log.php";
            }, 5000);
        } else {
            console.error("Toast elements not found");
        }
    }

    function closeToast() {
        var toast = document.querySelector(".toastNotif");
        var progress = document.querySelector(".progress");
        toast.classList.remove("showing");
        progress.classList.remove("showing");
    }
</script>';

This code does work on this Error Trapping

// Check if the form is submitted and Borrower ID is provided
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['borrower_id'])) {
    // Database connection
    $conn = mysqli_connect("localhost", "root", "root", "db_library_2", 3308); 
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }


    // Retrieve Borrower_ID from the form
    $borrower_id = $_POST['borrower_id'];
    if (substr($borrower_id, 0, 1) === '0') {
        // Borrower_ID starts with '0', flag as error
          echo '<script>
    // Call showToast with "error" message type after encountering an error
    showToast("error", "Error Entry.");
</script>';

    } 

However on the success side the TOAST does not show the UI and just display Success then redirect as it should be after 5 seconds,

 else {
            // Validate Borrower_ID against tbl_borrower table
            $sql_validate_borrower = "SELECT * FROM tbl_borrower WHERE Borrower_ID = '$borrower_id'";
            $result_validate_borrower = $conn->query($sql_validate_borrower);

            if ($result_validate_borrower->num_rows > 0) {
                // Borrower_ID is valid
                $isBorrowerIdValid = true;
                $_SESSION['borrower_id'] = $borrower_id;

                // SQL query to insert data with auto-increment Log_ID and current timestamp
                $sql = "INSERT INTO tbl_log (Borrower_ID, `Date_Time`) 
                VALUES ($borrower_id, NOW())";

                if ($conn->query($sql) === TRUE) {
                    // echo '<script>alert("Record inserted successfully."); window.location.href = "staff_log.php";</script>';
                 echo '<script>
        // Call showToast with "success" message type after successful insertion
        showToast("success", "Record inserted successfully.");
    </script>';

it does not display the UI with the success “Record Inserted Succesfully”

but display showToast Error on the error trapping code line

i have tried this code on other page and the success does show with it’s appropriate styling

Did i mess something up or what

i wanted to display the success on this page yet it does not show with the styling