Streaming in ReactJs

I Want to Stream The response that is coming from api(streaming api) is there any ways to do it i did it with fetch and readableStream streaming is happening but data is breaking

How to create Grid path using latitude-longitude coordinates

Hello everyone,

Is there a way to select Geo coordinates (lat, long) every 3 meters On the edges of a given rectangle with python or javascript? has anyone tried it before? i am new to the topic. Any help would be appreciated. what does the operation i am trying to achieve is called in the terminology?

Thanks

Example coordinates:

45.6919794696714 4.83314484357834
45.6918089750442 4.83493119478226
45.6912450275745 4.8348480463028
45.6914155239208 4.83298122882843

Expected output

2       45.69142670 4.83298450
3       45.69135210 4.83367540
4       45.69145320 4.83299220
5       45.69125270 4.83484920
6       45.69127960 4.83485310
7       45.69147970 4.83299990
8       45.69150620 4.83300750
9       45.69130640 4.83485710
10      45.69133330 4.83486110
11      45.69153270 4.83301520
12      45.69155920 4.83302290
13      45.69136020 4.83486500
14      45.69138710 4.83486900
15      45.69158570 4.83303060
16      45.69161210 4.83303830
17      45.69141400 4.83487300
18      45.69144090 4.83487690
19      45.69163860 4.83304600
20      45.69166510 4.83305360
21      45.69146780 4.83488090
22      45.69149460 4.83488480
23      45.69169160 4.83306130
24      45.69171810 4.83306900
25      45.69152150 4.83488880
26      45.69154840 4.83489280
27      45.69174460 4.83307670
28      45.69177100 4.83308440
29      45.69157530 4.83489670
30      45.69160220 4.83490070
31      45.69179750 4.83309210
32      45.69182400 4.83309970
33      45.69162910 4.83490470
34      45.69165600 4.83490860
35      45.69185050 4.83310740
36      45.69187700 4.83311510
37      45.69168280 4.83491260
38      45.69170970 4.83491660
39      45.69190350 4.83312280
40      45.69193000 4.83313050
41      45.69173660 4.83492050
42      45.69176350 4.83492450
43      45.69195640 4.83313820
44      45.69195240 4.83342830
45      45.69179040 4.83492850

enter image description here

How to break dynamic to the next line inside if there is more in a column using html css?

I am learning HTML and CSS. I am creating a table and inside it there is dynamic data.

