go to post Eduard Lebedyuk · Aug 20, 2022 What are recommend habits inside and outside, during you own time and during your work time, to be focused during you coding session and daily tasks? My habit/advice/etc. and something that really helped me is a sincere acceptance of the fact long uninterrupted stretches of time do not exist. Stop trying to carve out an entire week for a new product feature or a day to prepare a perfect demo. The best you can get is half an hour between meetings. After I accepted that, planning and accomplishing work (and anything else really) became much more manageable. And much less frustrating as I don't expect to complete any task uninterrupted by something else. To do that, first, I split any task into 15-minute-to-half-hour chunks. For example, if I'm writing code, first I just create stubs for all the parts (usually methods and classes), beginning to end, even if I don't know how they should be implemented. Each method is one or several chunks. After that, I start on a chunk: implementing one method I know for sure. If I have no idea how anything works at all, I'll implement invocation arguments/objects and so on. If still no idea: split one chunk into several and try again. It works out for almost everything. Writing articles, I first write a title and a list of sections. Usually, I have ten or more of these stubs lying around, and then inspiration strikes me - why not fill one section? Or several if there's time. Another trick is leaving the day's last item unfinished. When I'm close to eob and actually see how to complete something, I often leave it as a task to start the next day. This way, I know where to start and what to do in the morning. And I can score a win pretty much immediately.
go to post Eduard Lebedyuk · Aug 19, 2022 Say you have this query: SELECT a, b, c FROM mytable WHERE d=1 AND e=2 If you want to change fields in SELECT or WHERE, you'll need to rewrite your query by adding or removing it's parts. Source control diff would also show a whole line change. But if you write it like this: SELECT 1 , a , b , c FROM mytable WHERE 1=1 AND d=1 AND e=2 You can comment out any field or condition simply by adding --: SELECT 1 --, a , b , c FROM mytable WHERE 1=1 --AND d=1 AND e=2 when you have a lot of conditions and need to iterate fast, this way of writing queries is much better for debugging and source control since diff is always contianed to the one line you edit.
go to post Eduard Lebedyuk · Aug 18, 2022 Improves readability as all conditions start on the same indent level. It's also useful when you have a query with several conditions and you need to debug by changing which conditions you apply. This way you can easily add/remove conditions by commenting lines in/out.
go to post Eduard Lebedyuk · Aug 18, 2022 Ens, EnsLib and EnsPortal are system packages, developes can subclass them. To get class count call something like this: SELECT count(ID) FROM %Dictionary.ClassDefinition WHERE 1=1 AND System = 0 AND NOT (Name %STARTSWITH '%' OR Name %STARTSWITH 'Ens.' OR Name %STARTSWITH 'EnsLib.' OR Name %STARTSWITH 'EnsPortal.' OR Name %STARTSWITH 'HS.' OR Name %STARTSWITH 'SchemaMap') Missing: SQL way to filter out mapped classes.
go to post Eduard Lebedyuk · Aug 16, 2022 Yes. Alternatively you can sync call some BO to make an API call, wait for a response and send that to DTL. It might make sense if you already have a BO/some-other-preexisting-API-caller so you don't have to reimplement the API call code in BS.
go to post Eduard Lebedyuk · Aug 15, 2022 Use a Business Service with a basic Ens.InboundAdapter: Class test.BS Extends Ens.BusinessService { Parameter ADAPTER = "Ens.InboundAdapter"; Method OnProcessInput(pInput As %RegisteredObject, Output pOutput As %RegisteredObject) As %Status { $$$LOGINFO("In OnProcessInput") Quit $$$OK } } Add it to production and set Call Interval to X seconds (and Pool Size to 1). That would ensure OnProcessInput being called every X seconds after it's last completion.
go to post Eduard Lebedyuk · Aug 13, 2022 Can skip $Job, leaving just: Do $System.Process.Terminate(,<desired error code>) it would terminate the current job. Question: are you using the error code? I'm always exiting with error code 1 in case of any errors, but is there an advantage in using some custom error codes here?
go to post Eduard Lebedyuk · Aug 12, 2022 Say you have this string: 1111111111:authoredOn=ge2022-01-10:authoredOn=le2022-01-13 How do you want to slice it: authoredOn=ge2022-01-10 authoredOn=le2022-01-13 what's 1111111111 doing there? Something like this should work: set str = "1111111111:authoredOn=ge2022-01-10:authoredOn=le2022-01-13" set str = $lfs(str, ":") for i=1:1:$ll(str) { set param = $lg(str,i) if $l(param,"=")=2 { set key = $p(param,"=",1) set value = $p(param,"=",2) set params(key, $i(params(key)))=value } } zw params
go to post Eduard Lebedyuk · Aug 11, 2022 Thanks, Ben! %XML.Exchange.Adaptor sounds great. And you're right, I'm mainly talking about the easiest scenario where there is no id/data drift. There are certainly trickier situations, where unique identifiers are required.
go to post Eduard Lebedyuk · Aug 11, 2022 Component status Use Ens.Director to get enabled/disabled and status: set enabled = ##class(Ens.Director).IsItemEnabled(bh, .status) Queue depth SELECT Name, Count, Created, Active FROM EnsPortal.Queues_EnumerateQueues() Last activity date Do you see it in SMP somewhere?
go to post Eduard Lebedyuk · Aug 10, 2022 This is a limitation on a maximum resource length that was lifted in 2022.2 preview 4.
go to post Eduard Lebedyuk · Aug 10, 2022 I would start by observing the output of these two commands when run from a Dockerfile: set sc = ##class(Ens.Director).SetAutoStart("GOJ.IrisApp.ProductionDev") write $system.Status.GetErrorText(sc) set sc = ##class(Ens.Director).StartProduction("GOJ.IrisApp.ProductionDev") write $system.Status.GetErrorText(sc)
go to post Eduard Lebedyuk · Aug 9, 2022 HS.SDA3.Container is a registered object and not a persistent one, so you can't pass it directly. What you can do, however, is to pass existing stream id in your request, this way stream is not copied twice (you only pass an id) and receiver then can recreate the same HS.SDA3.Container from a stream.