

rocuinneagain
Forum Replies Created
-
rocuinneagain
MemberNovember 7, 2023 at 12:00 am in reply to: Getting Error while Starting q consoleWhen you download q it is included. Folder structure looks like:
kc.lic w64 q q.k
As shown on https://code.kx.com/q/learn/install/#step-3-install-the-license-file
-
rocuinneagain
MemberNovember 6, 2023 at 12:00 am in reply to: Getting Error while Starting q consoleThis is due to an issue with the QHOME environment variable
See: https://code.kx.com/q/learn/install/
Specifically: https://code.kx.com/q/learn/install/#step-5-edit-your-profile
setx QHOME “C:q”
Note that this points to the folder containing q.k and not to the file itself
-
https://code.kx.com/q/basics/errors/#:~:text=formed%20select%20query-,hop,-Request%20to%20hopen
hop
Request to
hopen
a handle fails; includes message from OSYour code is trying to open a handle to a process listening on port 5001 but one is not available.
-
Yes it could be used.
To test you could look at PyKX for an easy Python interface.
A 2 minute example of passing in a Dataset to q in shown below.
PyKX allows Registering Custom Conversions so you could create a function to pass the Dataset in exactly the form you wish to q instead of passing it all as a dictionary in my example.
import pykx as kx import xarray as xr import numpy as np import pandas as pd
ds = xr.Dataset( {"foo": (("x", "y"), np.random.rand(5, 5))}, coords={ "x": [10, 20, 30, 40, 50], "y": pd.date_range("2000-01-01", periods=5), "z": ("x", list("abcde")), }, )
kx.q['ds'] = kx.toq(ds.to_dict())
kx.q('ds')
pykx.Dictionary(pykx.q(' coords | `x`y`z!+`dims`attrs`data!((,`x;,`y;,`x);(()!();()!();()!());(10 20.. attrs | ()!() dims | `x`y!5 5 data_vars| (,`foo)!+`dims`attrs`data!(,`x`y;,()!();,(0.7412575 0.2054306 0.10.. '))
kx.q('flip ds[`coords;;`data]')
pykx.Table(pykx.q(' x y z ---------------------------------- 10 2000.01.01D00:00:00.000000000 a 20 2000.01.02D00:00:00.000000000 b 30 2000.01.03D00:00:00.000000000 c 40 2000.01.04D00:00:00.000000000 d 50 2000.01.05D00:00:00.000000000 e '))
kx.q('ds[`data_vars;`foo;`data]')
pykx.List(pykx.q(' 0.7412575 0.2054306 0.1009393 0.8792678 0.04105999 0.1811459 0.01659637 0.2406029 0.4900055 0.551788 0.6303767 0.0702013 0.6831359 0.5961667 0.3722388 0.9255059 0.9202499 0.5055902 0.9767793 0.7440498 0.7331576 0.003197568 0.4939932 0.5433492 0.01175784 '))
-
You can take the old definition from the q.k file from the 2.8 version
And define it in your process with a new name:
k)wj1_28:{…
https://nexus.firstderivatives.com client login has downloads for versions of kdb+ including 2.8:
KxReleases --> KDBPlus -->Releases
Some instead use: https://downloads.kx.com/
-
rocuinneagain
MemberSeptember 20, 2023 at 12:00 am in reply to: .Q.f output unexpected value in kdb4.0From 3.6 Readme2018.09.26 NEW added -27! as a more precise, builtin version of .Q.f. n.b. It is atomic and doesn't take P into account. e.g. q)("123456789.457";"123456790.457")~-27!(3i;0 1+2#123456789.4567)
The definition of.Q.f
changed at this time also – when comparingq.k
file definitions:3.6.0 2018.09.10
f:{$[^y;"";y<0;"-",f[x;-y];y<1;1_f[x;10+y];9e15>j:"j"$y*/x#10;(x_j),".",(x:-x)#j:$j;$y]}
3.6.0 2018.10.03
f:{$[^y;"";y<0;"-",f[x;-y];y<1;1_f[x;10+y];9e15>j:"j"$y*prd x#10f;(x_j),".",(x:-x)#j:$j;$y]}
Floating point numbers are not exact and such behaviours should be expected in certain cases:
https://code.kx.com/q/basics/precision/
They are approximations:q)P 0 q)4194303.975 4194303.9750000001 q)4194304.975 4194304.9749999996
The same in C:int main() { double x = 4194303.975; printf("%10.10fn",x); }
Result:4194303.9750000001
If you find that you need exact decimal rounding, consider whether you actually need to operate in fixed-point, rather than floating-point.
e.g. keep monetary values in integral millicents etc. -
If you have a q process which is able to use TLS then you can compare the output of it’s -26![] with the output of pykx.ssl_info[] in Python. This often shows what differences are causing the problems. – https://code.kx.com/q/basics/internal/#-26x-ssl – https://code.kx.com/pykx/1.6/changelog.html#pykx-140
-
If you have a q process which is able to use TLS then you can compare the output of it’s
-26![]
with the output ofpykx.ssl_info[]
in Python. This often shows what differences are causing the problems.- https://code.kx.com/q/basics/internal/#-26x-ssl
- https://code.kx.com/pykx/1.6/changelog.html#pykx-140
-
This blog will have useful information:
Explore the methodology and benefits of kdb+ Memory Mapping | KX
-
rocuinneagain
MemberAugust 23, 2023 at 12:00 am in reply to: setup kx/kdb instance in a new linux server/machineIf python is running a server but your browser cannot connect it suggests an issue with the network settings and not kdb+. Are only certain ports open?
If I can only use ssh port I often set up a port forward so I can connect on my machine
https://linux.die.net/man/1/ssh#:~:text=%2DL%5Bbind_address%3A%5Dport%3Ahost%3Ahostport
ssh -L 6154:localhost:6154 whateveryourusernameis@10.106.4.131
-
rocuinneagain
MemberAugust 23, 2023 at 12:00 am in reply to: setup kx/kdb instance in a new linux server/machineFor 3. the suggestion is to test in a browser. A q connection to the python server would fail as the protocols are different.
-
rocuinneagain
MemberAugust 22, 2023 at 12:00 am in reply to: q check/load csv with file name including "-" -
rocuinneagain
MemberAugust 17, 2023 at 12:00 am in reply to: Tableau incremental refresh not working as expected on kdb, through kdb odbc driver.Could you format you code. This will make it easier for others to read/understand it so that they can help.
-
rocuinneagain
MemberAugust 16, 2023 at 12:00 am in reply to: setup kx/kdb instance in a new linux server/machine- Is it possible you have some firewall/networking rules blocking remote access?
- Can you open 10.106.4.131:6144 in your browser?
- Can you try something other than kdb? .i.e
python3 -m http.server 6144
and connect your browser.