Need help in placing label immediately after text

I am trying to place a label WIP (work in progress) immediately after text inside a disabled input box. I have tried few css configs but unable to achieve desired result.

Getting any help me really good for me.

Current code:

label.label-class {
    font-size: 12px;
    letter-spacing: 0.3px;
    position: absolute;
    left: 160px;
    bottom: 13px;
  }


<div class="myclass">
    <mat-form-field class="form-input" appearance="outline">
        <mat-label>MyLabel</mat-label>
        <input matInput [disabled]="true" [ngModel]="getName()" />
        <label class="label-class"> WIP </label>
    </mat-form-field>
</div>

Here is how it is appearing right now:

enter image description here

GoogleSignIn Authentication in React Native

I’m confused related to the GoogleSignIn Logout first I’ve managed to SignIn my google account, the problem is when I logout my google account, and SignIn again the previous account that you login before it didn’t ask the password like the image below when I click one of user account it will go to my home screen directly instead asking password for that google account since I’ve already logout the account in my app.

enter image description here

This is my logout function I tried the code below it works in some other way but my concern is since I’ve already logout the account it should not directly go to homepage when SignIn again ask password to the user or remove user when logout? What is the best way should I do, do I correcly implement it?

   const [user, setUser] = useState(null);
   logout: async () => {
      try {
        await GoogleSignin.revokeAccess();
        await GoogleSignin.signOut();
        setUser({ user: null });
        await auth().signOut();
        
      } catch (e) {
        console.log(e);
      }
    },

GoogleSign function

  return (
    <AuthContext.Provider
      value={{
        user,
        setUser,
        googleLogin: async () => {
          try {
            // Get the users ID token
            const Token  = await GoogleSignin.signIn();
            const {idToken} =  Token;
            
            // Create a Google credential with the token
            const googleCredential = auth.GoogleAuthProvider.credential(idToken);
        
          
            // Sign-in the user with the credential
            await auth().signInWithCredential(googleCredential)            
            .catch(error => {
                console.log('Something went wrong with sign up: ', error);
            });
          } catch(error) {
            console.log({error});
          }
        },
      }}>
      {children}
    </AuthContext.Provider>
  );

How to add Icon as marker on svg map / React.js

I simply want to add custom icon on a city .

I use react turkey map svg as api and I can just catch the city data element .

How can I add a marker on this city element ?

API link -> API

    const onMapHover = (data) => {
     if (data.id === "istanbul") {
     const element = document.getElementById(data.id);  
  }
};

How to get a “for loop” to display the result

I’m working on the first week of the Duke Learn to Program coursera course. I’m on the “for loops” section trying to create a simple loop that will first: Create a black 2×2 image using dukes built in “simpleImage” method and second: use a for loop to turn all the pixels in the image yellow. Here is the code I am using below:

    var img = new SimpleImage(2,2);
print(img);

for (var pixel of img.values());{
    pixel.setRed(255);
    pixel.setGreen(255);
    pixel.setBlue(0);
}
print(img);

The issue I’m running into using this code, is the final result where of print(img) is simply printing a second black square. My code is either failing to change the pixels, or I’m failing to understand how to display the output. Any help is appreciated!

How to display the drag area div and remove image on the drag area div in javascript?

This is my html code snippet:

<div class="container-fluid">
    <div class="drag-area">
        <span class="header"> Drag & Drop </span>
        <span class="header"> or <span class="browse_button">browse</span> </span>
        <input type="file" hidden/>
    </div>
    <button type="button" id="reset_button" class="btn btn-outline-secondary" 
    disabled="disabled">Reset</button>
    <button type="button" id="convert_button" class="btn btn-primary" 
    disabled="disabled">Convert</button>

Drag&Drop div visible

And this is my javascript code snippet:

const dragArea = document.querySelector('.drag-area');
const dragText = document.querySelector('.header');

let button = document.querySelector('.browse_button');
let input = document.querySelector('input');
let reset_button = document.querySelector('#reset_button');
let convert_button = document.querySelector('#convert_button');

// When reset button clicked
reset_button.onclick = () => {
    input.value = "";
    console.log(input.value);

    document.getElementById('nnn').remove(); // This is image id

    reset_button.disabled = true; // To disable reset button
    convert_button.disabled = true; // To disable convert button

    dragArea.classList.remove('active');
    result_div.classList.add('result_none_class'); // Add result_none_class class into 
    result_div to hide this result div
}

When I clicked on reset button I can remove the image from the div but the drag and drop div not display which is shown in first image above it’s show like this_

