no success with vs 2015 and vs 2017. same error as before. have installed the new dll, unregistered and re-registered with syswow64\regsvr32.
Sent from my iPhone > On 15 Apr 2017, at 07:17, Herbert Weissenbaeck // Privat > <[email protected]> wrote: > > Is there a chance to have the j805 j.dll re-built in a way that makes it > usable? > I need a functioning j.dll for serious work/calculations and would prefer not > to use a beta version but the latest stable release. Or is j806 beta > considered safe and stable enough? > > Sent from my iPhone > >> On 15 Apr 2017, at 01:52, bill lam <[email protected]> wrote: >> >> There should be some mistake when building the j805 j.dll. >> However j806 beta seems working again. >> >> >> Пт, 14 апр 2017, Herbert Weissenbaeck // Privat написал(а): >>> I tried to refer to the j.dll directly. >>> VS tells me "A reference to (path...)\j.dll could not be added" >>> >>> i wonder, why j804 behaves differently. >>> >>> Sent from my iPhone >>> >>>> On 14 Apr 2017, at 08:35, bill lam <[email protected]> wrote: >>>> >>>> not sure why it can not add reference in vs. actually you don't have to >>>> add jdllserver to reference if you don't need intelligent sense. >>>> >>>> On 14 Apr, 2017 7:57 pm, "Herbert Weissenbaeck // Privat" < >>>> [email protected]> wrote: >>>> >>>>> bill, >>>>> thank you for your support. >>>>> using syswow64/regsvr32 does not give any error message, confirms that the >>>>> dll is registered, but does not resolve my problem. the error message i >>>>> receive when trying to add the reference to J DLL Server in VS remains >>>>> unchanged. >>>>> best >>>>> herbert >>>>> >>>>> Sent from my iPhone >>>>> >>>>>> On 14 Apr 2017, at 00:36, bill lam <[email protected]> wrote: >>>>>> >>>>>> sorry, it should be syswow64 >>>>>> >>>>>> Пт, 14 апр 2017, bill lam написал(а): >>>>>>> From your previous msg, it said >>>>>>> 'C:\Program Files\j805\bin\j.dll' >>>>>>> >>>>>>> please check this is a J32 installation and have registered it >>>>>>> using wow64/regsvr32. >>>>>>> >>>>>>> Чт, 13 апр 2017, Herbert Weissenbaeck // Privat написал(а): >>>>>>>> I am actually compiling for 32bits (x86) only. (That's sufficient for >>>>> this stage of my development.) >>>>>>>> >>>>>>>> Sent from my iPhone >>>>>>>> >>>>>>>>> On 13 Apr 2017, at 22:22, bill lam <[email protected]> wrote: >>>>>>>>> >>>>>>>>> 32-bit inproc server must be used with an 32-application. >>>>>>>>> 32-bit out-of-process server can be used with either 32 or >>>>>>>>> 64 application. Please confirm what are the intended 32/64 bit >>>>>>>>> version of jdllserver and application (not visual studio). >>>>>>>>> >>>>>>>>> jdllserver is in-proc server so that 32/64 bit must match, with >>>>>>>>> application. use regsvr32 inside wow64 folder to register the >>>>>>>>> 32-bit j.dll >>>>>>>>> >>>>>>>>> Чт, 13 апр 2017, Herbert Weissenbaeck // Privat написал(а): >>>>>>>>>> Robert, >>>>>>>>>> >>>>>>>>>> coincidentally I had the last Windows update just one hour ago; but >>>>> the problem was there before and after. >>>>>>>>>> >>>>>>>>>> I am presently traveling and have no access to any other computer >>>>> than my notebook; thus I can not try to replicate my problem on another >>>>> machine. >>>>>>>>>> >>>>>>>>>> (I am using VS 2017 Enterprise on an English Windows 10 an a >>>>> ThinkPad P50 Xeon machine to develop an app that connects to J DLL Server. >>>>> Had 804 so far but would like to switch to 805.) >>>>>>>>>> >>>>>>>>>> Is anybody successfully using the 32 bit 805 DLL Server from VS in a >>>>> .net application? >>>>>>>>>> >>>>>>>>>> Best >>>>>>>>>> Herbert >>>>>>>>>> >>>>>>>>>>> On 13 Apr 2017, at 21:09, robert therriault <[email protected]> >>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> Herbert, >>>>>>>>>>> >>>>>>>>>>> This may not be related at all, but is this recent? I read that >>>>> Windows 10 had the Creative update pushed on it in the last couple of days >>>>> and if it was like the last time it may break some things. Not sure why it >>>>> would affect 805 and not 804. ;-) >>>>>>>>>>> >>>>>>>>>>> http://www.infoworld.com/article/3189776/microsoft- >>>>> windows/microsofts-critical-windows-and-office-patches- >>>>> present-a-panoply-of-problems.html >>>>>>>>>>> >>>>>>>>>>> Cheers, bob >>>>>>>>>>> >>>>>>>>>>>> On Apr 13, 2017, at 5:57 PM, Herbert Weissenbaeck // Privat < >>>>> [email protected]> wrote: >>>>>>>>>>>> >>>>>>>>>>>> Thank you. Tried to run vs as admin. >>>>>>>>>>>> same result >>>>>>>>>>>> >>>>>>>>>>>> uninstalled and re-installed j805 into users directory. >>>>>>>>>>>> same (negative) result. >>>>>>>>>>>> >>>>>>>>>>>> I can however use J EXE Server via COM also in the 805 version >>>>> (but want J DLL Server, which still gives me an error). >>>>>>>>>>>> >>>>>>>>>>>> Any more ideas? >>>>>>>>>>>> >>>>>>>>>>>> Sent from my iPhone >>>>>>>>>>>> >>>>>>>>>>>>> On 13 Apr 2017, at 20:18, bill lam <[email protected]> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>> I am not sure. IIRC It works for me. Perhaps it is a security >>>>> issue. try >>>>>>>>>>>>> run visual studio as admin. >>>>>>>>>>>>> >>>>>>>>>>>>> program files is protected, not sure if this is related to your >>>>> problem. >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> On 14 Apr, 2017 7:48 am, "Herbert Weissenbaeck // Privat" < >>>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>> its regsvr32 without the "/r", i suppose. >>>>>>>>>>>>> >>>>>>>>>>>>> in an admin console the registration seems to work. the J DLL >>>>> Server >>>>>>>>>>>>> (version 3) type library shows up in visual studio with file >>>>> version 805. >>>>>>>>>>>>> (the j804 one showed file version 701.) >>>>>>>>>>>>> >>>>>>>>>>>>> however selecting it gives an error: "A reference to 'J DLL >>>>> Server (version >>>>>>>>>>>>> 3) Type Library' could not be added. Could not register the >>>>> ActiveX type >>>>>>>>>>>>> library 'C:\Program Files\j805\bin\j.dll'. >>>>>>>>>>>>> >>>>>>>>>>>>> the same thing works without any problem with j804. why? >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> Sent from my iPhone >>>>>>>>>>>>> >>>>>>>>>>>>>> On 13 Apr 2017, at 19:22, bill lam <[email protected]> wrote: >>>>>>>>>>>>>> >>>>>>>>>>>>>> typo, regsvr32 >>>>>>>>>>>>>> >>>>>>>>>>>>>>> On 14 Apr, 2017 7:21 am, "bill lam" <[email protected]> >>>>> wrote: >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> jdllserver should work for all versions. try open an admin >>>>> command prompt >>>>>>>>>>>>>>> at bin folder and type >>>>>>>>>>>>>>> regvsr32 /r j.dll >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> On 14 Apr, 2017 6:17 am, "Herbert Weissenbaeck // Privat" < >>>>>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> On my Windows 10 machine J805 fails to register as a COM Server. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> When I use jreg.cmd under 804 I get a "J DLL Server (version 3) >>>>> Type >>>>>>>>>>>>>>> Library" in the kist of available Type Libraries in MS Visual >>>>> Studio. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> When I do the same with J805, no type library is registered. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Is this a bug or a feature? I would prefer working with 805 >>>>> over 804. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Any hints/fixes? >>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> On 13 Apr 2017, at 16:23, 'Bo Jacoby' via Programming < >>>>>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Hi Louis. >>>>>>>>>>>>>>>> Thanks for asking. I regret not knowing the answer. >>>>>>>>>>>>>>>> An ordinal fraction is like an array in J, with minor >>>>> differences. >>>>>>>>>>>>>>>> - Arrays have names. Ordinal fractions have numbers. >>>>>>>>>>>>>>>> - An array has a finite number of dimensions. An ordinal >>>>> fraction has >>>>>>>>>>>>>>> an infinite number of dimensions. >>>>>>>>>>>>>>>> - Arrays may have different shapes. All ordinal fractions have >>>>> the >>>>>>>>>>>>>>> same shape: 9 9 9 9 . . . >>>>>>>>>>>>>>>> - Arrays have zero-origin indexing (0 1 . . . n). Ordinal >>>>> fractions >>>>>>>>>>>>>>> have one-origin indexing (1 2 3 4 5 6 7 8 9). >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> - Arrays have elements. Ordinal fractions do not have elements. >>>>>>>>>>>>>>>> - Arrays may have subarrays. All ordinal fractions have >>>>> subordinate >>>>>>>>>>>>>>> ordinal fractions. >>>>>>>>>>>>>>>> - Array elements contain data. Any ordinal fraction may >>>>> contain a data >>>>>>>>>>>>>>> element. >>>>>>>>>>>>>>>> Ordinal fractions were invented (by me) in 1980, but have had >>>>> limited >>>>>>>>>>>>>>> dissemination so far. I made programs in fortran and pascal and >>>>> basic for >>>>>>>>>>>>>>> manipulating ordinal fraction files, but I have not managed to >>>>> do it in >>>>>>>>>>>>> J. >>>>>>>>>>>>>>> The programs were general, because the logic is in the data >>>>> file and not >>>>>>>>>>>>> in >>>>>>>>>>>>>>> the program. I have been alone doing this. >>>>>>>>>>>>>>>> Thanks! Bo. >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Den 20:08 torsdag den 13. april 2017 skrev Louis de Forcrand < >>>>>>>>>>>>>>> [email protected]>: >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Hi Bo, >>>>>>>>>>>>>>>> This is cool. >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> As for the way you suggest using it here, isn't it equivalent >>>>> to >>>>>>>>>>>>>>> (without the first six rows of your data): >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> (~.@[ ,. +//.)/@|: >>>>>>>>>>>>>>>> ? >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Louis >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> On 12 Apr 2017, at 21:57, 'Bo Jacoby' via Programming < >>>>>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> Hi Joe! >>>>>>>>>>>>>>>>> My favorite datastructure is ORDINAL FRACTIONS - the algebra >>>>> of data >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>> | | | >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>> | | >>>>>>>>>>>>>>>>> ORDINAL FRACTIONS - the algebra of data >>>>>>>>>>>>>>>>> This paper was submitted to the 10th World Computer Congress, >>>>> IFIP 1986 >>>>>>>>>>>>>>> conference, but rejected by the referee.... | | >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> | >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> Your data are coded like this >>>>>>>>>>>>>>>>> 10 Joe >>>>>>>>>>>>>>>>> 20 Bob >>>>>>>>>>>>>>>>> 30 Jane >>>>>>>>>>>>>>>>> 01 blue >>>>>>>>>>>>>>>>> 02 red >>>>>>>>>>>>>>>>> 03 purple >>>>>>>>>>>>>>>>> 11 1 >>>>>>>>>>>>>>>>> 11 -1 >>>>>>>>>>>>>>>>> 11 1 >>>>>>>>>>>>>>>>> 22 1 >>>>>>>>>>>>>>>>> 22 1 >>>>>>>>>>>>>>>>> 22 3 >>>>>>>>>>>>>>>>> 22 -1 >>>>>>>>>>>>>>>>> 22 -1 >>>>>>>>>>>>>>>>> 33 5 >>>>>>>>>>>>>>>>> 33 -2 >>>>>>>>>>>>>>>>> 33 2 >>>>>>>>>>>>>>>>> (Written with double CRs because the mail program has a >>>>> history of >>>>>>>>>>>>>>> deleting my CRs). >>>>>>>>>>>>>>>>> Summation gives the result >>>>>>>>>>>>>>>>> 10 Joe >>>>>>>>>>>>>>>>> 20 Bob >>>>>>>>>>>>>>>>> 30 Jane >>>>>>>>>>>>>>>>> 01 blue >>>>>>>>>>>>>>>>> 02 red >>>>>>>>>>>>>>>>> 03 purple >>>>>>>>>>>>>>>>> 11 1 >>>>>>>>>>>>>>>>> 22 3 >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> 33 5 >>>>>>>>>>>>>>>>> I have not done the summation in J, but I'd like to do it. >>>>>>>>>>>>>>>>> Perhaps this helps you. >>>>>>>>>>>>>>>>> Bo. >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> Den 0:04 torsdag den 13. april 2017 skrev chris burke < >>>>>>>>>>>>>>> [email protected]>: >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> Incidentally, for production code, I suggest starting by >>>>> removing any >>>>>>>>>>>>>>> sales >>>>>>>>>>>>>>>>> not matched in returns and vice versa, so that the matching >>>>> algorithm >>>>>>>>>>>>> is >>>>>>>>>>>>>>>>> applied only to potential matches. >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> On Wed, Apr 12, 2017 at 2:53 PM, chris burke < >>>>> [email protected]> >>>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Great. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> In case you need more complicated handling of the "gray area" >>>>>>>>>>>>>>>>>> transactions, I believe they would be relatively few in >>>>> number, so >>>>>>>>>>>>>>> most of >>>>>>>>>>>>>>>>>> the time you could do the matching efficiently, then check >>>>> for any >>>>>>>>>>>>> keys >>>>>>>>>>>>>>>>>> with returns preceding sales. For those, setting aside the >>>>> first such >>>>>>>>>>>>>>>>>> return and repeating should clear them quickly. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> Timing should be well under 1 second for a million records. >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> On Wed, Apr 12, 2017 at 1:57 PM, Joe Bogner < >>>>> [email protected]> >>>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> Just for completeness, I added a line that incorporates the >>>>> sequence >>>>>>>>>>>>>>> check >>>>>>>>>>>>>>>>>>> into the cancel logic. Works great >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> NB. hui progressive index >>>>>>>>>>>>>>>>>>> NB. http://code.jsoftware.com/ >>>>> wiki/Essays/Progressive_Index-Of >>>>>>>>>>>>>>>>>>> oc=: i.~ (] - {) /:@/: >>>>>>>>>>>>>>>>>>> pi=: #@[ ({. i.&(,.oc) }.) [ i. , >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> NB. argument is 3-col table of seq,key,qty >>>>>>>>>>>>>>>>>>> NB. result is the unmatched transactions >>>>>>>>>>>>>>>>>>> matchtrans=: 3 : 0 >>>>>>>>>>>>>>>>>>> msk=. 0<{:"1 y >>>>>>>>>>>>>>>>>>> sales=. msk#y >>>>>>>>>>>>>>>>>>> returns=. (-.msk)#y >>>>>>>>>>>>>>>>>>> ndx=. (}."1 sales) pi | }."1 returns >>>>>>>>>>>>>>>>>>> cancels=. ndx<#sales >>>>>>>>>>>>>>>>>>> NB. ensure cancel is after sale >>>>>>>>>>>>>>>>>>> cancels =. cancels *. (({."1 (<<(cancels)#ndx){sales) < >>>>> ({."1 >>>>>>>>>>>>>>>>>>> (cancels#returns))) >>>>>>>>>>>>>>>>>>> ((<<<cancels#ndx){sales),(-.cancels)#returns >>>>>>>>>>>>>>>>>>> ) >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> On Wed, Apr 12, 2017 at 4:14 PM, Joe Bogner < >>>>> [email protected]> >>>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> Chris, this looks promising. Thanks for sharing. It's >>>>> nearly instant >>>>>>>>>>>>>>> on >>>>>>>>>>>>>>>>>>> a >>>>>>>>>>>>>>>>>>>> million rows. >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> Which row had a return before a transaction? seq 10 was an >>>>> example >>>>>>>>>>>>>>> of a >>>>>>>>>>>>>>>>>>>> partial return. The hypothetical customer returned 2 out >>>>> of the 5 >>>>>>>>>>>>>>>>>>> purchased >>>>>>>>>>>>>>>>>>>> prior. I added that example since technically per the >>>>> original spec >>>>>>>>>>>>>>> it >>>>>>>>>>>>>>>>>>>> wouldn't be cancelled out in this pass. It's a gray area >>>>> so I may >>>>>>>>>>>>> be >>>>>>>>>>>>>>>>>>> able >>>>>>>>>>>>>>>>>>>> to use this approach, especially since I don't see how to >>>>>>>>>>>>> incorporate >>>>>>>>>>>>>>>>>>> the >>>>>>>>>>>>>>>>>>>> time element into the progressive index. >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> Thanks again >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> On Wed, Apr 12, 2017 at 3:52 PM, chris burke < >>>>> [email protected]> >>>>>>>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> This might be done by comparing matrices of sales and >>>>> returns. The >>>>>>>>>>>>>>>>>>>>> function >>>>>>>>>>>>>>>>>>>>> below seems to be close to what you want. It doesn't >>>>> exactly match >>>>>>>>>>>>>>> your >>>>>>>>>>>>>>>>>>>>> example, but your example has cases where returns are >>>>> made before >>>>>>>>>>>>>>> the >>>>>>>>>>>>>>>>>>>>> transactions. Was this intentional? >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> The code should run faster than a looping solution. >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> Code: >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> NB. hui progressive index >>>>>>>>>>>>>>>>>>>>> NB. http://code.jsoftware.com/ >>>>> wiki/Essays/Progressive_Index-Of >>>>>>>>>>>>>>>>>>>>> oc=: i.~ (] - {) /:@/: >>>>>>>>>>>>>>>>>>>>> pi=: #@[ ({. i.&(,.oc) }.) [ i. , >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> NB. argument is 3-col table of seq,key,qty >>>>>>>>>>>>>>>>>>>>> NB. result is the unmatched transactions >>>>>>>>>>>>>>>>>>>>> matchtrans=: 3 : 0 >>>>>>>>>>>>>>>>>>>>> msk=. 0<{:"1 y >>>>>>>>>>>>>>>>>>>>> sales=. msk#y >>>>>>>>>>>>>>>>>>>>> returns=. (-.msk)#y >>>>>>>>>>>>>>>>>>>>> ndx=. (}."1 sales) pi | }."1 returns >>>>>>>>>>>>>>>>>>>>> cancels=. ndx<#sales >>>>>>>>>>>>>>>>>>>>> ((<<<cancels#ndx){sales),(-.cancels)#returns >>>>>>>>>>>>>>>>>>>>> ) >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> Example: >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> dat=: ".;._2 (0 : 0) >>>>>>>>>>>>>>>>>>>>> 1 1 1 >>>>>>>>>>>>>>>>>>>>> 2 1 _1 >>>>>>>>>>>>>>>>>>>>> 3 1 1 >>>>>>>>>>>>>>>>>>>>> 4 2 1 >>>>>>>>>>>>>>>>>>>>> 5 2 1 >>>>>>>>>>>>>>>>>>>>> 6 2 3 >>>>>>>>>>>>>>>>>>>>> 7 2 _1 >>>>>>>>>>>>>>>>>>>>> 8 2 _1 >>>>>>>>>>>>>>>>>>>>> 9 3 5 >>>>>>>>>>>>>>>>>>>>> 10 3 _2 >>>>>>>>>>>>>>>>>>>>> 11 3 2 >>>>>>>>>>>>>>>>>>>>> ) >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> matchtrans dat >>>>>>>>>>>>>>>>>>>>> 3 1 1 >>>>>>>>>>>>>>>>>>>>> 6 2 3 >>>>>>>>>>>>>>>>>>>>> 9 3 5 >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>> On Wed, Apr 12, 2017 at 9:35 AM, Joe Bogner < >>>>> [email protected]> >>>>>>>>>>>>>>>>>>> wrote: >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> I have a problem I'm trying to solve in different >>>>> languages. I >>>>>>>>>>>>>>> have a >>>>>>>>>>>>>>>>>>>>>> solution in SQL and also in kdb which largely resembles >>>>> the SQL >>>>>>>>>>>>>>>>>>>>> solution. >>>>>>>>>>>>>>>>>>>>>> I'm curious what a J solution would look like. More >>>>> specifically, >>>>>>>>>>>>>>> I'm >>>>>>>>>>>>>>>>>>>>>> interested in picking the brains of others here to see >>>>> if this >>>>>>>>>>>>> type >>>>>>>>>>>>>>>>>>> of >>>>>>>>>>>>>>>>>>>>>> problem can be solved without looping (some form of >>>>> scan?). >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> EDIT: Initially I wrote this up thinking the J solution >>>>> would >>>>>>>>>>>>>>>>>>> difficult, >>>>>>>>>>>>>>>>>>>>>> but it was actually fairly straightforward -- about 15 >>>>> minutes, >>>>>>>>>>>>> but >>>>>>>>>>>>>>>>>>>>> still >>>>>>>>>>>>>>>>>>>>>> would like to see if there are alternatives. If nothing >>>>> else, >>>>>>>>>>>>> maybe >>>>>>>>>>>>>>>>>>> an >>>>>>>>>>>>>>>>>>>>>> interesting problem to share. >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Example data: >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> A store has a transaction log with a sequence for each >>>>>>>>>>>>> transaction. >>>>>>>>>>>>>>>>>>> The >>>>>>>>>>>>>>>>>>>>>> transaction log records a key for a unique customer/item >>>>>>>>>>>>>>> combination. >>>>>>>>>>>>>>>>>>>>> The >>>>>>>>>>>>>>>>>>>>>> transaction log records how many units were purchased or >>>>> returned. >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Goal: >>>>>>>>>>>>>>>>>>>>>> Attempt to match up related transactions and cancel out >>>>> instances >>>>>>>>>>>>>>>>>>> when >>>>>>>>>>>>>>>>>>>>> the >>>>>>>>>>>>>>>>>>>>>> customer/item combination is returned at the same >>>>> quantity as a >>>>>>>>>>>>>>>>>>> previous >>>>>>>>>>>>>>>>>>>>>> transaction >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Examples: >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Joe buys 1 blue pen, which is defective, then returns >>>>> the 1 >>>>>>>>>>>>>>> defective >>>>>>>>>>>>>>>>>>>>> blue >>>>>>>>>>>>>>>>>>>>>> pen, then buys another blue pen. EXPECTED: cancel out >>>>> first two >>>>>>>>>>>>>>>>>>>>>> transactions and leave the the last one for 1 pen >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Bob buys 2 red pens in two separate transactions. He >>>>> then buys 3 >>>>>>>>>>>>>>>>>>> more. >>>>>>>>>>>>>>>>>>>>> He >>>>>>>>>>>>>>>>>>>>>> returns the first two purchases as two separate return >>>>>>>>>>>>>>> transactions. >>>>>>>>>>>>>>>>>>>>>> EXPECTED: cancel out all transactions except the one for >>>>> qty 3 >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Jane buys 5 purple pens and subsequently returns two of >>>>> them. She >>>>>>>>>>>>>>>>>>> buys >>>>>>>>>>>>>>>>>>>>> two >>>>>>>>>>>>>>>>>>>>>> more. EXPECTED: No transactions match exactly, so >>>>> nothing is >>>>>>>>>>>>>>>>>>> cancelled >>>>>>>>>>>>>>>>>>>>> out >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Data: >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> data=: 0 : 0 >>>>>>>>>>>>>>>>>>>>>> seq key qty >>>>>>>>>>>>>>>>>>>>>> 1 1 1 >>>>>>>>>>>>>>>>>>>>>> 2 1 _1 >>>>>>>>>>>>>>>>>>>>>> 3 1 1 >>>>>>>>>>>>>>>>>>>>>> 4 2 1 >>>>>>>>>>>>>>>>>>>>>> 5 2 1 >>>>>>>>>>>>>>>>>>>>>> 6 2 3 >>>>>>>>>>>>>>>>>>>>>> 7 2 _1 >>>>>>>>>>>>>>>>>>>>>> 8 2 _1 >>>>>>>>>>>>>>>>>>>>>> 9 3 5 >>>>>>>>>>>>>>>>>>>>>> 10 3 _2 >>>>>>>>>>>>>>>>>>>>>> 11 3 2 >>>>>>>>>>>>>>>>>>>>>> ) >>>>>>>>>>>>>>>>>>>>>> tbl =: ,. ' ' cut every cutLF data >>>>>>>>>>>>>>>>>>>>>> 'seqs keys qtys' =: |: ". every }. tbl >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> Goal: >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> goals =: 0 : 0 >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> goal >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> cancelled >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> credit >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> ok >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> cancelled >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> cancelled >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> ok >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> credit >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> credit >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> ok >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> ok >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> ok >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> ) >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> tbl,.(cutLF goals) >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |seq|key|qty|goal | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |1 |1 |1 |cancelled| >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |2 |1 |_1 |credit | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |3 |1 |1 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |4 |2 |1 |cancelled| >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |5 |2 |1 |cancelled| >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |6 |2 |3 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |7 |2 |_1 |credit | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |8 |2 |_1 |credit | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |9 |3 |5 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |10 |3 |_2 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |11 |3 |2 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> One approach: >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> applycredits =: 3 : 0 >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> goals=.(<'goal') >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> creditids=.0 >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> for_i. (i. # seqs) do. >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> key=.i{keys >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> seq=.i{seqs >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> qty=.i{qtys >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> nextcredit =.| {. qtys #~ ((key=keys)*(seqs>seq)*(qtys< >>>>> 0)) >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> if. nextcredit = qty do. >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> goals=.goals,<'cancelled' >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> creditids =. creditids, seqs #~ >>>>> ((key=keys)*(seqs>seq)*(qtys<0)) >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> elseif. creditids e.~ seq do. >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> goals=.goals,<'credit' >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> elseif. do. >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> goals=.goals,<'ok' >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> end. >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> end. >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> goals >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> ) >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> tbl ,. ( applycredits 0 ) >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |seq|key|qty|goal | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |1 |1 |1 |cancelled| >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |2 |1 |_1 |credit | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |3 |1 |1 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |4 |2 |1 |cancelled| >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |5 |2 |1 |cancelled| >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |6 |2 |3 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |7 |2 |_1 |credit | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |8 |2 |_1 |credit | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |9 |3 |5 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |10 |3 |_2 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> |11 |3 |2 |ok | >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> +---+---+---+---------+ >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> (cutLF goals) -: ( applycredits 0 ) >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> 1 >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> thanks for any input >>>>>>>>>>>>>>>>>>>>>> ------------------------------ >>>>> ------------------------------ >>>>>>>>>>>>>>>>>>> ---------- >>>>>>>>>>>>>>>>>>>>>> For information about J forums see >>>>> http://www.jsoftware.com/forum >>>>>>>>>>>>>>>>>>> s.htm >>>>>>>>>>>>>>>>>>>>> ------------------------------ >>>>> ------------------------------ >>>>>>>>>>>>>>> ---------- >>>>>>>>>>>>>>>>>>>>> For information about J forums see >>>>> http://www.jsoftware.com/forum >>>>>>>>>>>>>>> s.htm >>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> ------------------------------ >>>>> ------------------------------ >>>>>>>>>>>>>>> ---------- >>>>>>>>>>>>>>>>>>> For information about J forums see >>>>> http://www.jsoftware.com/forum >>>>>>>>>>>>>>> s.htm >>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> >>>>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>>>> >>>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>>> >>>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>>> >>>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>>> >>>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>>> >>>>>>>>> -- >>>>>>>>> regards, >>>>>>>>> ==================================================== >>>>>>>>> GPG key 1024D/4434BAB3 2008-08-24 >>>>>>>>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 >>>>>>>>> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 >>>>>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>>>>>> For information about J forums see http://www.jsoftware.com/ >>>>> forums.htm >>>>>>>> >>>>>>>> ---------------------------------------------------------------------- >>>>>>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>>>>> >>>>>>> -- >>>>>>> regards, >>>>>>> ==================================================== >>>>>>> GPG key 1024D/4434BAB3 2008-08-24 >>>>>>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 >>>>>>> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 >>>>>> >>>>>> -- >>>>>> regards, >>>>>> ==================================================== >>>>>> GPG key 1024D/4434BAB3 2008-08-24 >>>>>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 >>>>>> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 >>>>>> ---------------------------------------------------------------------- >>>>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>>> >>>>> ---------------------------------------------------------------------- >>>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>> ---------------------------------------------------------------------- >>>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >> >> -- >> regards, >> ==================================================== >> GPG key 1024D/4434BAB3 2008-08-24 >> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 >> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
