Thursday, 31 March 2022

Angular x-www-form-urlencoded post

 post method with xxx-formurl encoded and token headers

postUserRole(obj: any) {
    const myheader = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
    const httpOptions = {
      headers: new HttpHeaders({
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': `Bearer ${this.token}`
      })
    };
   

    let body = new HttpParams();
    body = body.set("RoleId", "0");
    body = body.set("RoleName", "apptest");
    body = body.set("Description", "testing");
    body = body.set("Status", "active");
    body = body.set("RecordsCount", "0");
    body = body.set("ActiveStatus", "0");
    body = body.set("DuplicateRoleName", "");
    body = body.set("SwitchPermission", "false");
    body = body.set("MasterpermissionStatus", "true");



    return this.httpClient.post<any>("https://dev.psplhyd.com/Crmangular13-API/api/1/userrolesapi", body, httpOptions).pipe(catchError(this.errorHandler))





  }
https://entityframeworkcore.com/knowledge-base/59151584/how-to-execute-stored-procedure-for-multiple-parameters-using-fromsqlinterpolated-in-ef-core-3-0-
https://stackoverflow.com/questions/51605542/angular-6-http-post-request-with-x-www-form-urlencoded-data

install issues

 1.for first time in a system to install npm and run ng s get this error

ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling   

of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+ ng -v

resolve using this cmd

set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Wednesday, 30 March 2022

flutter

 https://flutterawesome.com/an-app-enable-kids-between-from-one-to-five-years-to-learn-with-fun-the-basic-concepts-for-thier-age/


The FlatButtonRaisedButton and OutlineButton widgets have been replaced by TextButtonElevatedButton, and OutlinedButton respectively

https://docs.flutter.dev/release/breaking-changes/buttons


cmds: flutter creaste appnamefirstlettersmall

flutter run




file upload

 https://karthiktechblog.com/aspnetcore/how-to-upload-a-file-with-net-core-web-api-3-1-using-iformfile#:~:text=To%20upload%20a%20single%20file,single%20file%20as%20a%20parameter.

core file upload

Saturday, 26 March 2022

AVM install issues

 install this HAXM failed even hyver-v cheked in window properties also.
finaly resolved 

>goto bios settings press f10 and goto tab virtual enable it then it is installed successfully


npm cmds

 ng g m  component--route  component --module app

npm install --save @angular/animations
npm install --save @angular/material @angular/cdk

cross issue

  public void ConfigureServices(IServiceCollection services)

{

// Add Cors

services.AddCors(o => o.AddPolicy("MyPolicy", builder =>

{

builder.AllowAnyOrigin()

   .AllowAnyMethod()

   .AllowAnyHeader();

}));


services.AddDistributedMemoryCache();

//services.AddSwaggerGen();

//services.AddCors(c => { c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin()); });

services.AddControllers().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);


}

------------

                              app.UseRouting();

// Enable Cors

app.UseCors("MyPolicy");

-----------


in controller

[EnableCors("MyPolicy")]

public class ApiController : ControllerBase


Friday, 25 March 2022

vscodetips

 compare two files

https://www.mytecbits.com/microsoft/dot-net/compare-contents-of-two-files-in-vs-code#:~:text=Steps%20to%20compare%20contents%20of,and%20choose%20Compare%20with%20Selected.

https://www.kindacode.com/article/vs-code-how-to-compare-two-files-find-the-difference/


react issues

 



here i forgot add the onchange for the description button AFter adding that issue resolved

Thursday, 24 March 2022

free host websites

 https://github.com/settings/installations/24380275

https://dash.cloudflare.com/8f455e7b779b3aade7e5d127cd3389b5/pages


https://dash.cloudflare.com/8f455e7b779b3aade7e5d127cd3389b5/pages/new/github


https://developers.cloudflare.com/pages/framework-guides/deploy-a-blazor-site/

how to deploy


neice website dashboard

https://dashboard.render.com/


Tuesday, 22 March 2022

cross Isuue asp.net web api 2 && string spces in c#

  web.config

