I have been working on an InDesign script that will select the actual image inside of a graphic frame … is this possible

Here is where I’m at:

// Check if any document is open
if (app.documents.length > 0) {
    var doc = app.activeDocument;

    // Check if any frame is selected
    if (doc.selection.length > 0 && doc.selection[0].constructor.name == "Rectangle") {
        var selectedFrame = doc.selection[0];

        // Check if the selected frame contains any graphics
        if (selectedFrame.allGraphics.length > 0) {
            // Select the first graphic inside the frame (assuming it's an image)
            var graphic = selectedFrame.allGraphics[0];
            graphic.select();
        } else {
            alert("The selected frame does not contain any graphics.");
        }
    } else {
        alert("Please select a frame to proceed.");
    }
} else {
    alert("No document is open.");
}

when I have the frame selected and run the script, nothing happens. I do get an alert if I don’t select a frame. I have tried many variations of this but get nowhere. I AM VERY NEW TO CODING but learning a lot on here. thank you

renders twice when using Vuedraggable in Vueitfy 3

I would like a simple table where I could drag and drop rows to reorder them. The problem I’m having right now is that the tbody is rendered twice, which messes up the layout. I see examples for Vue/Vuetify 2 but that doesn’t work anymore in Vuetify 3.

An example for version 2 can be found here https://codesandbox.io/p/sandbox/vuetify-v-data-tables-draggable-with-slots-1lecb?

This is my current code for Version 3:

<v-data-table
  class="table-todo"
  :items="items"
  :headers="headers">
  <template v-slot:body="{ items }">
    <draggable
      :list="items"
      item-key="name"
      tag="tbody"
      >
      <template #item="{ element }">
        <tr>
          <td>{{ element.name }}</td>
          <td>{{ element.light }}</td>
          <td>{{ element.height }}</td>
          <td>{{ element.petFriendly }}</td>
          <td>{{ element.price }}</td>
        </tr>
      </template>
    </draggable>
  </template>
</v-data-table>

The result in the browser:
enter image description here

Side note: the current elements are draggable, but as soon as I drop one they snap back to the original position, not sure if this is related or not. Still looking for a solution to that aswell.

I tried to play around with removing the tbody tag on the draggable element but that just renders a div with the rows instead of the tbody, which also places them in all in the first

Main Thread Blocked by File Uploading in WebKit Directory Input

When attempting to upload a large number of files (not necessarily large in size, but in terms of quantity) via a Web Kit Directory type input in the browser (not on the server), the main thread becomes blocked, causing the UI to freeze. How can I move this file uploading process to a worker thread?

I’ve searched extensively, but most of the information I find relates to server-side issues related to file size, not the number of files being uploaded in the browser.

React Router DOM v6: Infinite Redirect Loop when using redirect in route loader

I have a simple application using the new v6 APIs from react-router-dom. My app routes are defined below:

import { Footer, Layout } from "@org/components-library";
import { Outlet, redirect, type RouteObject } from "react-router-dom";

import { AppNavbar } from "./AppNavbar";
import { NotFound } from "./pages/NotFound";
import { OnePager } from "./pages/OnePager";

const AppRoutes: RouteObject[] = [
  {
    path: "/",
    element: (
      <Layout navbar={<AppNavbar />} footer={<Footer />}>
        <Outlet />
      </Layout>
    ),
    children: [
      {
        path: "/one-pager",
        element: <OnePager />,
      },
      {
        path: "/",
        loader: () => redirect("/one-pager"),
      },
      {
        path: "*",
        element: <NotFound />,
      },
    ],
  },
];

export default AppRoutes;

Hopefully the intent here is very clear but if the user hits the root route /, then they should get redirected to /one-pager. The problem is, when I do this, my app somehow gets into an infinite redirect loop that never resolves. This infinite loop for some reason also only happens when I deploy my app to my Kubernetes cluster and it does not happen in local dev when I run with pnpm start. I have tried making the loader function async to see if returning a Promise<Response> would change anything but it did not work.

Curious if others have encountered this issue?

Next.js 13 Image is not loading when deployed on server (Working fine locally)

I am using next.js Image component for image, by default image is optimized in Image component but it is not loading when deployed. when passing unoptimized props then image is loading on server.

I need optimization as this will help in lazy loading and cache of image.

       <Image
           src={LabTestestIcon}
                alt="lab tested verified icon"
                className="h-16 w-16"
                unoptimized
           />

