- After
Add-Migration
:- Demo/Test/QA =>
Update-Databsase
(If db doesn't exist, it will be created automatically)
- Demo/Test/QA =>
- Production =>
Script-Migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You need to add headers to your ITracer if you are going to call other APIs | |
var dictionary = new Dictionary<string, string>(); | |
_tracer.Inject(scope.Span.Context, BuiltinFormats.HttpHeaders, new TextMapInjectAdapter(dictionary)); | |
foreach (var entry in dictionary) | |
{ | |
_httpClient.DefaultRequestHeaders.Add(entry.Key, entry.Value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
public static void Main(string[] args) => MainAsync().GetAwaiter().GetResult(); | |
private static async Task MainAsync() | |
{ | |
// discover endpoints from metadata | |
var disco = await DiscoveryClient.GetAsync("http://localhost:5000"); //IdentityServer Address | |
if (disco.IsError) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Config | |
{ | |
// scopes define the API resources in your system | |
public static IEnumerable<ApiResource> GetApiResources() | |
{ | |
return new List<ApiResource> | |
{ | |
new ApiResource("TheApi", "The Example API") | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
while (running) { | |
ConsumerRecords<String, String> records = consumer.poll(1000); | |
try { | |
for (ConsumerRecord<String, String> record : records) | |
// Your work here. | |
} catch (CommitFailedException e) { | |
// application specific failure handling | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void put(Collection<SinkRecord> collection) { | |
try { | |
Collection<String> recordsAsString = collection.stream().map(r -> String.valueOf(r.value())).collect(Collectors.toList()); | |
elasticService.process(recordsAsString); | |
} | |
catch (Exception e) { | |
log.error("Error while processing records"); | |
log.error(e.toString()); | |
} |
Query Context: How well does this document match this query?
Filter Context: Does this document match this query clause?
- Included or not: Determine whether the document should be part of the result
- Relevance score: Calculated for every search term the document maps to
- High score, more relevant: More relevant documents, higher in the search rankings.
ps aux | grep sshd
find all ssh connections to the machine that this command applied
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Slack | |
private void sendSlackNotification(String id, String message) { | |
MediaType JSON | |
= MediaType.parse("application/json; charset=utf-8"); | |
RequestBody body = RequestBody.create(JSON, | |
String.format("{ \"text\": \"Cannot send the product with id <%s>,\n Error: %s\"}", id, message.replaceAll("\"", "'"))); | |
Request request = new Request.Builder() |
NewerOlder