Welcome to the new home of the KX Community and KX Academy! Existing users are required to reset their passwords to log in

Forum Replies Created

Page 6 of 14
  • megan_mcp

    Administrator
    July 5, 2024 at 8:51 am in reply to: Advanced Capstone 2.2

    Hi @jeanluck

    Can you send me your exact answer for exercise 2.2 so I can spot where you might be going wrong?

    Thanks,

    Megan🙂

  • megan_mcp

    Administrator
    June 28, 2024 at 12:36 pm in reply to: differ by in qsql

    Hi @kdb_newbie

    I have reformatted this question due to issues with our editor.

    Thank you @unterrainer_ale for providing an example.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 28, 2024 at 12:28 pm in reply to: partitioned exercise question

    Hi @lestat-jin

    Apologies for the formatting issue on our side, we are working to fix this for future discussions.

    Would you be able to send a screenshot of the code so we can help better assist you?

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 14, 2024 at 8:40 am in reply to: Error Loading and Continue KX Academy

    Hi @biman

    I am sorry to hear you are experiencing issues with our academy.

    Can you try accessing the academy in incognito mode ?

    If you are trying to access the KX Sandbox through the academy, you can do this by going directly to “edu.kx.com”.

    If this issue still persists, please let me know and we will investigate it further.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 1:15 pm in reply to: What is the need of a flip of splay or partitioned table ?

    Hi @newstudent2017

    This operation is used internally by kdb+ to represent the flip of a memory-mapped splayed table. When loading a database with \l, the tables in the database are added to the root namespace using this operation.

    x!y ![x;y]

    The result must be flipped in order to use it as a table. After doing that, select statements will operate on the on-disk table. Many operations (including certain overloads of select) will throw a par error when used on this table.

    Examples:

    q):db/t/ set ([]a:1 2)<br>:db/t/
    q)\l db
    q).Q.s1 t
    "+(,a)!:./t/"

    It is possible to manually create this representation:

    q)enlist[a]!:./t/
    (,a)!:./t/
    q)flip enlist[a]!:./t/
    a
    -
    1
    2

    The equivalent for a partitioned table:

    q):db/2001.01.01/t/ set ([]a:1 2)<br>:db/2001.01.01/t/
    q):db/2001.01.02/t/ set ([]a:3 4)<br>:db/2001.01.02/t/
    q)\l db
    q).Q.s1 t
    "+(,a)!t"
    q)enlist[a]!t
    (,a)!t
    q)flip enlist[a]!t
    date a
    ------------
    2001.01.01 1
    2001.01.01 2
    2001.01.02 3
    2001.01.02 4

    If the specified table does not exist on disk, the expression remains unresolved and any attempt to select from it fails:

    q)flip enlist[a]!:./s/
    +(,a)!:./s/
    q)select from flip enlist[a]!:./s/
    './s/a. OS reports: No such file or directory
    [0] select from flip enlist[a]!:./s/
    q)flip enlist[a]!s
    +(,a)!s
    q)select from flip enlist[a]!s
    's
    [0] select from flip enlist[a]!s
    ^

    We are adjusting our documentation to make this clearer in future.

    If you have any further questions, please let me know!

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 11:17 am in reply to: PyKx transaction cost analysis

    Hi @baichen111

    Thank you for reporting this. We will investigate this further and adjust it accordingly.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 11:16 am in reply to: question help

    Hi @miaaaal

    Apologies for the late response.

    You have defined your .z.pw function correctly, but you now must apply this to .perm.users to give them access.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 11:08 am in reply to: .z.pd function throwing error for non unique handles

    Hi @user931206

    Is it possible you could send a screenshot of the code rather than pasting it in the editor?

    Apologies as this is a problem on our end, not yours.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 11, 2024 at 10:56 am in reply to: Can someone clarify implicit composition here ?

    Hi @newstudent2017

    In the documentation it states the derived function ‘[f;ff] has the rank of ff and returns f ff[x;y;z]

    If we use the following examples:

    q)ff:{[w;x;y;z]w+x+y+z}

    q)ff[1;2;3;4]

    10

    If the syntax returns f ff[x;y;z] then essentially the result for ff[w;x;y;z] is our x parameter for f.

    We know that ff[1;2;3;4] = 10

    q)f:{2*x}

    q)f[10]

    20

    We use composition to combine these steps together:

    q)'[f;ff][1;2;3;4]

    20

    If you have any questions about this, please let me know!

    Thanks,

    Megan

  • megan_mcp

    Administrator
    July 5, 2024 at 11:55 am in reply to: Advanced Capstone 2.2

    Hi @jeanluck

    You currently have your select statement commentated out, are you removing this when submitting your answer?

    Thanks,

    Megan

  • megan_mcp

    Administrator
    July 3, 2024 at 2:19 pm in reply to: partitioned exercise question

    Hi @lestat-jin

    If we take a look at the format for the functional form of each (screenshot below) you can see the quote is used outside the square brackets.

    So if I were to edit your answer it would look like:

    allPaths:{[dir] sv'[`;dir, 'k where(k:key dir) like "[0-9]*"]}

    I have removed the quote infront of dir and included it between sv and the square brackets as indicated in the documentation as this represents using each in functional form.

    Let me know if this answers your question !

    Thanks,

    Megan

  • megan_mcp

    Administrator
    July 1, 2024 at 9:17 am in reply to: partitioned exercise question

    Hi @lestat-jin

    ` sv’… is the dyadic form of each, x f’y: https://code.kx.com/q/ref/maps/#each
    When ‘ is prefix — not in an adverb position — that’s signal/throw: https://code.kx.com/q/ref/signal/

    If you have any questions about this, feel free to reach out!

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 10, 2024 at 1:47 pm in reply to: Advanced Capstone 2.4

    Hi @moshe-hamaoui

    I have sourced the issue and apologies that it is so minor.

    When I tested your code, I was receiving the error you had mentioned above however when I replaced the message with one that is provided in the project file, the test case passed.

    I believe it was the format of the hyphen that caused this issue.

    As you can see in screenshot_1 (provided below) the hyphen used in your code is slightly thinner than the hyphen used in the message provided (screenshot_2).

    The test case must have picked up as a different character, hence why the test case failed.

    If you have any further questions please let me know.

    Thanks,

    Megan

  • megan_mcp

    Administrator
    June 7, 2024 at 12:10 pm in reply to: Fast file reading

    @roryk

    I can follow up on this further if you would like to know why read0 doesn’t use memchr (&/ mmap)?

  • megan_mcp

    Administrator
    June 7, 2024 at 12:00 pm in reply to: Fast file reading

    Hi @roryk

    I reached out to one of our developers on this and this was their response:

    “Actually looks like read0 is using a load of memcmp calls & scanning for \n
    where 0: is using memchr to find it in a single call:

    q)\ts:1 (1#"*";"-")0:`:testf 
    221 36800   
    seconds  usecs/call     calls      function 
    -------- ----------- --------- -------------------- 
    0.095358          95      1003 memchr 
    0.060194         106       564 memmove  
    240799   0.000319 memchr("qwertyuiopasdfghjklzxcvbnm\nqwert"..., '\n', 13311)                              
    = 0x7fa1eaf3d0d7 
    240799   0.005258 memchr("qwertyuiopasdfghjklzxcvbnm\nqwert"..., '-', 26)                                  
    = 0 
    240799   0.005147 memmove(0x7fa1e6b121d0, "qwertyuiopasdfghjklzxcvbnm", 26)                                
    = 0x7fa1e6b121d0
    
    q) \ts:1 read0 `:testf
    2161 52624
    seconds usecs/call calls function
    -------- ----------- --------- --------------------
    1.332051 98 13505 memcmp
    
    0.102397 97 1046 memmove
    
    240799 0.000144 memcmp(0x4bf876, 0x7fa1e6b7f410, 1, 113) = 0xffffff93
    
    240799 0.000152 memcmp(0x4bf876, 0x7fa1e6b7f411, 1, 119) = 0xffffffa5
    
    240799 0.000172 memcmp(0x4bf876, 0x7fa1e6b7f412, 1, 101) = 0xffffff98
    
    240799 0.000160 memcmp(0x4bf876, 0x7fa1e6b7f413, 1, 114) = 0xffffff96
    
    240799 0.000144 memcmp(0x4bf876, 0x7fa1e6b7f414, 1, 116) = 0xffffff91
    
    240799 0.000144 memcmp(0x4bf876, 0x7fa1e6b7f415, 1, 121) = 0xffffff95
    
    240799 0.000144 memcmp(0x4bf876, 0x7fa1e6b7f416, 1, 117) = 0xffffffa1
    
    240799 0.000154 memcmp(0x4bf876, 0x7fa1e6b7f417, 1, 105) = 0xffffff9b
    
    240799 0.000162 memcmp(0x4bf876, 0x7fa1e6b7f418, 1, 111) = 0xffffff9a
    
    240799 0.000236 memcmp(0x4bf876, 0x7fa1e6b7f419, 1, 112) = 0xffffffa9
    
    240799 0.000150 memcmp(0x4bf876, 0x7fa1e6b7f41a, 1, 97) = 0xffffff97
    
    240799 0.000149 memcmp(0x4bf876, 0x7fa1e6b7f41b, 1, 115) = 0xffffffa6
    
    240799 0.000149 memcmp(0x4bf876, 0x7fa1e6b7f41c, 1, 100) = 0xffffffa4
    
    240799 0.000222 memcmp(0x4bf876, 0x7fa1e6b7f41d, 1, 102) = 0xffffffa3
    
    240799 0.000175 memcmp(0x4bf876, 0x7fa1e6b7f41e, 1, 103) = 0xffffffa2
    
    240799 0.000313 memcmp(0x4bf876, 0x7fa1e6b7f41f, 1, 104) = 0xffffffa0
    
    240799 0.000311 memcmp(0x4bf876, 0x7fa1e6b7f420, 1, 106) = 0xffffff9f
    
    240799 0.000312 memcmp(0x4bf876, 0x7fa1e6b7f421, 1, 107) = 0xffffff9e
    
    240799 0.000239 memcmp(0x4bf876, 0x7fa1e6b7f422, 1, 108) = 0xffffff90
    
    240799 0.000149 memcmp(0x4bf876, 0x7fa1e6b7f423, 1, 122) = 0xffffff92
    
    240799 0.000148 memcmp(0x4bf876, 0x7fa1e6b7f424, 1, 120) = 0xffffffa7
    
    240799 0.000218 memcmp(0x4bf876, 0x7fa1e6b7f425, 1, 99) = 0xffffff94
    
    240799 0.000156 memcmp(0x4bf876, 0x7fa1e6b7f426, 1, 118) = 0xffffffa8
    
    240799 0.000148 memcmp(0x4bf876, 0x7fa1e6b7f427, 1, 98) = 0xffffff9c
    
    240799 0.000208 memcmp(0x4bf876, 0x7fa1e6b7f428, 1, 110) = 0xffffff9d
    
    240799 0.000326 memcmp(0x4bf876, 0x7fa1e6b7f429, 1, 109) = 0
    
    240799 0.000270 memmove(0x7fa1e6b121d0, "qwertyuiopasdfghjklzxcvbnm", 26) = 0x7fa1e6b121d0
    
    240799 0.000174 memmove(0x7fa1e6b75f78, "\300!\261\346\241\177\0\0", 8) = 0x7fa1e6b75f78
Page 6 of 14