In the below code I am using dynamic

  • inside a .

    But the problem is that the

  • data goes or overrides into next column as shown in below image. I want to break the
  • into next line and start below the first input box and continue that process.

    How to achieve that any solution for that?
    Code:

    HTML

             <td>
                  <div class="dataset_number_container">
                    <div class="dataset_number">
                      <!-- <p>Dataset Number</p> -->
                  <input type="number" min="1" max="100" onkeypress="event.charCode >= 48" class="form-control datasetNo"
                    placeholder="" [(ngModel)]="batchNumSmartData[i]" (blur)="getRangeSmartData(experimentnNamesmartdata[i], newDataset)"
                    name="minBatchNum">
                    </div>
                    <div class="existing_number" *ngIf="newsmartDataset[i]">
                      <!-- <p>Existing Dataset Number</p> -->
                      <ul>
                        <li *ngFor="let row of existingSmartDatasetBatches[i]">
                          <input type="number" disabled = "true" value="{{row.batch_number}}">
                        </li>
                      </ul>
                    </div>
                  </div>
                </td>
                <td>
                  <input type="text" class="form-control" placeholder="Objective" [(ngModel)]="Objectivesmartdata[i]" name="Objectivesmartdata" (change) = "changesmartobjective($event.target.value, i)">
            </td>
    

    CSS

    .dataset_number_container{
                        display: grid;
                        grid-template-columns: 32% 62%;
                        column-gap: 6%;
                        .dataset_number{
                            input{
                                width: 60px;
                            }
                        }
                        .existing_number{
                            width: 100px;
                            // margin-left: 10px;
                            ul{
                                list-style: none;
                                padding: 0;
                                margin: 0;
                                display: flex;
                                align-items: center;
                                vertical-align: middle;
                                // flex-wrap: wrap;
                                width: 100px;
                                li{
                                    width: 40px;
                                    height: 35px;
                                    // margin-right: 5px;
                                    // margin-bottom: 5px;
                                    display: inline-block;;
                                    justify-content: center;
                                    align-items: center;
                                    background: #F5F6FA;
                                    border-radius: 4px;
                                    font-weight: 500;
                                    input{
                                        width: 40px;
                                        height: 35px;
                                        text-align: right;
                                    }
                                }
                            }
                        }
                    }
    

    What I am getting
    enter image description here

  • WordPress error popup on custom admin page after upgrading from 5.4

    I inherited a site that was grossly outdated and have been systematically upgrading the WP Core and its plugins so that it is mostly up to date. However I am now receiving and error on one of my custom admin pages that I have been unable to debug this Dev Tools. I

    error popup

    When debugging WP all I am receiveing is

    <b>Notice</b>:  Trying to access array offset on value of type bool in <b>/www/dreamrides_499/public/wp-content/themes/understrap-child/admins/custom_admin_header.php</b> on line <b>24</b><br />
    

    This however is unrelated as it refers to a meta field reference.

    <?php if(get_field( 'profile_image', 'user_'.get_current_user_id().'' )['url']): ?>
    

    The error itself relates to the booking plugin

    <script id='wc_bookings_admin_edit_booking_js-js-extra'>
    var wc_bookings_admin_edit_booking_params = {"invalid_start_end_date":""Start and end date" should be of the format yyyy-mm-dd and cannot be empty.","date_range_invalid":"Start date cannot be greater than end date."};
    </script>
    

    Any assistance here would be a great help.

    componentWillUnmount and setState to open Dialog to confirm a save of data

    I currently have a componentWillUnmount used specifically to check if a user wants to save their data, if it has not been saved already.
    I created a custom prompt using Material UI’s dialog, which is opened via a state change.
    Before I was simply using a window.confirm, but now that i want to use the custom prompt, I cannot, due to componentWillUnmount being a final render in the process.

     componentWillUnmount = async () => {
        if (this.documentChanged !== false) {
            if (this.locationState.document_format_id === 2 || this.locationState.document_format_id === 1) {
                this.promptActionTracker = "component_exit";
                this.dialogTitle = "Exiting Component";
                this.dialogText = "Do you wish to save document data?";
                this.errorType = "information";
                this.setState({dialogOpen: true});
            }
        }
    };
    

    How do I go about opening the prompt, letting the user click “Ok” or “Cancel”, process that action, and only then unmount the component?

    How do I add virtual slides with Swiper.js using ngx-swiper-wrapper

    I have no problem with creating slides and using swiper with the ngx-swiper-wrapper library for Angular. I now realize I might have 300+ slides, so I want to utilize the virtual slide feature.

    My first example is what I currently do to add regular slides. It works fine and I can add new slides as the user swipes forward, loading new slides until all members have been loaded. But I assume if 100+ members are loaded it might crash the DOM or use a large amount of memory, so I’d like to use swipers virtual slides feature.

    Problem – Using the ngx-swiper-wrapper library, I can’t figure out how to add virtual slides after the slide event “slideNextTransitionStart” because I can’t access the virtual slides parameters from the component in my .ts file.

    Here’s what I currently do to add regular slides to my slider (works fine).

    memberSwiperConfig: SwiperConfigInterface = {
      preloadImages: false,
      lazy: true,
      slidesPerView: 1,
      spaceBetween: 10,
      watchOverflow: true,
      navigation: true,
      grabCursor: true,
      breakpoints: {
        // left out for verbosity
      }
    };
    
    ngOnInit(): void {
      this.service.getMembers(this.band.id, this.skipMembers, this.takeMembers).subscribe(members => {
        this.members = members;
      }, error => {
        console.log(error);
      });
    }
    
    slideNextTransitionStart() {
      if (this.skipMembers < this.band.members) {
        this.service.getMembers(this.band.id, this.skipMembers, this.takeMembers).subscribe(members => {
          this.members[this.skipMembers] = members[0];
          this.skipMembers += 1;
        }, error => {
          console.log(error);
        });
      }
    
    }
    <swiper [config]="memberSwiperConfig" [(index)]="memberIndex" (slideNextTransitionStart)="slideNextTransitionStart()">
      <app-member-card *ngFor="let member of members" class="router-link" [routerLink]="['/members', member.name]" [MemberCard]="member"></app-member-card>
    
    </swiper>

    Here is what I’ve tried to add virtual slides.

    1. set a virtual property from this codepen example in the config section works but I don’t want to add them here, I want to add some initially in ngOnInit() and then load more on next events.
    memberSwiperConfig: SwiperConfigInterface = {
      virtual: {
        slides: (function() {
          var slides = [];
          for (var i = 0; i < 600; i += 1) {
            slides.push(
              '<img src="https://picsum.photos/600/600/?image=' +
                (i + 1) +
                '"/><p>' +
                (i + 1) +
                "</p>"
            );
          }
          return slides;
        })()
      }
      // everything else is the same from above
    };
    1. I try and access the component in ngOnInit to load slides into the virtual.slides property, but I see a red underline when accessing it from both the component and from the config property.
      FYI – If I put in a breakpoint on that line, leave out the slides property and break the debugger on that line, I can see the property while debugging, but I can’t access the property to add/remove slides.

    enter image description here

    // get the swipercomponent
    @ViewChild(SwiperComponent) swiperComponent: SwiperComponent;
    
    
    // ngOnInit
    
    ngOnInit() {
      // tried accessing the slides from both the component and config section
      // but both slides property show me a red underline saying slides doesn't exist
      this.swiperComponent.config.virtual.slides
      this.memberSwiperConfig.virtual.slides
      // this doesn't work
      this.swiperComponent.config.virtual?.slides;
      this.memberSwiperConfig.virtual?.slides
    }
    
    // also slides is a VirtualOption from the library?? so not sure how to access it here to add a virtual slide

    Camera does not disconnect while using MediaDevices.getUserMedia() API

    I am using navigator.mediaDevices.getUserMedia to access the user’s camera in a video-conferencing application.
    below is the logic that I found from the MediaStream.getUserMedia() API documentations:

    
        const videoRef = useRef();
        const userCameraCapture = async cameraIsOn => {
                if(cameraIsOn){
                    let stream = await navigator.mediaDevices.getUserMedia({video:true,audio:false});
                    videoRef.current.srcObject = stream;
                }else{
                    videoRef.current.srcObject.getTracks(track => track.stop());
                    videoRef.current.srcObject = null;
                }
            }
    
    

    when I try to turn off the camera, the video stream on the application stops but the camera still stays On.
    how can I disconnect the camera?

    mongoose .find within loop

    I have a mongoose model called Class, which I am trying to access within a loop, because there are values that I need to compare from an original query to another model. Let me show you below:

     let rE = await cR.find({number: "xxxxxx"})
    
    for (var i = 0; i < rE.length; i++) {
        let theFinalData = await Class.find({_id: rE[i].c_id}).then((err, data) => {
            if (err) {
                console.log(err)
            }
            console.log(data)
        })
    }
    

    however, this doesn’t work. The console.log(data) returns undefined, and even if i log theFinalData, it does the same thing. Not sure what I am doing wrong. Ideally I need theFinalData results to be pushed to an array, so I thought to do array.push(await Class.find({_id: rE[i].c_id})), but that didn’t work either.

    could someone steer me in the right direction?

    Error while importing JQuery library net::ERR_Aborted 404

    Working on a Java project in eclipse ide. I downloaded and added JQuery library in my Web/module_name/WebContent/js folder. In my code I have imported the file as:

    <script src="/module_name/js/jquery-1.12.4.js"></script>

    When I run the server, I am getting error as net::ERR_Aborted 404 nad the address in the error line is showing as:

    GET http://localhost:8080/module_name/js/jquery-1.12.4.js net::ERR_ABORTED 404

    How do i store a list of json values into a json file while inside a for loop

    In short, i’m trying to generate a random number of email with a hash password (from random email string). Then store each pair into a json file that would like this

    {
    "email":"[email protected]","password":"302e5bc54727",
    "email":"[email protected]","password":"7f90bb016e0b",
    so on and so on
    }
    

    *** changing “const numberOfCredentials = 3” should provide me with X number of accounts.

    Thank you very much for the help!!

    https://codepen.io/usmcpablo/pen/yLvxOrK

    sorry, could not get it to work on codepen either ;(

    Synchronize scroll of two textarea

    Im writing an ReactJs app simulating a text editor for coding. I have a textarea that show the line count, and the other one has all the code that the user will be writing. I’ve tried using this method:

    textEditor.onScroll = (e)=>{
        linecount.scrollTop = textEditor.scrollTop;
        linecount.scrollLeft = textEditor.scrollLeft;
    };
    

    But the browser console throws this error: Uncaught TypeError: can’t define property “onScroll”: Object is not extensible. I suppose that this happens because both textarea are declared as:

    var textEditor = React.createElement("textarea",{id:"textEditor"});
    var linecount = React.createElement("textarea",{id:"linecount"});
    

    And not as document.getElementbyid… How could I synchronize the scroll of the textEditor to the linecount?

    Angular AWS Signed Url extends expiration date

    I’m working in an Angular 13 app which downloads many large files (Up to 10GB per file), All the files are stored in a S3 Bucket. The problem is that when I click the download button, the download starts, but becouse the size of the file is too large, the Signed URL expires before the download ends.

    This is my code to generate the signed url to the S3 and download with the link

        getS3Link(link: string) {
          AWS.config.update({ httpOptions: { timeout: 0 } });
          const BUCKET = new S3({ accessKeyId: environment.IAM_USER_KEY, secretAccessKey: environment.IAM_USER_SECRET, region: environment.REGION , params: { Bucket: environment.BUCKET_NAME } });
          const FILE_KEY = `${link}`;
          const PARAMS = { Bucket: environment.BUCKET_NAME, Key: FILE_KEY  };
          return BUCKET.getSignedUrlPromise('getObject', PARAMS);
        }
    

    is there any way to extend the expiration time of the generated link?

    thank you very much.