frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Fundamentals of HarmonyOS Development

2•flfljh•5h ago
# Fundamentals of HarmonyOS Development

## Data Storage

HarmonyOS applications offer multiple data storage options:

- *Preferences*: Lightweight key-value storage for simple data - *SQLite*: Relational database for structured data storage - *File Storage*: Direct file system access for custom data storage

## Arrays

Arrays are ordered collections of data accessible by index:

```javascript let numbers = [1, 2, 3, 4, 5]; console.log(numbers[0]); // Outputs 1 ```

## Functions

### Regular Functions Encapsulate reusable blocks of code: ```javascript function greet(name) { return "Hello, " + name; } console.log(greet("Alice")); // Outputs "Hello, Alice" ```

### Arrow Functions Concise function syntax: ```javascript const greet = (name) => "Hello, " + name; console.log(greet("Bob")); // Outputs "Hello, Bob" ```

## Interfaces

Define object structure contracts: ```typescript interface Person { name: string; age: number; greet(): string; }

class Employee implements Person { name: string; age: number;

     constructor(name: string, age: number) {
         this.name = name;
         this.age = age;
     }
     
     greet(): string {
         return "Hello, I am " + this.name;
     }
 }
 ```
## Objects and Methods

Collections of properties and methods: ```javascript let person = { name: "Charlie", age: 30, greet: function() { return "Hello, " + this.name; } }; console.log(person.greet()); // Outputs "Hello, Charlie" ```

## Union Types

Values that can be one of several types: ```typescript let age: number | string; age = 25; // Valid age = "twenty-five"; // Also valid ```

## Enums

Named constant collections: ```typescript enum Direction { Up, Down, Left, Right } let direction: Direction = Direction.Up; // Uses enum value ```

------

## UI Development Concepts and Layout

### Component Properties and Methods - *Properties*: Configure appearance and behavior - *Methods*: Perform component-specific operations

### Text Styling - *Text Color*: Set via `text-color` property - *Text Overflow*: Control with `text-overflow` (e.g., `ellipsis` displays truncation dots)

### Image Component ```html <image src="path/to/image.png" width="100" height="100"></image> ```

### Input Field ```html <input type="text" placeholder="Enter text here"></input> ```

### SVG Icons Embed directly or reference SVG files: ```html <svg width="100" height="100"> <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /> </svg> ```

### Layout Elements Organize UI component positioning and sizing

#### Margin ```css .container { margin: 10px; /* Uniform margin / margin: 5px 10px; / Vertical | Horizontal / margin: 5px 10px 15px; / Top | Horizontal | Bottom / margin: 5px 10px 15px 20px; / Top | Right | Bottom | Left / } ```

#### Borders ```css .box { border: 1px solid black; / Width | Style | Color / border-radius: 10px; / Rounded corners / } ```

#### Custom Shapes ```css .special-shape { border-radius: 20px 10px 30px 5px; / Custom rounded corners / } ```

### Backgrounds ```css .background { background-color: #f0f0f0; / Solid color / background-image: url('path/to/image.png'); / Background image / background-position: center; / Image positioning / background-size: cover; / Image sizing / background-repeat: no-repeat; / Prevent tiling / } ```

### Linear Layout Alignment ```css .linear-layout { display: flex; justify-content: center; / Main axis alignment / align-items: center; / Cross axis alignment / flex-direction: row; / Layout direction (row/column) */ } ```

From NixOS to Ubuntu

https://jnsgr.uk/2025/06/from-nixos-to-ubuntu
1•jnsgruk•34s ago•0 comments

Networking for Systems Administrators

https://mwl.io/nonfiction/networking
1•lordleft•49s ago•0 comments

Learnings from two years of using AI tools (at Thoughtworks)

https://newsletter.pragmaticengineer.com/p/two-years-of-using-ai
1•flail•1m ago•0 comments

First freeform 3D spintronic device unveils new physics

https://www.nature.com/articles/s41586-024-08582-8
1•BartholomewQ•1m ago•0 comments

How to improve your content management system with IA

https://littlelanguagemodels.com/how-to-improve-your-content-management-system-with-information-architecture/
1•mooreds•4m ago•0 comments

What If Awareness Is the Fundamental Substrate of Reality?

