Forum Replies Created

Page 19 of 22
  • rocuinneagain

    Member
    April 1, 2022 at 12:00 am in reply to: Financial chart
    1. How are you trying to plot the data? table, bar, line etc. ?
    2. Are you seeing an error? Why do you say it cannot be plotted?

     

    Common components to chart:

  • rocuinneagain

    Member
    April 1, 2022 at 12:00 am in reply to: 1 "hello" return hello1

    This behaviour happens with file handles also:

    Applying the handle to data appends it to the file as bytes.
    Applying the neg of the handle to char data appends it as text. The result of a successful operation is the positive or negative handle.

    File system | Basics | kdb+ and q documentation – Kdb+ and q documentation (kx.com)

    As to why I am not sure. The choice could have been made to return a generic null (::) instead possibly.

     

    For stdout and stderr it can feel strange at first but it is not printing ‘hello1’ in one go. Instead ‘hello’ is printed as you requested then as you are in an interactive session the q) prompt wants to display the returned object so it then prints ‘1’.

    q)1"hello"; //The ; stops the q) prompt from printing the returned object '1' hello
    q)
    q)-1"hello"; //-1 is often more useful as it includes a n newline char hello

     

  • rocuinneagain

    Member
    March 21, 2022 at 12:00 am in reply to: What is the purpose of publishing value each t to t in .u.pub?

    This is batching mode when the timer t is set. https://code.kx.com/q/basics/syscmds/#t-timer

    In this mode the TP will cache data and only publish it when the timer triggers .z.ts https://code.kx.com/q/ref/dotz/#zts-timer

    In this case t is a list of tables and it calls pub on each of them (' form)  https://code.kx.com/q/ref/maps/#each

    value is called so that the cached data from the TP is populated in pub to send to subscribers (RDB etc.)

    Some more information on batch mode: https://code.kx.com/q/wp/tick-profiling/

     

    q)upd'[t;value each t] 
    //A demo 'upd' which prints the parameters sent to it 
    q)a:([] c1:1 2 3) 
    q)b:([] c2:4 5 6) 
    q)t:tables[] //Create list of tables 
    q)t `s#`a`b 
    q)upd'[t;value each t] (`a;+(,`c1)!,1 2 3) (`b;+(,`c2)!,4 5 6)

     

     

  • rocuinneagain

    Member
    March 11, 2022 at 12:00 am in reply to: Save creating 3 files

    Can you include a small reproducible piece of code?

    I do not see the files being created.

    //Including kdb+ version information 
    //If behaviour has changed include previous version information also 
    q).z.k 2021.07.12 
    q).z.K 4f 
    //An example table
    q)ot:([]a:1 2 3;b:`a`b`n;c:("jj";"kk";"pp")) 
    q)save `ot `:ot 
    //No # or ## files created by `save` keyword 
    q){x where x like "ot*"}key `:. ,`ot

     

    The # and ## files you see are used by the anymap datatype on disk.

    You can still read your file with

    get `:ot

     

  • rocuinneagain

    Member
    March 10, 2022 at 12:00 am in reply to: Cannot run kdb 64bit behind a proxy

    The email you received with your kc.lic included some details on this topic:

     

    Generally, kdb+ as an on-demand client behaves exactly like, and should be treated the same as, any plain http client (e.g. curl, apt-get or firefox) accessing a CDN-fronted web service.
    It connects to a remote port 80 as part of a normal http request; thus you generally only need to allow outbound http _connections_ but both _traffic_ to and from remote port 80.
    As the communication protocol is plain http you can employ any standard mechanism, including proxies (transparent and opaque by setting the HTTP_PROXY environment variable) as long as kdb+ is able to issue an http request and receive a response from the remote Kx service.
    If you need to allowlist the remote servers should treat kdb+ on-demand as a CDN-fronted service and employ DNS-based filtering. The current list of hostnames required for kdb+ on-demand operation is {h,g}.kdbod.{com,net,org}.

  • rocuinneagain

    Member
    March 8, 2022 at 12:00 am in reply to: Purpose of s.k file in q

    There is some background on DSL files here:

    https://code.kx.com/q/wp/query-interface/#background

    What documentation are you following for JDBC connectivity?

  • rocuinneagain

    Member
    February 18, 2022 at 12:00 am in reply to: Anyone using the Tensorflow functional API from inside q(embedpy)?

    You could load the function in to q rather than redefine it line by line.

     

    Example file.p

    def get_model(input_shape, time2vec_dim = 3): inp = Input(input_shape) x = inp time_embedding = keras.layers.TimeDistributed(Time2Vec(time2vec_dim – 1))(x)

    Load it and pull in the function:

    q)l file.p 
    q)get_model:.p.get`get_model 
    q)get_model[(65;16)]

    Another example of this: https://github.com/rianoc/qparquet

     

    Looking to replicate an example from https://keras.io/api/layers/recurrent_layers/time_distributed/

    q)lyr:.p.import`keras.layers 
    q)x:lyr[`:Input;`shape pykw (10, 128, 128, 3)] 
    q)conv_2d_layer:lyr[`:Conv2D;64;(3;3)] 
    q)time_embedding:lyr[`:TimeDistributed;conv_2d_layer] q
    )outputs:time_embedding[x] 
    q)print outputs[`:shape] (None, 10, 126, 126, 64)

     

  • rocuinneagain

    Member
    February 15, 2022 at 12:00 am in reply to: embedPy inside q (kdb+) process fails to import a module

    The error is that a variable “cxt” is not being found.

    https://code.kx.com/q/basics/errors/#runtime-errors

     

    General debugging tips included on: https://code.kx.com/q/basics/debug/

     

    As this is a third party project you will get better support by raising an issue with the developer directly:

    The developer does not document the supported embedPy versions which would be important to know.

     

    One difference I see is you are calling

    pc:.cbpro.PublicClient[]

    But the developer passes a string – this could be your issue

    https://github.com/michaelsimonelli/qoinbase-q/blob/359653d9e45b6319d897f5ae50af048225605ae2/cbpro.q#L27

    cli: .cli.priv.addFuncs .cbpro.PublicClient[url];

     

     

  • rocuinneagain

    Member
    February 15, 2022 at 12:00 am in reply to: KX SQL Introductory Project – .s.e error

    To load the SQL interpreter you can run:

     

    l s.k

     

    Otherwise when you run your first ‘s)’ query this would be done automatically.

  • rocuinneagain

    Member
    February 7, 2022 at 12:00 am in reply to: KX Dashboards Help "Text Editor"

    Hi Michael,

    Hopefully this helps.

    Sample Datasource:

    ([] description:enlist “ROMANI 4.875 01/24”;Volume:enlist 1.6385)

    ‘Template Text’ in ‘Text’ widget:

    {{#each this}} {{description}} <br> Volume:{{toPrecision Volume 2}}m {{/each}}

     

     

     

  • rocuinneagain

    Member
    February 2, 2022 at 12:00 am in reply to: Default dictionary value

    This blog on JSON parsing may also have some useful tips for you as it covers some areas of nested data with irregular keys

    https://kx.com/blog/kdb-q-insights-parsing-json-files/

     

    An example for your ask is to use a prototype dictionary of default values

    
    
    // Prototype of default values if lookup fails 
    q)p:`a`b`c`d!("X";99;99;99) 
    q)p a| "X" b| 99 c| 99 d| 99 
    // Actual dictionary 
    q)d:`a`b`c!("";2;3) 
    q)d a| "" b| 2 c| 3 
    // Failed lookup uses null of type of first key 
    // a is first key, it is type char, null char is "" 
    q)d`d "" 
    // Prototype can be used by appending your dict to it 
    q)(p,d)`d 99 
    q)(p,d)`b 2 // Handles vectors of keys nicely 
    q)(p,d)`d`b`a 99 2 ""

     

     

  • rocuinneagain

    Member
    January 24, 2022 at 11:00 am in reply to: Wordle kdb

    Another kdb implementation of the game:  https://github.com/psaris/wordle

  • rocuinneagain

    Member
    January 22, 2022 at 11:00 am in reply to: Wordle kdb

    I didn’t fully read the question, got distracted by the idea of a q implementation of the game.

    https://github.com/rianoc/qWordle

  • rocuinneagain

    Member
    January 13, 2022 at 12:00 am in reply to: 0D infront of timespan

    The day part is an integral portion of the datatype and will display by default.

     

    In a UI/display time it can be dropped if required:

    q)2_string .z.n /Atom "14:41:40.125906000" 
    q)2_/:string 2#.z.n /List "14:42:00.701751000" "14:42:00.701751000" 
    q)update 2_/:string time from ([] time:2#.z.n) 
    /Column in table 
    time 
    -------------------- 
    "14:42:38.625329000" 
    "14:42:38.625329000" 
    // All columns of timespan type in a table 
    q)dropDays:{c:where -16h=type each first x;$[count c;![x;();0b;c!{((/:;_);2;($:;x))}each c];x]} 
    q)dropDays ([] time:2#.z.n;b:1.1 1.2) 
    time b 
    ------------------------ 
    "14:47:37.376270000" 1.1 
    "14:47:37.376270000" 1.2

     

  • rocuinneagain

    Member
    January 13, 2022 at 12:00 am in reply to: perform gc per .z.pg

    Is there a reason you cannot use -g 1 ?

    Running .Q.gc[] so often is not the best approach but if you needed to a timer could check and run if after .z.pg for you:

    runGC:0b 
    .z.pg:{ bigresult: value x;runGC::1b; bigresult };
    .z.ts:{if[runGC;.Q.gc[];runGC::0b]} t 1

    https://code.kx.com/q/ref/dotz/#zts-timer

    To run it less often you could set a threshold and in the if statement check memory usage

    https://code.kx.com/q/ref/dotq/#qw-memory-stats

Page 19 of 22