-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJavaScript Data Structure and Algorithm.txt
More file actions
296 lines (255 loc) · 8.51 KB
/
JavaScript Data Structure and Algorithm.txt
File metadata and controls
296 lines (255 loc) · 8.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
The Coding Interview Bootcamp Algorithms + Data Structures
4. Palindromes
Video: 1. Palindromes : 00:00
npm install -g jest
jest fib --watch
node inspect index.js
c or cont
repl
debug
cd to folder where the excersise
put 'debugger;' on a method then run debugger
node inspect index.js
c or cont
repl
type variable
type the code inside a method
exit
Debugger Steps
> Add a 'debugger' statement in your function
> Call the function manually
> At the terminal, run 'node inspect index.js'
> To continue execution of the file, press 'c' then 'enter'
> To launch a 'repl' session, type 'repl' then 'enter'
> To exit the 'repl', press Control + C
String Reversal - Algorithm, Solution #1
> Turn 'str' into an array
> Call 'reverse' method on the array
> Join the array back into a string
> Return the result
String Reversal - Algorithm, Solution #2
> Create an empty string called 'reversed'
> for each character in the provided string
> Take the character and add it to the start of 'reversed'
> Return the variable 'reversed'
-----------------------------------------------------------------------------------------------------------
Sorting: use => OrderBy and OrderByDescending
Filtering: use => Where clause or Any Condition clause
Pagination: use => int Take, int Skip, bool IsPagingEnabled
Searching: use => Any Condition clause, like "Contains"
for ASPNET Core API - package references - NuGet Package Manager
Microsoft.EntityFrameworkCore.Design - EntityFrameworkCore will matter the installed runtime of PC
AutoMapper
AutoMapper.Extensions.Microsoft.DependencyInjection
Microsoft.AspNetCore.Authentication.JwtBearer
for Core Class Library
Microsoft.Extensions.Identity.Stores
for Infrastructure Class Library
Microsoft.EntityFrameworkCore - EntityFrameworkCore will matter the installed runtime of PC
Microsoft.EntityFrameworkCore.SqlServer - EntityFrameworkCore will matter the installed runtime of PC
StackExchange.Redis
Microsoft.AspNetCore.Identity
Microsoft.AspNetCore.Identity.EntityFrameworkCore - EntityFrameworkCore will matter the installed runtime of PC
Microsoft.IdentityModel.Tokens
System.IdentityModel.Tokens.Jwt
for .NET 5 powershell
mkdir skinet
dotnet new -h
dotnet new -l
dotnet new sln
dotnet new webapi -o API
dotnet sln -h
dotnet sln add API/
dotnet sln list
dotnet dev-certs https
dotnet dev-certs https -h
dotnet dev-certs https -t
dotnet --info
dotnet tool install --global dotnet-ef --version 5.0.0
dotnet ef -h
dotnet ef migrations -h
dotnet ef migrations add InitialCreate -o Data/Migrations
dotnet ef database -h
cd .. to parent folder
dotnet new -h
dotnet new -l
dotnet new classlib -o Core
dotnet new classlib -o Infrastructure
dotnet sln add Core/
dotnet sln add Infrastructure/
cd to API
dotnet add reference ../Infrastructure/
cd .. to parent folder again
cd Infrastructure
dotnet add reference ../Core/
cd .. to parent folder once again
dotnet restore
dotnet build
dotnet ef database drop -p Infrastructure -s API
dotnet ef migrations remove -p Infrastructure -s API
dotnet ef migrations add InitialCreate -p Infrastructure -s API -o Data/Migrations
dotnet ef migrations list -p Infrastructure -s API
dotnet ef migrations add IdentityInitial -p Infrastructure -s API -o Identity/Migrations -c AppIdentityDbContext
dotnet ef migrations remove -p Infrastructure -s API -c AppIdentityDbContext
dotnet run
dotnet watch run
for Angular powershell
npm install -g @angular/cli
ng new client
ng serve
ng add ngx-bootstrap
ng g
ng g c --help
ng g c nav-bar --skip-tests
ng g m core
ng g s shop --skip-tests --flat
ng g m shop-routing --flat
ng g interceptor loading --flat --skip-tests
ng g r user-edit --skip-tests
ng g g prevent-unsaved-changes --skip-tests
ng g d focus-first-input --skip-tests
ng g --help
ng g s services/dialog --skip-tests
ng g c dialogs/confirm --skip-tests
ng add @angular/pwa
3rd party Component for Angular
npm install bootstrap@4.0.0 font-awesome
npm install ngx-bootstrap --save
npm install ngx-toastr --save
npm install --save xng-breadcrumb
npm install bootswatch
npm install ngx-spinner
npm install uuid
npm install material-design-icons --save
https://google.github.io/material-design-icons/#what-are-material-icons-
https://stackoverflow.com/questions/37270835/how-to-host-material-icons-offline
https://github.com/google/material-design-icons/releases
https://marella.me/material-icons/
npm install material-icons@latest
npm install @auth0/angular-jwt
npm i ng2-file-upload --save
npm install ngx-print
Make git to github
cd .. to parent folder
git status
git init
git add .
git commit -m "Initial Commit"
git remote add origin "github address"
git push -u origin master
git pull --rebase origin main
git push origin main
git rm dumb.rdb - rm -> remove
-f -> force removal
Visual Studio Code Extensions
Angular Language Service
Angular Snippets
Prettier - Code Formatter
Bracket Pair Colorizer 2
angular2-switcher
Auto Rename Tag
ESLint
C#
C# Extensions
Debugger for Chrome
Material Icon Theme
NuGet Package Manager
Install on computer
.NET Core SDK
Postman
Visual Studio Code
git
Node JS
Sql Server Management Studio 2019
Sql Server Express 2019
Angular CLI
Chocolatey Package Manager for Windows
choco install redis-64
install Redis via Redis-x64-3.0.504.msi
Redis Server
for Redis using CMD
redis-server
redis-cli
redis-cli KEYS '*'
redis-cli GET <keyvalue>
redis-cli ping
redis-cli shutdown
netstat -aon
.gitignore for ASPNET Core API
.vscode
bin
obj
*.db
appsettings.json
wwwroot
Content
Clone the repository you need then,
locate the folder for API, then run 'dotnet restore'
locate the folder for API, then run 'dotnet build'
locate the folder for SPA, then run 'npm install'
If Intellisense not work for DOTNET
click Shift + Ctrl + P, then search OmniSharp, then restart OmniSharp
Connection String for SqlServer
Trusted Connection
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Using a non-standard port for SqlServer
Server=.\\SQLEXPRESS,1433;Database=DatingApp.db;User Id=datingappapi;Password=free232469;
Why powershell does not run Angular commands?
Remove ng.ps1 from the directory C:\Users\%username%\AppData\Roaming\npm\
then try clearing the npm cache at C:\Users\%username%\AppData\Roaming\npm-cache\
<pre>
Form Valid: {{loginForm.valid}}
Form Touched: {{loginForm.touched}}
Form Dirty: {{loginForm.dirty}}
Form Values: {{loginForm.value | json}}
Username Valid: {{username.valid}}
Username Touched: {{username.touched}}
Username Dirty: {{username.dirty}}
Username Value: {{username.value}}
Password Valid: {{password.valid}}
Password Touched: {{password.touched}}
Password Dirty: {{password.dirty}}
Password Value: {{password.value}}
</pre>
Angular - Parent to Child Component ---> @Input() valuesFromHome: any;
Angular - Child to Parent Component ---> @Output() cancelRegister = new EventEmitter();
Observable - we can cancel, fail or succeed -> subscibe() or map() or filter() -> data
.pipe() -> chain inside rxjs/operators
do something = (click)=""
receiving something = [class.active]="brand.id === brandIdSelected"
Parent Element => position: relative, -> Child Element => position: absolute -
change the position whatever you want
use DatabaseName
GO
sp_changedbowner 'sa'
tsconfig.json = "strictDomEventTypes": false
Object is possibly 'undefined'.ts(2532) --> ?
onChange(event: Event): void {
(event.currentTarget as HTMLInputElement).value;
}
(input)="onChange($any($event.currentTarget).value)"
<div class="col-4">
<p>Form Status: {{loginForm.status}}</p>
<p>Email Status: {{loginForm.get('email')!.status}}</p>
<p>Email Touched: {{loginForm.get('email')!.touched}}</p>
<p>Email Dirty: {{loginForm.get('email')!.dirty}}</p>
<pre>{{loginForm.value | json}}</pre>
</div>
SQL Server - Create User Id
Go to Security create a login, then Server Roles --> dbcreator & sysadmin
To enable Service Broker run: ALTER DATABASE [Database_name] SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;
To disable Service Broker: ALTER DATABASE [Database_name] SET DISABLE_BROKER WITH ROLLBACK IMMEDIATE;
To check if Service Broker is enabled on a SQL Server database:
SELECT is_broker_enabled FROM sys.databases WHERE name = 'Database_name';
email: [null,
[Validators.required, Validators.pattern('^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$')],
[this.validateEmailNotTaken()]
]
https://stackoverflow.com/questions/8169999/how-can-i-create-a-self-signed-cert-for-localhost/48790088#48790088
--------------------------------------------
for Publishing the Angular
angular.json ---> "outputPath": "../DatingApp.API/wwwroot"
ng build
--------------------------------------------
for Publishing the DOTNET Core
dotnet publish -c Release