Image is located in public folder and is in webp format.

Trying to make a single page application using window.onpopstate

I have something like a single page web application. To handle a back button click from the user I use the ‘popstate’ event

Here it is:

window.addEventListener('popstate', function () { 
      
   backOneStep(0); // do my own job (get user to previous application screen)
   history.pushState(null, null, '');

});

In Firefox and Safari, the event works fine. When the user presses the “back” button – backOneStep is executed

For a long time everything was fine, but! But in Chrome, after the latest updates, the popstate event is not firing if the previous history.pushState call was initiated from code

So:
If you press the back button once, you will find yourself one screen of the application back.

If you press the button a second time, you will be kicked out of my application 🙁

What confusing me – if you click anywhere on the page before the second click, the event will fire a second time too

I made simple example – https://w.ip.cv.ua/popstate.html

How can I use excel export to a paginated gridview yii2?

Good evening, everyone.
I am using Yii2Framework and as a result of filters, I want to export these to csv using yii2kartik‘s GridViewcomponent or using ExportMenualso from yii2kartik.

My dataProvider, however, is paginated and the results, therefore, are obtained via AJAX.
Currently, I rebuild the csv file myself when I click on an “Export” button but this involves me rebuilding all the queries, doubling the computational time.

Is there any way to use these components with a paginated gridview?
Thank you all!

I am trying to make full use of the https://demos.krajee.com/grid component and https://demos.krajee.com/export, but I find difficulty when the dataProvider is paged.

I expect that, regardless of paging, that component will help me export the csv in one go, speeding up my execution process.

I am trying to link geographic data and timestamps in R

I have some data that I am working on for a project that involves plotting data collected from the same location over multiple weeks. I am trying to get a map that only displays the markers that correspond to the date on the time slider, like the leaftime package allows for. However, when I run this code, the markers are all displayed at once, probably because I used the addMarker() in my leaflet map to get popups. So, I am mainly asking if there is a way to either hide markers that do not correspond to the current date on the time slider, or I would like for a way to include popup information on the leaftime markers that are included on the slider. Some example code below.

library(dplyr)
library(lubridate)
library(leaflet)
library(leaftime)

#creating the data frame 
ex_df <- data.frame(location = c('park', 'shopping center', 'school', 'library'),
                latitude = c(50.432543,50.438524,50.445140,50.399818),
                longitude = c(-78.534095, -78.567779,-78.523978,-78.507879),
                count_1 = c(234, 3565, 4, 95),
                count_2 = c(3, 6759, 280, 4820),
                start = c('7/24/1999', '7/31/1999', '8/7/1999','8/19/1999'),
                end = c('7/25/1999','8/1/1999','8/8/1999','8/20/1999'),
                detected = c('detected', 'detected', 'not detected', 'detected'))

#change some of the values to dates and add the week of collection

ex_df<-ex_df %>% 
  mutate(start = mdy(start)) %>% 
  mutate(end = mdy(end)) %>% 
  mutate(week = epiweek(start))
#add the popup
ex_df<-ex_df %>% 
  mutate(popup_tab = paste0("<b>location:<b>",
                    location, "<br>",
                    "<b>count_1:<b>",
                    count_1, "<br>",
                    "<b>count_2: <b>",
                    count_2, "<br>",
                    "<b>detected: <b>",
                    detected, "<br>"))

#change to a geojson object because thats what leaftime wants 
ex_geo <- geojsonio::geojson_json(ex_df, lat = "latitude", lon = "longitude")


#create the leaflet map . 
leaflet(ex_geo) %>% 
  addTiles() %>% 
  addMarkers(data = ex_df,
               lng = ~longitude, lat = ~latitude,
              label = ~paste0("Week:", week),
               popup = ~popup_tab,
         clusterOptions = markerClusterOptions()
         ) %>%
  #creates the time slider
  addTimeline(
    sliderOpts = sliderOptions(
      formatOutput = htmlwidgets::JS(
        "function(date) {return new Date(date).toDateString()}"
      ),
    position = "topright",
    step = 4,
    duration = 3000,
    showTicks = TRUE))

Sorting grid items vertically not working

My layout looks like :

1 2 3
4 5

But I need my layout to look like:

1 3 5
2 4

Of course, number of items is not fixed, so it can have n list items.

When I set grid-auto-flow: column; my grid stops working and all items are in same row.

How can i fix that? Thank you.

.link-list-grid {
  display: grid;
  gap: 10px;
}

