Skip to content

Commit 96904fa

Browse files
authored
Merge pull request #336 from sshanks-kx/refactor
refactor
2 parents a630bc9 + 0ddf1d4 commit 96904fa

File tree

15 files changed

+196
-162
lines changed

15 files changed

+196
-162
lines changed

docs/basics/debug.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ q)). / down
9898
q))
9999
```
100100

101-
In a debugger session, `.z.ex` and `.z.ey` are set to the failed primitive and its argument list.
101+
In a debugger session, [`.z.ex`](../ref/dotz.md#zex-failed-primitive) and [`.z.ey`](../ref/dotz.md#zey-argument-to-failed-primitive) are set to the failed primitive and its argument list.
102102

103103
```q
104104
q)).z.ex
@@ -159,7 +159,7 @@ q)):17
159159

160160
## Abort
161161

162-
Use `\` to exit the debugger and abort execution.
162+
Use [`\`](syscmds.md#terminate) to exit the debugger and abort execution.
163163

164164
```q
165165
q))\
@@ -247,7 +247,7 @@ View calculations and system commands, including [`\l`](syscmds.md#l-load), corr
247247

248248
### Trap
249249

250-
[`.Q.trp[f;x;g]`](../ref/dotq.md#trp-extend-trap-at) extends `trap at` (`@[f;x;g]`) to collect backtrace. Along with the error string, `g` gets called with the backtrace object as a second argument. You can format it with `.Q.sbt` to make it legible.
250+
[`.Q.trp[f;x;g]`](../ref/dotq.md#trp-extend-trap-at) extends [`trap at` (`@[f;x;g]`)](../ref/apply.md#trap-at) to collect backtrace. Along with the error string, `g` gets called with the backtrace object as a second argument. You can format it with [`.Q.sbt`](../ref/dotq.md#sbt-string-backtrace) to make it legible.
251251

252252
```q
253253
q)f:{`hello+x}

docs/basics/errors.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ description: Errors signalled by the interpreter, and what triggers them
1111

1212
<style>dt {color:#F23A66}</style>
1313

14+
{directory}/q.k. OS reports: No such file or directory
15+
16+
: Using the environment variable `QHOME` (or `<HOME DIRECTORY>/q` if not set), `q.k` was not found in the directory specified. Check that the `QHOME` environment variable is correctly set to the directory containing `q.k`, which is provided in the kdb+ installation files.
17+
1418
[](){#access}
1519
access
1620

@@ -623,15 +627,15 @@ error | explanation
623627
{timestamp} couldn't connect to license daemon | Could not connect to KX license server ([kdb+ On Demand](../learn/licensing.md#licensing-server))
624628
[](){#cores}cores | The license is for [fewer cores than available](../learn/licensing.md#core-restrictions)
625629
[](){#cpu}cpu | The license is for fewer CPUs than available
626-
[](){#exp}exp | License expiry date is prior to system date
630+
[](){#exp}exp | License expiry date is prior to system date. The license has expired. Commercial license holders should have their Designated Contacts reach out to licadmin@kx.com or contact sales@kx.com to begin a new commercial agreement.
627631
[](){#host}host | The hostname reported by the OS does not match the hostname or hostname-pattern in the license.<br><br>If you see `255.255.255.255` in the kdb+ banner, the machine likely cannot resolve its hostname to an IP address, which will cause a `host` error.<br><br>Since 4.1t 2022.07.01,4.0 2022.07.01 the detected hostname is printed. It can be used to compare with the hostname used within the license.
628-
[](){#k4.lic}k4.lic | `k4.lic` file not found, check contents of environment variables [`QHOME`](../learn/install.md#step-2-put-kdb-in-qhome) and [`QLIC`](../learn/licensing.md#keeping-the-license-key-file-elsewhere)
632+
[](){#k4.lic}k4.lic | `k4.lic` file not found. If the environment variable [`QLIC`](../learn/licensing.md#keeping-the-license-key-file-elsewhere) is set, check it is set to the directory containing the license file. **Note** that it should not be set to the location of the license file itself, but to the directory that contains the license file. If `QLIC` is not set, check that the directory specified by the environment variables [`QHOME`](../learn/install.md#step-2-put-kdb-in-qhome) contains the license file.
629633
[](){#os}os | Wrong OS or operating-system error (if runtime error)
630634
[](){#srv}srv | Client-only license in server mode
631635
[](){#upd}upd | Version of kdb+ more recent than update date, _or_ the function `upd` is undefined (sometimes encountered during ``-11!`:logfile``)
632636
[](){#user}user | Unlicensed user
633-
[](){#wha}wha | System date is prior to kdb+ version date
634-
[](){#wrong-q.k-version}wrong q.k version | `q` and `q.k` versions do not match
637+
[](){#wha}wha | System date is prior to kdb+ version date. Check that the system date shows the correct date.
638+
[](){#wrong-q.k-version}wrong q.k version | `q` and `q.k` versions do not match. Check that the `q.k` file found in the directory specified by the `QHOME` environment variable is the same version as that supplied with the q binary.
635639

636640

637641
License-related errors are reported with the prefix `licence error: ` since V4.0 2019.10.22.

docs/basics/internal.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The operator `!` with a negative integer as left argument calls an internal func
1818
[-11!](#-11-streaming-execute) streaming execute -6! [eval](../ref/eval.md)
1919
[-14!x](#-14x-quote-escape) quote escape -7! [hcount](../ref/hcount.md)
2020
[-16!x](#-16x-ref-count) ref count -12! [.Q.host](../ref/dotq.md#host-ip-to-hostname)
21-
[-18!x](#-18x-compress-byte) compress byte -13! [.Q.addr](../ref/dotq.md#addr-iphost-as-int)
21+
[-18!x](#-18x-compress-bytes) compress bytes -13! [.Q.addr](../ref/dotq.md#addr-iphost-as-int)
2222
[-21!x](#-21x-compressionencryption-stats) compression/encryption stats -15! [md5](../ref/md5.md)
2323
[-22!x](#-22x-uncompressed-length) uncompressed length -19! [set](../ref/get.md#set)
2424
[-23!x](#-23x-memory-map) memory map -20! [.Q.gc](../ref/dotq.md#gc-garbage-collect)
@@ -98,6 +98,9 @@ q)-8!1 2 3
9898
0x010000001a000000060003000000010000000200000003000000
9999
```
100100

101+
:fontawesome-solid-hand-point-right:
102+
[`-9!x`](#-9x-from-bytes) (from bytes)
103+
101104

102105
## `-9!x` (from bytes)
103106

@@ -108,6 +111,9 @@ q)-9!-8!1 2 3
108111
1 2 3
109112
```
110113

114+
:fontawesome-solid-hand-point-right:
115+
[`-8!x`](#-8x-to-bytes) (to bytes), [-18!x](#-18x-compress-bytes) (compress bytes)
116+
111117
## `-10!x` (type enum)
112118

113119
Resolve a [type](datatypes.md) number to an [enum](enumerations.md) vector and check if it is available.
@@ -174,9 +180,31 @@ q)-16!a
174180
```
175181

176182

177-
## `-18!x` (compress byte)
183+
## `-18!x` (compress bytes)
184+
185+
Returns the IPC byte representation of `x` according to [`-8!x`](#-8x-to-bytes), applying compression based on [IPC compression rules](ipc.md#compression):
186+
187+
* Uncompressed serialized data has a length greater than 2000 bytes
188+
* Size of compressed data is less than &frac12; the size of uncompressed data
189+
190+
```q
191+
q)count -8!til 1000 / uncompressed
192+
8014
193+
q)count -18!til 1000 / compressed
194+
3276
195+
```
178196

179-
Returns compressed IPC byte representation of `x`, see notes about network compression in [Changes in V2.6](../releases/ChangesIn2.6.md)
197+
[-9!x](#-9x-from-bytes) can be used to uncompress and deserialise.
198+
199+
```q
200+
q)a:til 1000 / original data to convert
201+
q)x:-18!a / serialize and compression to bytes using IPC serialisation
202+
q)a~-9!x / test if deserialised version is same as original
203+
1b
204+
```
205+
206+
:fontawesome-solid-hand-point-right:
207+
[`-22!x`](#-22x-uncompressed-length) (uncompressed length), [`-9!x`](#-9x-from-bytes) (from bytes), [.Q.gz](../ref/dotq.md#gz-gzip) (gzip)
180208

181209
<!--
182210
## `-19!` (compress file)
@@ -262,6 +290,9 @@ q)(-22!v)=count -8!v
262290
1b
263291
```
264292

293+
:fontawesome-solid-hand-point-right:
294+
[`-18!x`](#-18x-compress-bytes) (compress bytes)
295+
265296

266297
## `-23!x` (memory map)
267298

@@ -342,7 +373,7 @@ In the result, all keys except `SSLEAY_VERSION` are initialized from their corre
342373
[SSL](../kb/ssl.md)
343374

344375

345-
## `-27!(x;y)` (format)
376+
## `-27!(x;y)` (IEEE754 precision format)
346377

347378
Where
348379

@@ -351,7 +382,7 @@ Where
351382

352383
returns `y` as a string or strings formatted as a float to `x` decimal places.
353384
(Since V3.6 2018.09.26.)
354-
It is atomic and doesn’t take `\P` into account. e.g.
385+
It is atomic and doesn’t take [`\P`](syscmds.md#p-precision) into account. For example:
355386

356387
```q
357388
q)-27!(3i;0 1+123456789.4567)

docs/basics/ipc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ For releases since 2012.05.29, kdb+ and the C-API will compress an outgoing mess
386386
- Connection does not resolve to being localhost (since 4.1t 2021.06.04)
387387
- Size of compressed data is less than &frac12; the size of uncompressed data
388388

389-
The compression/decompression algorithms are proprietary and implemented as the `compress` and `uncompress` methods in `c.java`. The message validator does not validate the integrity of compressed messages.
389+
The compression/decompression algorithms are proprietary and implemented as the `compress` and `uncompress` methods in the [Java API](https://github.com/kxsystems/javakdb). The message validator does not validate the integrity of compressed messages.
390390

391391
!!! note "Enumerations are automatically converted to values before sending through IPC."
392392

docs/basics/syscmds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ q)1%3
536536
:fontawesome-solid-book-open:
537537
[Precision](precision.md),
538538
[`-P` command-line option](cmdline.md#-p-display-precision),
539-
[`-27!` internal function](internal.md#-27xy-format)
539+
[`-27!` precision format with IEEE754 rounding](internal.md#-27xy-ieee754-precision-format)
540540
<br>
541541
:fontawesome-solid-globe:
542542
[What Every Computer Scientist Should Know About Floating-Point Arithmetic](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)

docs/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,3 @@ IDE: KX Developer](https://code.kx.com/developer/ "Download and install the free
5555
:fontawesome-solid-cloud:
5656
For cloud deployment, see [kdb Insights Core](https://code.kx.com/insights/core).
5757

58-
59-
:fontawesome-solid-globe:
60-
[Careers at KX and FD Technologies](http://www.firstderivatives.com/careers/)
61-

docs/interfaces/using-c-functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ description: Functions can be written in C or C++ as shared objects and loaded i
44
author: Charles Skelton
55
keywords: api, c, c++, interface, kdb+, library, q
66
---
7-
# C/C++ functions
7+
# Extending q using C/C++ functions
88

99

1010

11-
Q functionality can be extended using dynamically-loaded modules.
11+
Q functionality can be extended using dynamically-loaded modules, allowing C/C++ functions to be called directly from the q language.
1212

13-
To make a function `foo` defined in a shared object `bar.so` available in a q session, we use [2:](../ref/dynamic-load.md) to load the function dynamically.
13+
For example, to make a function `foo` defined in a shared object `bar.so` available in a q session, we use [2:](../ref/dynamic-load.md) to load the function dynamically.
1414

1515
```q
1616
q)foo:`bar 2:(`foo;n)

docs/kb/file-compression.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ date: August 2022
66
---
77
# File compression
88

9-
10-
11-
129
kdb+ can compress data as it is written to disk.
1310
Q operators and keywords read both compressed and uncompressed files.
1411

@@ -44,7 +41,6 @@ Cautions:
4441
- Use `set` and not **gzip**: they produce different results.
4542

4643

47-
4844
### Compression parameters
4945

5046
Compression is specified by three integers representing logical block size, algorithm, and compression level.
@@ -229,32 +225,39 @@ However, multiple files can be read or written from their own threads concurrent
229225

230226
## Requirements
231227

232-
Libraries for Gzip and Snappy may already be installed on your system.
233-
kdb+ binds dynamically to [Zlib](http://zlib.net) and looks for certain files for Snappy.
228+
Compression libraries may already be installed on your system.
229+
kdb+ binds dynamically to the compression libraries when required.
234230

235231
!!! detail "64-bit and 32-bit kdb+ require corresponding 64-bit and 32-bit libs"
236232

237233
If in doubt, consult your system administrator for assistance.
238234

239-
algorithm | source | :fontawesome-brands-linux: Linux | :fontawesome-brands-apple: macOS | :fontawesome-brands-windows: Windows
240-
---|---|---|---|---
241-
2 (Gzip) | [Zlib](http://zlib.net) | `zlib` | (pre-installed) | [WinImage](http://www.winimage.com/zLibDll/index.html "winimage.com")
242-
3 (Snappy) | [GitHub](http://google.github.io/snappy/) | `libsnappy.so.1` | `libsnappy.dylib` | `snappy.dll`
243-
4 (Lz4hc) | [GitHub](https://github.com/lz4/lz4) | `liblz4.so.1` | `liblz4.dylib` | `liblz4.dll`
244-
5 (zstd) | [GitHub](https://github.com/facebook/zstd) | `libzstd.so.1` | `libzstd.1.dylib` | `libzstd.dll`
235+
### Gzip
236+
237+
Compression algoritm `2` uses Gzip. Source and algorithm details can be found [here](http://zlib.net).
238+
The following libraries are required by kdb+:
245239

246-
=== ":fontawesome-brands-apple: macOS"
240+
| :fontawesome-brands-linux: Linux | :fontawesome-brands-apple: macOS | :fontawesome-brands-windows: Windows
241+
---|---|---
242+
libz.so.1 | libz.dylib<br>(pre-installed) | zlibwapi.dll<br>(32-bit and 64-bit versions available from [WinImage](http://www.winimage.com/zLibDll/index.html "winimage.com"))
247243

248-
To install Snappy or Lz4 on macOS, use a package manager such as [Homebrew](https://brew.sh/) or [MacPorts](https://www.macports.org/):
244+
### Snappy
249245

250-
# install with MacPorts
251-
sudo port install snappy +universal
252-
export LD_LIBRARY_PATH=/opt/local/lib
246+
Compression algoritm `3` uses Snappy. Source and algorithm details can be found [here](http://google.github.io/snappy/).
247+
The following libraries are required by kdb+:
253248

254-
=== ":fontawesome-brands-windows: Windows"
249+
| :fontawesome-brands-linux: Linux | :fontawesome-brands-apple: macOS | :fontawesome-brands-windows: Windows
250+
---|---|---
251+
libsnappy.so.1 | libsnappy.dylib<br>(available via package managers such as [Homebrew](https://brew.sh/) or [MacPorts](https://www.macports.org/)) | snappy.dll
255252

256-
Build the `liblz4-dll` project on Windows as outlined in the [README at GitHub](https://github.com/lz4/lz4/tree/release/build).
253+
### LZ4
257254

255+
Compression algoritm `4` uses LZ4. Source and algorithm details can be found [here](https://github.com/lz4/lz4).
256+
The following libraries are required by kdb+:
257+
258+
| :fontawesome-brands-linux: Linux | :fontawesome-brands-apple: macOS | :fontawesome-brands-windows: Windows
259+
---|---|---
260+
liblz4.so.1 | liblz4.dylib<br>(available through package managers such as [Homebrew](https://brew.sh/) or [MacPorts](https://www.macports.org/)) | liblz4.dll <br>(build the `liblz4-dll` project on Windows as outlined in the [README at GitHub](https://github.com/lz4/lz4/tree/release/build))
258261

259262
!!! danger "Certain releases of `lz4` do not function correctly within kdb+"
260263

@@ -264,6 +267,15 @@ algorithm | source | :fontawesome-brands-linux: Linux | :fontawesome-brands-appl
264267
`lz4-1.8.3` works.
265268
We recommend using the latest `lz4` [release](https://github.com/lz4/lz4/releases) available.
266269

270+
### Zstd
271+
272+
Compression algoritm `5` uses zstd (Zstandard). Source and algorithm details can be found [here](https://github.com/facebook/zstd).
273+
The following libraries are required by kdb+:
274+
275+
| :fontawesome-brands-linux: Linux | :fontawesome-brands-apple: macOS | :fontawesome-brands-windows: Windows
276+
---|---|---
277+
libzstd.so.1 | libzstd.1.dylib<br>(available via package managers such as [Homebrew](https://brew.sh/) or [MacPorts](https://www.macports.org/)) | libzstd.dll
278+
267279

268280
## Running kdb+ under Gdb
269281

0 commit comments

Comments
 (0)