Jon Willeke · Jul 17, 2018 go to post

Yes. Use the SYS.Database class to create a .DAT file, Config.Databases to create a database definition (what we used to call a dataset), and Config.Namespaces to create a namespace. These are all in %SYS, so you'll need the appropriate privileges.

Jon Willeke · Jul 16, 2018 go to post

You should create properties for keys that you want to query. Take a look at this section in the online documentation:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GDOCDB_cos#GDOCDB_cos_createprop

Also, there is a brief description in the reference for the %DocDB.Database class:

http://localhost:52773/csp/documatic/%25CSP.Documatic.cls

For example:

USER>s db=$system.DocDB.CreateDatabase("Fitabase1")

USER>w db.%CreateProperty("TotalSteps","%Integer","$.TotalSteps")
2@%DocDB.Database

Now the ISC.DM.Fitabase1 class (or whatever your generated class is) has a TotalSteps property. If you already have data, you need to populate the associated index. A quick and dirty way to do this is an SQL query like the following:

update ISC_DM.Fitabase1 set %Doc = %Doc

I'm not that familiar with DeepSee / Analytics, but the output of %CreateDatabase() and %CreateProperty() is a standard persistent class.

Jon Willeke · Jun 6, 2018 go to post

Yes, if you're getting errors about print in Python 3, I second Iain's suggestion to look for the setup3.py script. I just did this successfully using an Anaconda 4.4 install of Python 3.6.1.

Jon Willeke · Jun 5, 2018 go to post

I encourage you to get in touch with the WRC, but if you post more information, we might be able to make some progress. For starters, what version of Caché and Python, and what kind of errors are you seeing?

I successfully built the binding using the following:

  • macOS 10.12.6 (Sierra)
  • Python 2.7.10 (built-in version)
  • command line tools for Xcode 8.3.3
  • Cache 2017.2.1 build 801U

It looks like I got a total of eleven compiler warnings.

As described here, it's a bit tricky to actually use the binding with the system version of Python due to Apple's System Integrity Protection (SIP):

https://community.intersystems.com/post/installing-intersystems-python-binding-mac-el-capitan-1011-or-later

This may be fixable with some install_name_tool surgery, but a separate installation is recommended.

Jon Willeke · Mar 13, 2018 go to post

You can use the $ziswide intrinsic function to check whether a global is portable to an eight-bit instance.

Jon Willeke · Mar 13, 2018 go to post

The statement in your post is not well formed. The value for the description field starts with a single quote, contains a couple of double quotes, but is not terminated with a single quote.

Jon Willeke · Feb 21, 2018 go to post

$double and dynamic objects also poke holes in the idea that everything is a string:

USER>w [1,"2"].%ToJSON()
[1,"2"]
USER>s d=1,b=$double(d) w d," ",d/3,!,b," ",b/3
1 .3333333333333333333
1 .33333333333333331482
Jon Willeke · Feb 1, 2018 go to post

Argumentless DO is still the simplest way to introduce a scope to NEW a variable, including $namespace or $roles. Yes, you can extract that out to another procedure or method, but I often prefer to do it inline.

Jon Willeke · Jan 11, 2018 go to post

That's precisely the intended meaning of orthogonal in this context. All four combinations of public/private and class/instance are distinctly meaningful and useful in their own right. The concepts are separate, independent.

Jon Willeke · Jan 11, 2018 go to post

The two concepts are orthogonal. A class method doesn't need an instance; a private method is only visible from within the class. As a contrived example, consider a public hello() class method that calls a private greet() class method.

Is it safe to change a class method from private to public? In the immediate term, sure, but now it's a public part of the class's interface with all the maintenance responsibilities that entails. I don't see how that's obviously any different than an instance method.

Jon Willeke · Dec 20, 2017 go to post

The main change for 10.11 (El Capitan) and 10.12 (Sierra) is that /usr/lib is not writable, due to System Integrity Protection (SIP). You'll have to put the ODBC modules into /usr/local, and tell php.ini where you put them; e.g.,

extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/odbc.so
extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/pdo_odbc.so
Jon Willeke · Sep 11, 2017 go to post

If you're connecting to the local system, you don't need to use Telnet. Use the cn_ap option described in the link that Peter posted.

Jon Willeke · Aug 23, 2017 go to post

Tim's comment demonstrates that $get leaks an OREF when $this is used as a subscript of an array that doesn't exist. That's a bug.

An OREF as a number is unique within a process, so +$this is more compact, and potentially faster than ""_$this. You should never see, e.g., 1@foo and 1@bar at the same time.

