1) got o https://rxjs-dev.firebaseapp.com/
2) press F11 to open devtools, you should see the welcome messages, like this
____ _ ____
| _ \ __ __ | / ___|
| |_) |\ \/ / | \___ \
| _ < > < |_| |___) |
|_| \_\/_/\_\___/|____/
started experimenting with RxJS:
type this into the console:
rxjs.interval(500).pipe(rxjs.operators.take(4)).subscribe(console.log)
3) now you can type any code in console to test rxjs
4) one thing need pay attention is that do not use any import since we are inside the js document
if we want use anything in rxjx like this (import { scan } from 'rxjs/operators';)
we should use it like this
scan = rxjs.operators.scan;
fromEvent = rxjs.fromEvent;
fromEvent(document, 'click')
.pipe(scan(count => count + 1, 0))
.subscribe(count => console.log(`Clicked ${count} times`));
Wednesday, January 8, 2020
Monday, March 5, 2018
aws cli result filter
aws lambda list-functions --query 'Functions[0]'
aws lambda list-functions --query 'Functions[*].{functionName:FunctionName, env.stage:Environment.STAGE, Handler:Handler, ModifiedAt:LastModified}'
aws lambda list-functions --query 'Functions[*].[FunctionName, Handler, LastModified]'
aws lambda list-functions --query 'Functions[?Handler==`handler.getVehicles`]'
aws lambda list-functions --query 'Functions[*].{functionName:FunctionName, env.stage:Environment.STAGE, Handler:Handler, ModifiedAt:LastModified}'
aws lambda list-functions --query 'Functions[*].[FunctionName, Handler, LastModified]'
aws lambda list-functions --query 'Functions[?Handler==`handler.getVehicles`]'
Tuesday, January 23, 2018
angularJS DI
The DI in Angular basically consists of three things:
- Injector - The injector object that exposes APIs to us to create instances of dependencies.
- Provider - A provider is like a recipe that tells the injector how to create an instance of a dependency. A provider takes a token and maps that to a factory function that creates an object.
- Dependency - A dependency is the type of which an object should be created.
Tuesday, August 29, 2017
Friday, August 25, 2017
powershell code that copy big file and show progress bar
1) copy following code into powershell console
function Copy-File {
param( [string]$from, [string]$to)
$ffile = [io.file]::OpenRead($from)
$tofile = [io.file]::OpenWrite($to)
Write-Progress -Activity "Copying file" -status "$from -> $to" -PercentComplete 0
try {
[byte[]]$buff = new-object byte[] 4096
[int]$total = [int]$count = 0
do {
$count = $ffile.Read($buff, 0, $buff.Length)
$tofile.Write($buff, 0, $count)
$total += $count
if ($total % 1mb -eq 0) {
Write-Progress -Activity "Copying file" -status "$from -> $to" `
-PercentComplete ([int]($total/$ffile.Length* 100))
}
} while ($count -gt 0)
}
finally {
$ffile.Dispose()
$tofile.Dispose()
Write-Progress -Activity "Copying file" -Status "Ready" -Completed
}
}
2)use following command to copy file and show progress bar in powershell console
Copy-File -from FromFileLocationAndName -to toFileLocationAndName
Monday, June 12, 2017
get details information about SAP sales orders
1) T-code ST04
2) left side SQL Command Editor
select * from vbap where VBELN='0004714464' order by POSNR;
use export button in result table to export resultset
2) left side SQL Command Editor
select * from vbap where VBELN='0004714464' order by POSNR;
use export button in result table to export resultset
Monday, June 5, 2017
‘q’ Parameter in HTTP ‘Accept’ Header
‘q’ Parameter in HTTP ‘Accept’ Header
A REST API can return the resource representation in many formats – to be more specific MIME-types. A client application or browser can request for any supported MIME type in HTTP Accept header. Technically,
Accept
header can have multiple values in form of comma separated values.
For example, an
Accept
header requesting for text/html
or application/xml
formats can be set as:Accept : text/html,application/xml |
The ‘q’ Parameter
Sometimes client may want to set their preferences when requesting multiple
MIME
types. To set this preference,q
parameter (relative quality factor) is used.
Value of
q
parameter can be from 0 to 1. 0 is lowest value (i.e. least preferred) and 1 is highest (i.e. most preferred).
A sample usage can be:
Accept : text/html, application/xml;q= 0.9 , */*;q= 0.8 |
In above example, client is indicating the server that it will prefer to have the response in
text/html
format, first. It server does not support text/html
format for requested resource than it shall send application/xml
format. If none of both formats are available, then send the response in whatever format it support (*/*
).- One of the benefit of ‘q’ parameter is to minimize the client-server interactions, which could have happened due to failed content negotiations.
- It also allow clients to receive content types of which they may not be aware, an asterisk “*” may be used in place of either the second half of MIME type value, or both halves.
Here’s how the HTTP spec defines it:
Each media-range MAY be followed by one or more accept-params, beginning with the “q” parameter for indicating a relative quality factor. The first “q” parameter (if any) separates the media-range parameter(s) from the accept-params. Quality factors allow the user or user agent to indicate the relative degree of preference for that media-range, using the qvalue scale from 0 to 1. Default value is 1.
If there are two MIME types for given same
q
value, then more specific type, between both, wins.
For example if both
application/xml
and */*
had a preference of 0.9 then application/xml
will be served by the server.
If no
Accept
header field is present, then it is assumed that the client accepts all media types. If anAccept
header field is present, and if the server cannot send a response which is acceptable according to the combined Accept
field value, then the server SHOULD send a 406 (not acceptable)
response.
Subscribe to:
Posts (Atom)