<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
<add name="Access-Control-Allow-Credentials" value="true" />
</customHeaders>  
</httpProtocol>
OR
var cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);

https://any-api.com/
https://elmah.io/tools/multiline-string-converter/
https://stackoverflow.com/questions/3905946/how-can-i-add-double-quotes-to-a-string-that-is-inside-a-variable

React SweetAlert with time out

 "sweetalert2": "^11.4.6", "sweetalert2-react-content": "^4.2.0"


add in package.json dependencies.

for login failed

if(data.response == "Invalid Login Credentials"){
                Swal.fire({
                    title:'Error!',
                    text:  "Invalid Login Credentials",
                    icon: 'error',
                    confirmButtonText: 'OK'
                })
            }
for login success
  if(data.response != "Invalid Login Credentials"){
                Swal.fire({
                    title: "Success!",
                    text: "Login Done Successfully!!",
                    type: "success",
                    timer: 1000
                })
            }
https://react-hook-form.com/advanced-usage


https://react-hook-form.com/api/useform/reset/
https://blog.logrocket.com/react-hooks-cheat-sheet-unlock-solutions-to-common-problems-af4caf699e70/

react get localstorageItem

 react localstorage 

https://blog.logrocket.com/using-localstorage-react-hooks/

https://programmingwithmosh.com/react/localstorage-react/


const Header = (props) => {
    const user =JSON.parse( localStorage.getItem("user"));
    console.log((user))
}

Saturday, 19 March 2022

sweet alert react js

 

  1. npm install --save sweetalert2 sweetalert2-react-content  

import Swal from "sweetalert2"

  1.  Swal.fire({  
  2.       title: 'Success',  
  3.       type: 'success',  
  4.       text: 'Your work has been saved.',  
  5.     });  
  1.  Swal.fire({  
  2.       title: 'Are you sure?',  
  3.       text: 'User will have Admin Privileges',  
  4.       icon: 'warning',  
  5.       showCancelButton: true,  
  6.       confirmButtonColor: '#3085d6',  
  7.       cancelButtonColor: '#d33',  
  8.       confirmButtonText: 'Yes!'  
  9.     });  
  1.  Swal.fire({  
  2.       icon: 'error',  
  3.       title: 'Oops...',  
  4.       text: 'Something went wrong!',  
  5.       footer: '<a href>Why do I have this issue?</a>'  
  6.     });  
  7.  Swal.fire({  
  8.       position: 'top-end',  
  9.       icon: 'success',  
  10.       title: 'Your work has been saved',  
  11.       showConfirmButton: false,  
  12.       timer: 1500  
  13.     });  

Sunday, 13 March 2022

asp.net core entity issues

 > in my entity i have two ids so the entity unable find based on id
so i have commented or removed one id which is autogenerated . 

code below:

https://qawithexperts.com/article/c-sharp/using-entity-framework-join-ef-join-to-join-two-or-more-tabl/192


Saturday, 12 March 2022

best react js site

 best web site for

react

https://v5.reactrouter.com/web/guides/quick-start

https://ui.dev/react-router-url-parameters

https://levelup.gitconnected.com/applying-a-date-range-filter-to-a-react-app-a546c5493830


https://ui.dev/react-router-programmatically-navigate


https://react-select.com/home


https://codesandbox.io/examples/package/react-reactive-form


https://pusher.com/tutorials/tagged/multiplayer-game/





Saturday, 5 March 2022

visual studio online key working

 https://www.rushtime.in/visual-studio/visual-studio-all-version-product-keys/

visaul studio license key online working.

slq links

 https://www.mytecbits.com/microsoft/sql-server/concatenate-multiple-rows-into-single-string

https://www.sqlshack.com/rollback-sql-rolling-back-transactions-via-the-rollback-sql-query/


https://www.geeksforgeeks.org/difference-between-commit-and-rollback-in-sql/

https://partners-intl.aliyun.com/help/en/doc-detail/51068.htm


https://www.npmjs.com/package/react-date-range



Car pooling app

 I'll create a car pooling app with real-time vehicle tracking, pickup/drop time estimates, and a list of onboard users. Since we don...