.link-list-grid-1 {
  grid-template-columns: repeat(1, 1fr);
}

.link-list-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.link-list-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.standardTextImage .content ul.linklist li a {
  color: #08107B;
}

.standardTextImage .content ul.linklist li a:hover {
  color: #0787c5;
}

.standardTextImage .content ul.linklist li a:hover i {
  color: #0787c5;
}

@media (max-width: 768px) {
  .link-list-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}
<ul data-number-columns="3" class="linklist link-list-grid link-list-grid-3">
  <li>
    <a href="http://google.com" title="" target="_blank">1<i class="icon icon-angle-right"></i></a>
  </li>
  <li>
    <a href="http://google.de" title="" target="_blank">2<i class="icon icon-angle-right"></i></a>
  </li>
  <li>
    <a href="http://google.com" title="" target="_blank">3<i class="icon icon-angle-right"></i></a>
  </li>
  <li>
    <a href="http://google.com" title="" target="_blank">4<i class="icon icon-angle-right"></i></a>
  </li>
  <li>
    <a href="http://examplecom.de" title="" target="_blank">5<i class="icon icon-angle-right"></i></a>
  </li>
</ul>

wrong url href after for downloading file

I have the following code, I want to download the files stored in my Firebase Storage:

const downloadFile = (url, filename) => {
    const link = document.createElement('a');
    link.href = url;
    console.log(url)
    link.download = filename;
    link.click();
    link.remove();
 };

Pulling the files:

try {
      const files = [];
            const listRef = ref(storage, `files/events/${path}/thumnails`);
            const {items} = await listAll(listRef);
            for (const itemRef of items) {
                const downloadURL = await getDownloadURL(itemRef);

                await downloadFile(downloadURL, itemRef.name);
                files.push(
                        {
                            imgName: itemRef.name,
                            imgUrl: downloadURL
                        }
                    );
            }
            setImages(files);
        } catch (error) {
          console.error(error);
        }

I get the following error:

404 Bad request
https://firebasestorage.googleapis.com/v0/b/boda-1c364.appspot.com/o/files/events/x5JlZKysM7NhXx1Awv6ljGY3jUA2/thumnails/9ED15BA2-A95B-4A2E-8BF5-24743F8FCF8B_200x200.jpeg?alt=media&token=ee3c5679-a17c-4a63-b650-506fd1fde654

This is what appears in my img tag after the downloadLinkUrl has been set as the img src, and the image does display correctly.

https://firebasestorage.googleapis.com/v0/b/boda-1c364.appspot.com/o/files%2Fevents%2Fx5JlZKysM7NhXx1Awv6ljGY3jUA2%2Fthumnails%2F9ED15BA2-A95B-4A2E-8BF5-24743F8FCF8B_200x200.jpeg?alt=media&token=ee3c5679-a17c-4a63-b650-506fd1fde654

Is it possible to hook a non-configurable property like window.location.hostname, in JavaScript?

I would like to know if there is a way to hook a non-configurable property, like window.location.hostname.

By this, I mean if it’s possible to get an event/do something when a non-configurable property is accessed?

For example, it is currently possible to be notified and to do something when the window.navigator.userAgent property is called:

(function() {
    var userAgent = window.navigator.userAgent;
    Object.defineProperty(window.navigator, "userAgent", {
        get: function() {
            console.log("hello from useragent");
            return userAgent;
        }
    });
})(); 

However, in my case, I need to do the same thing when the window.location.hostname property is accessed, but I can’t find anything that allows me to do this.

Thank you very much for your help,

Bests!

contextMenu event doesn’t properly assign top attribute

I used other examples I’ve found to create two fiddles to invoke a custom context menu. In the first, it’s barebones and it works as expected, namely: set a previously hidden div to visible and move it to the top and left position of the mouse click.

https://jsfiddle.net/wolfie7873/unp53bhs/

In the simple example, the rightmost 2 columns have the custom contextmenu and the div appears where one right-clicks.

Trying to incorporate this into my actual use-case, and things don’t work quite the same. Specifically, the visibility property as well as the left property are dynamically changed as expected, but the top property stays as the default of 0. You can see this in the second fiddle:

https://jsfiddle.net/wolfie7873/ksm8cxrb/

In this one, the columns with the pale-yellow headers are the ones that should invoke the contextMenu. The div for the context menu appears, but always at the top of the page.

Why isn’t the top attribute being properly reassigned?