Image removed but drag&drop div not visible as shown in first image

Can anyone please tell me how can I display drag and drop screen on reset button clicked?

Show multiple ads in middle of article post in blogger with shortcodes

I want to show ads on blogger posts using shortcodes. With the help of shortcode, I can add multiple ads like 4 to 5 ads in the blogger post. But I don’t know how to do this.

Here some methods are avilable on the internet in which we can add 2 to 3 ads only. This is the code

<div expr:id='"adsmiddle1" + data:post.id'></div>
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.pageType != &quot;static_page&quot;'>
<div style="clear:both; margin:10px 0">
<!-- Add here the code of your ad -->
</div>
</b:if>
</b:if>
<div expr:id='"adsmiddle2" + data:post.id'>
<data:post.body/>
</div>
<script type="text/javascript">
var obj0=document.getElementById("adsmiddle1<data:post.id/>");
var obj1=document.getElementById("adsmiddle2<data:post.id/>");
var s=obj1.innerHTML;
var r=s.search(/x3C!-- adsense --x3E/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>

Using the above code we can add Adsense ads code only by 2 times in blogger post by this shortcodes <!-- adsense --> but I want to modify it for multiple Adsense placement.

Anyone please help me.

Javascript – How to create an HTML element that can input texts as well as images from users – then store it in a Mongodb database

I am building a project based on “Question and Answer” theme and wish for the Client to input an answer where he can type as well as store or drag images.
Along with that, I want to store that answer in a Mongodb Database and retrieve it whenever desired.

I am using the Node.js run-time environment and Mongoose package to write my Javascript Code.

node js – MODULE_NOT_FOUND

Could you look into this and help me.


question 1: when I try to run a .js file, getting below error.

PS C:node-appium-app-browserstack-master> node Login.js

node:internal/modules/cjs/loader:936

throw err;

^

Error: Cannot find module ‘C:USMANnode-appium-app-browserstack-masterLogin.js’

at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)

at Function.Module._load (node:internal/modules/cjs/loader:778:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

at node:internal/main/run_main_module:17:47 {

code: ‘MODULE_NOT_FOUND’,

requireStack: []

}

PS C:node-appium-app-browserstack-master>


question 2: when I run the command npm -v, getting below error.

PS C:node-appium-app-browserstack-master> npm -v

node:internal/modules/cjs/loader:936

throw err;

^

Error: Cannot find module ‘C:Program Filesnodejsnode_modulesnpmbinnode_modulesnpmbinnpm-cli.js’

at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)

at Function.Module._load (node:internal/modules/cjs/loader:778:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

at node:internal/main/run_main_module:17:47 {

code: ‘MODULE_NOT_FOUND’,

requireStack: []

}

node:internal/modules/cjs/loader:936

throw err;

^

Error: Cannot find module ‘C:Program Filesnodejsnode_modulesnpmbinnode_modulesnpmbinnpm-cli.js’

at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)

