Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security NachrichtenUK gears up for fight against Russia’s disinformation machine(24.09.2026 um 13:25 Uhr)
IT Security NachrichtenMeta locks itself out of user data on its AI glasses(24.09.2026 um 13:35 Uhr)
IT Security NachrichtenLatticeFlow AI offers managed risk assessments for enterprise AI systems(24.09.2026 um 13:47 Uhr)
Sichere ProgrammierungAzul AI Assistant helps teams find Java licensing and security risks(24.09.2026 um 13:59 Uhr)
IT Security NachrichtenAirties adds router-level cybersecurity protection for ISPs(24.09.2026 um 14:08 Uhr)
IT Security NachrichtenGurucul connects AI activity to identity data for faster threat response(24.09.2026 um 14:20 Uhr)
IT Security NachrichtenAI’s real bottleneck isn’t compute — it’s the network underneath(24.09.2026 um 14:00 Uhr)
IT Security NachrichtenEarly Edition: September 24, 2026(24.09.2026 um 14:00 Uhr)
IT Security NachrichtenMicrosoft stellt neue Surface-Geräte und -Maus vor(24.09.2026 um 13:30 Uhr)
IT Security NachrichtenInternet Explorer: Aus spätestens Ende 2029(24.09.2026 um 14:10 Uhr)
IT Security NachrichtenUK gears up for fight against Russia’s disinformation machine(24.09.2026 um 13:25 Uhr)
IT Security NachrichtenMeta locks itself out of user data on its AI glasses(24.09.2026 um 13:35 Uhr)
IT Security NachrichtenLatticeFlow AI offers managed risk assessments for enterprise AI systems(24.09.2026 um 13:47 Uhr)
Sichere ProgrammierungAzul AI Assistant helps teams find Java licensing and security risks(24.09.2026 um 13:59 Uhr)
IT Security NachrichtenAirties adds router-level cybersecurity protection for ISPs(24.09.2026 um 14:08 Uhr)
IT Security NachrichtenGurucul connects AI activity to identity data for faster threat response(24.09.2026 um 14:20 Uhr)
IT Security NachrichtenAI’s real bottleneck isn’t compute — it’s the network underneath(24.09.2026 um 14:00 Uhr)
IT Security NachrichtenEarly Edition: September 24, 2026(24.09.2026 um 14:00 Uhr)
IT Security NachrichtenMicrosoft stellt neue Surface-Geräte und -Maus vor(24.09.2026 um 13:30 Uhr)
IT Security NachrichtenInternet Explorer: Aus spätestens Ende 2029(24.09.2026 um 14:10 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

HarmonyOS NEXT Development Case: Blood Type Inheritance Calculator

The following code demonstrates how to implement a blood type inheritance calculator using ArkUI in HarmonyOS NEXT. This application allows users to select parental blood types and calculates possible/prohibited blood types for their…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Image description



The following code demonstrates how to implement a blood type inheritance calculator using ArkUI in HarmonyOS NEXT. This application allows users to select parental blood types and calculates possible/prohibited blood types for their offspring based on genetic principles.









Full Code with English Comments






// Import SegmentButton and related type definitions  
import { SegmentButton, SegmentButtonItemTuple, SegmentButtonOptions } from '@kit.ArkUI';

// Mark the component as the entry point using the @Entry decorator
@Entry
// Define a component using the @Component decorator
@Component
// BloodTypeCalculator struct implements blood type inheritance calculation
struct BloodTypeCalculator {
// Theme color (default: Orange)
@State private themeColor: string | Color = Color.Orange;
// Text color (default: dark gray)
@State private textColor: string = "#2e2e2e";
// Border color (default: light gray)
@State private lineColor: string = "#d5d5d5";
// Base padding size (default: 30)
@State private basePadding: number = 30;
// Possible blood type results
@State private possibleBloodTypesText: string = "";
// Impossible blood type results
@State private impossibleBloodTypesText: string = "";
// Blood type list: A, B, AB, O
@State private bloodTypeList: object[] = [
Object({ text: 'A' }),
Object({ text: 'B' }),
Object({ text: 'AB' }),
Object({ text: 'O' })
];
// Capsule button configuration for single selection
@State singleSelectCapsuleOptions: SegmentButtonOptions | undefined = undefined;
// Track father's blood type selection
@State @Watch('capsuleSelectedIndexesChanged') fatherBloodTypeIndex: number[] = [0];
// Track mother's blood type selection
@State @Watch('capsuleSelectedIndexesChanged') motherBloodTypeIndex: number[] = [0];

// Get possible gene combinations for a blood type
getGenes(bloodType: string): string[] {
console.info(`bloodType:${bloodType}`);
switch (bloodType) {
case 'A': return ['A', 'O']; // Possible genes for type A
case 'B': return ['B', 'O']; // Possible genes for type B
case 'AB': return ['A', 'B']; // Possible genes for type AB
case 'O': return ['O']; // Possible genes for type O
default: throw new Error('Invalid blood type');
}
}

// Combine parental genes to find possible offspring combinations
combineGenes(fatherGenes: string[], motherGenes: string[]): string[] {
const possibleGenes: string[] = [];
for (const fatherGene of fatherGenes) {
for (const motherGene of motherGenes) {
const combinedGene = [fatherGene, motherGene].sort().join('');
if (!possibleGenes.includes(combinedGene)) {
possibleGenes.push(combinedGene);
}
}
}
return possibleGenes;
}

// Convert gene combinations to blood types
getBloodTypesFromGenes(genes: string[]): string[] {
const bloodTypes: string[] = [];
for (const gene of genes) {
if (gene === 'AA' || gene === 'AO' || gene === 'OA') {
bloodTypes.push('A');
} else if (gene === 'BB' || gene === 'BO' || gene === 'OB') {
bloodTypes.push('B');
} else if (gene === 'AB' || gene === 'BA') {
bloodTypes.push('AB');
} else if (gene === 'OO') {
bloodTypes.push('O');
}
}
return [...new Set(bloodTypes)]; // Remove duplicates
}

// Calculate possible/impossible blood types
calculatePossibleBloodTypes(father: string, mother: string) {
const fatherGenes = this.getGenes(father);
const motherGenes = this.getGenes(mother);
const possibleGenes = this.combineGenes(fatherGenes, motherGenes);
const possibleBloodTypes = this.getBloodTypesFromGenes(possibleGenes);
const impossibleBloodTypes = ['A', 'B', 'AB', 'O']
.filter(bt => !possibleBloodTypes.includes(bt));
this.possibleBloodTypesText = `Possible: ${possibleBloodTypes.join(', ')}`;
this.impossibleBloodTypesText = `Impossible: ${impossibleBloodTypes.join(', ')}`;
}

// Handle segment button selection changes
capsuleSelectedIndexesChanged() {
const father = this.bloodTypeList[this.fatherBloodTypeIndex[0]]['text'];
const mother = this.bloodTypeList[this.motherBloodTypeIndex[0]]['text'];
this.calculatePossibleBloodTypes(father, mother);
}

// Initialize UI when component appears
aboutToAppear(): void {
this.singleSelectCapsuleOptions = SegmentButtonOptions.capsule({
buttons: this.bloodTypeList as SegmentButtonItemTuple,
multiply: false, // Single selection mode
fontColor: Color.White,
selectedFontColor: Color.White,
selectedBackgroundColor: this.themeColor,
backgroundColor: this.lineColor,
backgroundBlurStyle: BlurStyle.BACKGROUND_THICK
});
this.capsuleSelectedIndexesChanged();
}

// UI Construction
build() {
Column() {
// Title Section
Text('Blood Type Calculator')
.fontColor(this.textColor)
.fontSize(18)
.width('100%')
.height(50)
.textAlign(TextAlign.Center)
.backgroundColor(Color.White)
.shadow({ radius: 2, color: this.lineColor, offsetX: 0, offsetY: 5 });

// Introduction Section
Column() {
Text('How It Works').fontSize(20).fontWeight(600).fontColor(this.textColor);
Text('Blood type inheritance depends on combinations of A/B/O genes. This tool predicts possible offspring blood types based on parental selections.')
.fontSize(18).fontColor(this.textColor).margin({ top: `${this.basePadding / 2}lpx`);
}
// ... (UI styling properties unchanged)

// Parent Selection Section
Column() {
Row() {
Text('Father\'s Blood Type').fontColor(this.textColor).fontSize(18);
SegmentButton({
options: this.singleSelectCapsuleOptions,
selectedIndexes: this.fatherBloodTypeIndex
}).width('400lpx');
}
// ... (Mother's section mirroring father's)
}

// Result Display Section
Column() {
Text(this.possibleBloodTypesText).fontColor(this.textColor).fontSize(18);
Text(this.impossibleBloodTypesText).fontColor(this.textColor).fontSize(18);
}
}
.backgroundColor("#f4f8fb");
}
}












Key Technical Points





  1. Genetic Algorithm Implementation




    • The getGenes() method maps blood types to possible gene combinations (e.g., A → ["A", "O"]).


    • combineGenes() generates all possible offspring gene pairs through nested iteration.


    • getBloodTypesFromGenes() converts sorted gene pairs to standardized blood types.




  2. UI Components




    • Uses SegmentButton for blood type selection with capsule-style styling.

    • Implements responsive layout with percentage-based widths and logical pixel units (lpx).

    • Applies consistent shadow effects and color schemes for visual hierarchy.




  3. State Management





    • @State variables track UI state and calculation results.


    • @Watch decorator triggers recalculation when parental selections change.




  4. Performance Optimization




    • Uses console.info for debugging while avoiding expensive operations in render cycles.

    • Memoizes blood type lists to prevent unnecessary re-renders.





This implementation demonstrates HarmonyOS NEXT's capability to build scientifically accurate tools with clean UI/UX principles.

SOC Incident Playbook: Remote Code Execution (RCE) Defense
title: Detect Exploitation - HarmonyOS NEXT Development Case: Blood Type Inheritance Calculator
id: 9486d3f0-c8cd-4b8c-89e1-e1940a698e1f
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "HarmonyOS NEXT Development Cas" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich HarmonyOS NEXT Development Case: Blood T.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten HarmonyOS NEXT Development Case: Blood Type Inheritance Calculator

Thematisch verwandte Begriffe: HarmonyOS, NEXT, Development, Case · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-97152 | Nanomsg versions 0.5-beta through 1.x before 1.2.3 has a remotely exploi…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick