John Dempster - John Dempster

Forum Replies Created

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • in reply to: show tables in kdb+ #442

    \a or system “a” will list all the tables that exist on the kdb+ server.

    q)t:([] a:1 2 3)
    q)\a
    ,`t
    q)system “a”
    ,`t
    q)t2:([] c:4 5)
    q)\a
    `s#`t`t2
    q)system “a”
    `s#`t`t2

    in reply to: rank error during select x y z from table #260

    It is a bug. q has issues with default parameters and qsql queries inside function. You can see this from the code below:

    `q)t:([] a:1 2 3 4 5; b:6 7 8 9 0)
    q)t
    a b

    1 6
    2 7
    3 8
    4 9
    5 0`

    One parameter works
    `
    q){select from t where a in x}[2 3]
    a b

    2 7
    3 8`

    Two parameters fail.
    `
    q){select from t where a in x,b in y}[2 3;6 7]
    ‘rank
    `

    Notice when I name the parameters the function executes successfully.
    `
    q){[x;y] select from t where a in x,b in y}[2 3;6 7]
    a b

    2 7`

    I recommend specifying sensible names (not x/y) as much as possible.

    in reply to: 'host error setting up new kdb+ server #259

    Your license file from KX specifies what host is allowed to run KDB. The new machine has a different hostname.

    Copy the startup banner of the ‘host error kdb server process and send an email to KX with those details pasted in. They will then send you the required license file.

    in reply to: How much do Kdb+ developers make? #258

    It depends.. Despite what this post seems to suggest:
    http://magmasystems.blogspot.com/2007/12/get-rich-quick-with-kdb.html
    Kdb isn’t some golden ticket, your other qualifications and skills matter. What uni did you go to? What is your degree/masters in? Do you have any financial knowledge.

    Supposedly: http://www.itjobswatch.co.uk/jobs/uk/kdb.do
    Average salary £87,500
    Average salary % change year-on-year +6.06%
    90% offered a salary of more than £50,500
    10% offered a salary of more than £119,000

    Google the job sites
    http://www.indeed.co.uk/Kdb-jobs

    Contact some recruiters on linkedin. Ask Friends.

    in reply to: How to list all tables that exist on kdb server? #256

    To show variables that exist on the server there are a number of system or slash commands:

    q)t:([] a:1 2)
    q)s:([] b:3 4)
    q)v:1
    q)f:{x}
    q)vieww::select from t where i<1

    System or slash a to show tables.
    q)system “a”
    `s`t
    q)\a
    `s`t
    q)tables[]
    `s`t

    b is views, v is variables, f is functions
    q)\b
    ,`vieww
    q)\v
    `b`s`t`v
    q)\f
    `cls`f`regr

    Or key shows all objects that exist in a namespace:

    q)key `.
    `cls`regr`b`t`s`v`f`vieww

    • This reply was modified 10 years, 11 months ago by John Dempster.
    in reply to: vim kdb keyword syntax highlight #255

    Vim Syntax highlighting is possible. See details here for setting up kdb:
    http://www.timestored.com/kdb-guides/developer-environment

    in reply to: run q script in kdb console #254

    Either use \l or system l to load q script files.

    C:\>echo “show `helloWorld” >> hi.q

    C:\>q
    KDB+ 2.8 2012.02.05 Copyright (C) 1993-2012 Kx Systems
    w64/ 8()core 8169MB admin box 192.168.0.2 EXPIRE 2013.12.31

    q)\l hi.q
    “show `helloWorld”
    q)system “l hi.q”
    “show `helloWorld”

    Multi-line commands are tricky, I would instead use the qStudio KDB GUI that allows highlighting the text you want and executing it.

    in reply to: for loop evil, but wanted #144

    the q language does not have a for loop. Other control statements are available. e.g.


    q)i:0; while[i<3; show i; i:i+1]; show `end
    0
    1
    2
    `end
    q)i
    3

    q)do[3; show i; i:i+1]; show `end
    6
    7
    8
    `end

    if, else are also possible.

Viewing 8 posts - 16 through 23 (of 23 total)