diff --git a/solutions/c/01-dr6/explanation.md b/solutions/c/01-dr6/explanation.md deleted file mode 100644 index 9c6e9b1..0000000 --- a/solutions/c/01-dr6/explanation.md +++ /dev/null @@ -1,16 +0,0 @@ -The entry point for your SQLite implementation is in `src/main.c`. - -Study and uncomment the relevant code: - -```c -// Uncomment this to pass the first stage -printf("database page size: %u\n", page_size); -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/clojure/01-dr6/code/sample.db b/solutions/clojure/01-dr6/code/sample.db new file mode 100644 index 0000000..687673e Binary files /dev/null and b/solutions/clojure/01-dr6/code/sample.db differ diff --git a/solutions/clojure/01-dr6/explanation.md b/solutions/clojure/01-dr6/explanation.md deleted file mode 100644 index 55e35d9..0000000 --- a/solutions/clojure/01-dr6/explanation.md +++ /dev/null @@ -1,22 +0,0 @@ -The entry point for your SQLite implementation is in `src/sqlite/core.clj`. - -Study and uncomment the relevant code: - -```clojure -;; Uncomment this block to pass the first stage -(let [command (second args)] - (case command - ".dbinfo" - (let [db-file-path (first args) - contents (lazy-byte-seq db-file-path) - page-size (bytes-to-int (take 2 (drop 16 contents)))] - (println (str "database page size: " page-size))))) -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/cpp/01-dr6/explanation.md b/solutions/cpp/01-dr6/explanation.md deleted file mode 100644 index 517b7ff..0000000 --- a/solutions/cpp/01-dr6/explanation.md +++ /dev/null @@ -1,23 +0,0 @@ -The entry point for your SQLite implementation is in `src/main.cpp`. - -Study and uncomment the relevant code: - -```cpp -// Uncomment this to pass the first stage -database_file.seekg(16); // Skip the first 16 bytes of the header - -char buffer[2]; -database_file.read(buffer, 2); - -unsigned short page_size = (static_cast(buffer[1]) | (static_cast(buffer[0]) << 8)); - -std::cout << "database page size: " << page_size << std::endl; -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/csharp/01-dr6/explanation.md b/solutions/csharp/01-dr6/explanation.md deleted file mode 100644 index bdac657..0000000 --- a/solutions/csharp/01-dr6/explanation.md +++ /dev/null @@ -1,20 +0,0 @@ -The entry point for your SQLite implementation is in `src/Program.cs`. - -Study and uncomment the relevant code: - -```csharp -// Uncomment this line to pass the first stage -databaseFile.Seek(16, SeekOrigin.Begin); // Skip the first 16 bytes -byte[] pageSizeBytes = new byte[2]; -databaseFile.Read(pageSizeBytes, 0, 2); -var pageSize = ReadUInt16BigEndian(pageSizeBytes); -Console.WriteLine($"database page size: {pageSize}"); -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/elixir/01-dr6/code/sample.db b/solutions/elixir/01-dr6/code/sample.db new file mode 100644 index 0000000..687673e Binary files /dev/null and b/solutions/elixir/01-dr6/code/sample.db differ diff --git a/solutions/elixir/01-dr6/explanation.md b/solutions/elixir/01-dr6/explanation.md deleted file mode 100644 index f5df671..0000000 --- a/solutions/elixir/01-dr6/explanation.md +++ /dev/null @@ -1,18 +0,0 @@ -The entry point for your SQLite implementation is in `lib/main.ex`. - -Study and uncomment the relevant code: - -```elixir -# Uncomment this to pass the first stage -:file.position(file, 16) # Skip the first 16 bytes of the header -<> = IO.binread(file, 2) -IO.puts("database page size: #{page_size}") -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/gleam/01-dr6/explanation.md b/solutions/gleam/01-dr6/explanation.md deleted file mode 100644 index 9620728..0000000 --- a/solutions/gleam/01-dr6/explanation.md +++ /dev/null @@ -1,30 +0,0 @@ -The entry point for your SQLite implementation is in `src/main.gleam`. - -Study and uncomment the relevant code: - -```gleam -// Uncomment this to pass the first stage -case args { - [database_file_path, ".dbinfo", ..] -> { - let assert Ok(rs) = read_stream.open(database_file_path) - // Skip the first 16 bytes - let assert Ok(_bytes) = read_stream.read_bytes_exact(rs, 16) - // The next 2 bytes hold the page size in big-endian format - let assert Ok(page_size) = read_stream.read_uint16_be(rs) - - io.print("database page size: ") - io.println(to_string(page_size)) - } - _ -> { - io.println("Unknown command") - } -} -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/go/01-dr6/explanation.md b/solutions/go/01-dr6/explanation.md deleted file mode 100644 index dbf0e6b..0000000 --- a/solutions/go/01-dr6/explanation.md +++ /dev/null @@ -1,16 +0,0 @@ -The entry point for your SQLite implementation is in `app/main.go`. - -Study and uncomment the relevant code: - -```go -// Uncomment this to pass the first stage -fmt.Printf("database page size: %v", pageSize) -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/java/01-dr6/explanation.md b/solutions/java/01-dr6/explanation.md deleted file mode 100644 index 7fbbf1a..0000000 --- a/solutions/java/01-dr6/explanation.md +++ /dev/null @@ -1,16 +0,0 @@ -The entry point for your SQLite implementation is in `src/main/java/Main.java`. - -Study and uncomment the relevant code: - -```java -// Uncomment this block to pass the first stage -System.out.println("database page size: " + pageSize); -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/javascript/01-dr6/explanation.md b/solutions/javascript/01-dr6/explanation.md deleted file mode 100644 index c1c487c..0000000 --- a/solutions/javascript/01-dr6/explanation.md +++ /dev/null @@ -1,17 +0,0 @@ -The entry point for your SQLite implementation is in `app/main.js`. - -Study and uncomment the relevant code: - -```javascript -// Uncomment this to pass the first stage -const pageSize = buffer.readUInt16BE(16); // page size is 2 bytes starting at offset 16 -console.log(`database page size: ${pageSize}`); -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/kotlin/01-dr6/explanation.md b/solutions/kotlin/01-dr6/explanation.md deleted file mode 100644 index b2aa4b6..0000000 --- a/solutions/kotlin/01-dr6/explanation.md +++ /dev/null @@ -1,21 +0,0 @@ -The entry point for your SQLite implementation is in `app/src/main/kotlin/App.kt`. - -Study and uncomment the relevant code: - -```kotlin -// Uncomment this block to pass the first stage - -databaseFile.skip(16) // Skip the first 16 bytes of the header -val pageSizeBytes = ByteArray(2) // The following 2 bytes are the page size -databaseFile.read(pageSizeBytes) -val pageSize = ByteBuffer.wrap(pageSizeBytes).short.toUShort() -println("database page size: $pageSize") -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/python/01-dr6/explanation.md b/solutions/python/01-dr6/explanation.md deleted file mode 100644 index 40e5b5a..0000000 --- a/solutions/python/01-dr6/explanation.md +++ /dev/null @@ -1,18 +0,0 @@ -The entry point for your SQLite implementation is in `app/main.py`. - -Study and uncomment the relevant code: - -```python -# Uncomment this to pass the first stage -database_file.seek(16) # Skip the first 16 bytes of the header -page_size = int.from_bytes(database_file.read(2), byteorder="big") -print(f"database page size: {page_size}") -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/ruby/01-dr6/explanation.md b/solutions/ruby/01-dr6/explanation.md deleted file mode 100644 index 121487a..0000000 --- a/solutions/ruby/01-dr6/explanation.md +++ /dev/null @@ -1,18 +0,0 @@ -The entry point for your SQLite implementation is in `app/main.rb`. - -Study and uncomment the relevant code: - -```ruby -# Uncomment this to pass the first stage -database_file.seek(16) # Skip the first 16 bytes of the header -page_size = database_file.read(2).unpack("n")[0] -puts "database page size: #{page_size}" -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/rust/01-dr6/explanation.md b/solutions/rust/01-dr6/explanation.md deleted file mode 100644 index de3429e..0000000 --- a/solutions/rust/01-dr6/explanation.md +++ /dev/null @@ -1,16 +0,0 @@ -The entry point for your SQLite implementation is in `src/main.rs`. - -Study and uncomment the relevant code: - -```rust -// Uncomment this block to pass the first stage -println!("database page size: {}", page_size); -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/swift/01-dr6/explanation.md b/solutions/swift/01-dr6/explanation.md deleted file mode 100644 index b0c8ce0..0000000 --- a/solutions/swift/01-dr6/explanation.md +++ /dev/null @@ -1,17 +0,0 @@ -The entry point for your SQLite implementation is in `Sources/swift-sqlite-challenge/Main.swift`. - -Study and uncomment the relevant code: - -```swift -// Uncomment this block to pass the first stage -let pageSize = UInt16(database[16..<18]) -print("database page size: \(pageSize)") -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/typescript/01-dr6/explanation.md b/solutions/typescript/01-dr6/explanation.md deleted file mode 100644 index cff5c36..0000000 --- a/solutions/typescript/01-dr6/explanation.md +++ /dev/null @@ -1,17 +0,0 @@ -The entry point for your SQLite implementation is in `app/main.ts`. - -Study and uncomment the relevant code: - -```typescript -// Uncomment this to pass the first stage -const pageSize = new DataView(buffer.buffer, 0, buffer.byteLength).getUint16(16); -console.log(`database page size: ${pageSize}`); -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -``` diff --git a/solutions/zig/01-dr6/explanation.md b/solutions/zig/01-dr6/explanation.md deleted file mode 100644 index 195b465..0000000 --- a/solutions/zig/01-dr6/explanation.md +++ /dev/null @@ -1,21 +0,0 @@ -The entry point for your SQLite implementation is in `src/main.zig`. - -Study and uncomment the relevant code: - -```zig -// Uncomment this block to pass the first stage -var buf: [2]u8 = undefined; -_ = try file.seekTo(16); -_ = try file.read(&buf); -const page_size = std.mem.readInt(u16, &buf, .big); -try stdout.print("database page size: {}\n", .{page_size}); -try stdout.flush(); -``` - -Push your changes to pass the first stage: - -``` -git add . -git commit -m "pass 1st stage" # any msg -git push origin master -```