at Function.Module._load (node:internal/modules/cjs/loader:778:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

at node:internal/main/run_main_module:17:47 {

code: ‘MODULE_NOT_FOUND’,

requireStack: []

}

PS C:node-appium-app-browserstack-master>


Thanks
Usman

ASW-SDK S3 Upload Abort

I want abort an upload, but calling upload.abort() raise an error Upload aborted.. How abort the upload silently?

import { PutObjectCommandInput, S3Client } from '@aws-sdk/client-s3';
import { Progress, Upload } from "@aws-sdk/lib-storage";

const uploadParams: PutObjectCommandInput = {
  Bucket: 'my-bucket',
  Key: 'my-file',
  Body: file,
};

const upload: Upload = new Upload({
  client: s3Client,
  params: uploadParams,
});

// abort after 3 seconds
setTimeout(() => upload.abort(), 3000);

// start upload
upload.done();

How to get new access token from refresh token with googleapis npm package

I cannot seem to find an answer to this anywhere. All the docs say that refresh tokens are used to get new access tokens, but nowhere is it explained how this actually works.

Usually I would use this function accompanied by the code you get from the google consent page:
oauth2Client.getToken(code).
So I would expect something like this:
oauth2Client.getTokenWithRefreshToken(refresh_token).
But no.
Am I just misunderstanding the concept of refresh tokens?

angular-file npm (file upload) , function to (change)-event

Currently I am using angular-file npm file package to upload file (https://www.npmjs.com/package/angular-file) . I want to know how do we directly call the method after we browse files ?

For example when I browse files and click open it will automatically check the progress and will upload the file without click any other buttons , it will upload after browsing the files.

How do we call the uploadFile after click the browse file and opening the file? I tried adding (change)=”handleFileInput($event.target.files)” but it does not seem to work. Any idea guys ? Thank you.

enter image description here

enter image description here

#html code

<div ngfDrop class="well my-drop-zone drop-box" selectable="selectable"
                        [(validDrag)]="baseDropValid" (fileOver)="hasBaseDropZoneOver=$event" [(files)]="files"
                        [accept]="accept" [maxSize]="maxSize" [(dragFiles)]="dragFiles" [(lastInvalids)]="lastInvalids"
                        class="well my-drop-zone drop-box" [class.invalid-drag]="baseDropValid===false"
                        [class.valid-drag]="baseDropValid" [fileDropDisabled]="fileDropDisabled"
                        [class.invalid-drag]="baseDropValid===false" [class.valid-drag]="baseDropValid"
                        [ngfFixOrientation]="false">
                        <div id="file-drop-area">
                            <span class="material-icons material-icons-outlined tertiary-text"
                                style="font-size: 36px;margin-bottom:33px;">
                                cloud_upload
                            </span>
                            <div class="mb-8px">
                                <span style="font-size:14px;">Drag and drop files here or </span>
                                <span (click)="ok()"class="primary-color cursor-pointer"
                                    style="font-weight: 500;font-size:14px;">browse
                                    files</span>
                            </div>
                            <div class="secondary-text mt-10px fs-12px">Accepted file size should not exceed 20MB.
                            </div>
                            <div class="mat-error error-file-drop">
                            </div>
                        </div>
                    </div>
                    <div fxLayout="column" style="padding-top: 25px;" *ngIf="files.length > 0">
                        <div *ngFor="let item of files;let i=index">
                            <div fxLayout="row" style="padding-bottom:8px" layout-wrap>
                                <mat-icon style="font-size: 20px;" color="primary">description</mat-icon>
                                <span class="primary-color" style="font-size:14px; margin-right:8px"
                                    matTooltip="{{item.name}}">{{item.name | truncatedotted:[25]
                                    }}</span>&nbsp;
                                <span style="font-size:12px; margin-right: 6px;" class="tertiary-text">{{
                                    item.size/1024 |
                                    number:'1.0-0' }} kb</span>
                                <span style="flex:1 1"></span>
                                <span (click)="removeFile(files, i)" class="material-icons remove-file cursor-pointer"
                                    style="color:indianred;margin-right:10px">
                                    close
                                </span>
                            </div>
                        </div>
                    </div>
                    <div style="padding-bottom:16px;">
                    </div>
                </mat-card>
            </div>

#ts code

uploadFile(payload:any) {

    const formData: FormData = new FormData();

    this.files.map((file) => {
      formData.append('attachment', file, file.name);
    });

    this._inspectionService.uploadCSV(formData)
    .pipe(debounceTime(500))
    .subscribe(
      res=>{
        if(res.isSuccess){

        }  
      },
      err=>{
        AppUtils.errorHandler(err,this._notificationService, this.dialog);
      }
    )
  }

Is there any way to save the Microsoft Teams tab SSO Azure AD access token into I-Frame cookies using MSAL in javascript?

I am using MS Teams SDK for getting Tab-SSO Access Token. Is there any way to store this Access Token in I-Frame Cookies like MSAL cache user Authentication information after a successful sign-in?. If it works then it is possible to load any web application into Teams-App Tab under the same Tenant without separate Authentication, the loading application takes the cached Access Token for Authentication. Is this possible?

Send requests to sogo calendar

I’m currently really lost and need your help guys. The problem is quiet easy, but I’m not able to find anything useful on that. On my server I implemented SOGo. I now want to write an read events from a certraint calendar. Therefore, I use the libary tsdav. I can read events with the following code:

const client = await createDAVClient({
    serverUrl: 'https://example.com',
    homeUrl: 'https://example.com/SOGo/dav/username/',
    credentials: {
        username: username,
        password: password,
    },
    authMethod: 'Basic',
    defaultAccountType: 'caldav',
});

const calendars = await client.fetchCalendars();

const result = getBasicAuthHeaders({
    username: username,
    password: password,
});

const events = await fetchCalendarObjects({
    calendar: calendars[0],
    headers: result,
});

The problem though is that I can’t write events. The library tsdav uses a put method to write events with the createCalendarObject() function. But SOGo allows no put methods.

I’m looking for a way to send a simple post request to https://example.com/SOGo/dav/username/Calendar/personal/, but I can’t find an docs about endpoints or parameters.