Jon Willeke · Aug 14, 2017 go to post

I notice two things:

  1. The C# ciphertext is 64 bytes, which is twice as long as I'd expect for a 31-byte input.
  2. In the first sixteen bytes of the C# ciphertext, alternating bytes are NUL.

I thought maybe C# is using UTF-16, but I I haven't managed to replicate its output using $zconvert with "UnicodeLittle" or "UnicodeBig".

Edit: the first sixteen bytes of the output appear to be the first eight bytes of the initialization vector converted to Base-64, then UTF-16.

Jon Willeke · Aug 14, 2017 go to post

"Escaped hex sequence too large" means that a hexadecimal escape sequence couldn't be decoded. I suspect that you've encountered a Unicode character that can't be handled on your eight-bit instance.

Jon Willeke · Aug 9, 2017 go to post

For the most part, dynamic objects use local memory that is accounted for by $zstorage and $storage. However, some of it comes from other heap-allocated memory, similar to long strings. You can round trip a large JSON object through a dynamic object with %FromJSON()/%ToJSON(), even if an individual field exceeds the string limit. However, it is not currently possible to get the value of such a field within Caché.

Note that you should call %ToJSON() such that it outputs to a device or writes to a stream:

USER>d o.%ToJSON(stream)

USER>d o.%ToJSON()

Otherwise, you may get a STRINGSTACK error:

USER>w o.%ToJSON()

W o.%ToJSON()
^
<STRINGSTACK>
Jon Willeke · Jul 17, 2017 go to post

Are you sure that this problem is due to endian? A byte stream does not in itself have a byte order; multi-byte data structures do, such as Unicode characters encoded as UTF-16. As for the signature itself, I would expect its encoding to be specified in a portable manner.

Is it possible that line endings are getting changed?

Jon Willeke · Jun 28, 2017 go to post

My research shows that "!" was added in 1992, inspired by MSM. "$" was added in 1993 as a VMS-friendly synonym.

Jon Willeke · Jun 8, 2017 go to post

This method probably first shipped with Caché 4.0 in December 2000, but the oldest instance I have handy is Caché 4.0.4:

USER>w $system.Version.GetMajor()
4
Jon Willeke · Mar 9, 2017 go to post

I don't really understand the question. It sounds like you're trying to convert from one eight-bit character set to another, but French generally uses the same character set as English, as far as I know. If you're using a Unicode instance of Caché, your first resort should be I/O translation: translate the input to Unicode, then translate on output to the desired character set. Doing it in COS is slower and less convenient.

That said, here are some things in your code that don't really make sense:

  1. a."i"; should probably be a.%Get(i).
  2. a-128; maybe a.%Get(c-128)?
  3. I don't understand the purpose of the first loop or the return statements.
  4. value(j); ...?

If I were to hazard a guess at rewriting this, my first try might be something like this:

for i=1:1:$l(str) {
    s c=$e(str,i)
    if $a(c)<128) {
        w c
    } else {
        w $c(a.%Get($a(c)-128))
    }
}
Jon Willeke · Feb 13, 2017 go to post

The instance is assigned a GUID that you can retrieve using the InstanceGUID() method of the %SYS.System class:

USER>w ##class(%SYS.System).InstanceGUID()
C74E6F76-F21F-11E6-9BB8-A860B607521C

Databases are not assigned such an identifier.

Jon Willeke · Jan 31, 2017 go to post

WRC should take good care of you then. It occurs to me that when a call-out function returns an error, you should see a FUNCTION error. An ILLEGAL VALUE error suggests that $zf could not find the "GETFILE" entry. Is there any chance that you're using a kernel with a modified czf.c?

Jon Willeke · Jan 31, 2017 go to post

I can't reproduce this in a 2016.2 instance I have handy:

USER>s filename="DKA0:[QD.CACHEJCWG2.MGR.USER]CACHE.DAT"

USER>w $zf("GETFILE",filename,"UIC")                    
[1,1]

Can you get the output of $zu(56,2) after the error? Anything unusual about your filename?

Jon Willeke · Jan 17, 2017 go to post

The CHUI routine editor is part of the FDBMS, which hasn't been a standard part of the product for a very long time. You could try the line editor with xecute ^%, but it's kind of painful, and I think it only supports .INT routines.

I suggest using the editor of your choice with XML export files.

Jon Willeke · Jan 9, 2017 go to post

Careful, you should pad each byte with a leading zero if necessary. Otherwise your output is missing five nibbles.