1•GodlySharing•5m ago•0 comments

The 3DS Still Holds Up

https://boehs.org/node/3ds
1•surprisetalk•6m ago•0 comments

YAML Tool Calls

https://jeremyaboyd.com/post/yaml-tool-calls
1•azhenley•6m ago•0 comments

RNA has a new role: Repairing serious DNA damage to maintain the genome

https://theconversation.com/rna-has-newly-identified-role-repairing-serious-dna-damage-to-maintain-the-genome-256429
1•PaulHoule•8m ago•0 comments

Focus on the universe: what distinguishes four prominent telescopes

https://www.mpg.de/24878805/telescopes-in-comparison
2•sohkamyung•8m ago•0 comments

Key fair use ruling clarifies when books can be used for AI training

https://arstechnica.com/tech-policy/2025/06/key-fair-use-ruling-clarifies-when-books-can-be-used-for-ai-training/
1•isaacfrond•8m ago•0 comments

It took 45 years, but spreadsheet legend Mitch Kapor finally got his MIT degree

https://www.bostonglobe.com/2025/06/24/business/mitch-kapor-mit-degree-bill-aulet/
2•bookofjoe•9m ago•1 comments

Show HN: I wrote a $5 guide on Digital Minimalism for Creators

https://gum.new/gum/cmcbwwomr000y04jyhqs0a5aw
1•Theo_M•9m ago•0 comments

Gamer Games for Non-Gamers

https://www.hillelwayne.com/post/vidja-games/
1•azhenley•10m ago•0 comments

Find citizen reporters around the world

https://www.weeklygazette.org/discover
1•progju•10m ago•0 comments

Anthropic – Prompt engineering guide for developer

https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview
2•xiaodai•10m ago•0 comments

Morgan Stanley Tackled One of Coding's Toughest Problems

https://www.wsj.com/articles/how-morgan-stanley-tackled-one-of-codings-toughest-problems-4f465959
1•mgl•11m ago•0 comments

NIST Unveils a Verifiable Quantum Random Number Beacon

https://spectrum.ieee.org/nist-quantum-random-number-generator
1•sohkamyung•12m ago•0 comments

Verifiably Correct Lifting of Position-Independent x86-64 Binaries (2024)

https://dl.acm.org/doi/10.1145/3658644.3690244
1•etiams•12m ago•0 comments

Anthropic: All major AI models will blackmail if pushed enough. Just like people

https://www.theregister.com/2025/06/25/anthropic_ai_blackmail_study/
2•rntn•12m ago•0 comments

Fairphone 6 Announced with Same-Day Linux Support Patches

https://www.phoronix.com/news/Fairphone-6-Linux
1•Vinnl•13m ago•1 comments

Show HN: I made reverse Google Analytics at a hackathon last weekend

https://noticedbysenp.ai/
1•herzo175•15m ago•0 comments

Heating Water from Afar

https://bernsteinbear.com/blog/heating-water-from-afar/
1•surprisetalk•15m ago•0 comments

You Can Probably Stand to Charge More (2006)

https://www.kalzumeus.com/2006/08/14/you-can-probably-stand-to-charge-more/
1•ArneVogel•19m ago•0 comments

Show HN: UpdateFin – The script updates the IMDB ratings on Jellyfin

https://github.com/OctopusTeamDev/updateFin
1•darkotodoric•21m ago•0 comments

Disposable E-Cigarettes More Toxic Than Traditional Cigarettes

https://www.ucdavis.edu/news/disposable-e-cigarettes-more-toxic-traditional-cigarettes
3•geox•23m ago•0 comments

Show HN: Flokkk – Discover Useful links through community curation

1•TejaSabinkar_07•25m ago•0 comments

Residents say Waymo robotaxis are driving them mad m

https://www.cnn.com/2025/06/25/us/santa-monica-waymo-battles
1•vinnyglennon•26m ago•1 comments

Show HN: Joshua Hart – Glow and Benny's Blunders

https://www.joshuahartauthor.com
1•detailsof•28m ago•0 comments

After successfully entering Earth's atmosphere, a European spacecraft is lost

https://arstechnica.com/space/2025/06/a-european-spacecraft-company-flies-its-vehicle-then-loses-it-after-reentry/
1•rbanffy•30m ago•1 comments