Base64 does not work with unicode with two or more bites. You should convert it first
write $system.Encryption.Base64Encode($zcvt("тест","O","UTF8"))
0YLQtdGB0YI=
- Log in to post comments
Base64 does not work with unicode with two or more bites. You should convert it first
write $system.Encryption.Base64Encode($zcvt("тест","O","UTF8"))
0YLQtdGB0YI=
Some time ago I did an example of Angular Application with IRIS on a backend.
Source for this project available on gitlab.
How to develop Angular application, you should look at angular documentation, and all about frontend development. There are some tools, which helps to develop and build your frontend side. Such as webpack, which do most of work related with build your sources to production ready environment.
In my simple project, you need only docker, and any editor, preferable VSCode.
By command, you will get a running server in development mode. So, you can edit Angular code, and IRIS code, and see an immediate result.
docker-compose up -d
And this project also deployable with Kubernetes. So, after any push of changes to gitlab, it will build, and test it.
node_modules, never goes to source control. It's enough to have package.json and package-lock.json there. node_modules may contain platform specific libraries.
Hope I will manage to write a complete article about this project, with all the details.
Sorry, usually I use it to add custom methods to properties. Did not not, that it doesn't work for such methods as Set/Get. But you can add any other method.
Why do not use PropertyClass, so, you can generate own getter and setter for any property in a class?
There is also ClassMethod GetGlobalSize in the class %Library.GlobalEdit , where you can select a fast way to count or not, and you will get a different result.
ClassMethod GetGlobalSize(Directory As %String, GlobalName As %String, ByRef Allocated As %Integer, ByRef Used As %Integer, fast As %Boolean = 0) as %Status
Get size of this global
'Allocated' - total size, in MB, of blocks allocated for the global.
'Used' - total used data, in MB, for the global.
'fast' - TRUE : faster return, it won't return the value of 'Used'.
FALSE - slower return,, it returns values for both 'Allocated' and 'Used'.
So, when fast, it just counts blocks and don't care how those blocks fill by data and multiply the number of blocks on Size of the block.
Used, counts only when you pass fast=0, and it calculates exact size, and to be more accurate reads all blocks, so it could be slower.
Web applications defined in Security.Applications class in %SYS namespace.
zn "%SYS"
set props("Path") = "/opt/my/app/csp"
set props("Description") = "My Cool Application"
do ##class(Security.Applications).Create("/csp/test", .props)
Visual Studio and Visual Studio Code are two very different products but just with similar names.
To configure Visual Studio Code, you can use this settings
{
"objectscript.conn": {
"active": true,
"host": "localhost",
"port": 57772,
"ns": "SAMPLES",
"username": "admin",
"password": "SYS"
}
}
Where,
active, should be true, if you going to be connectedVery interesting, I did not now that LaTex maybe used in such a way. How it is used Syntax Highlighting, maybe I can help?
How Pygments related? Some time ago I started to do Syntax highlightings to Pygments but did not finished it, yet. But I have textmate grammar, which can be used in many places.
I'm not an InterSystems guy and can say only from my point of view, how it works.
Every global name has internal representation in some kind of binary format, I don't know how it can be converted to and back. But this string used to find a correct block. Like when you looking for ^C(9996,46, yellow), it first should read Map (Block 3), to find where Global ^C started (Block 44), then using this internal format for global, it can find the closest node in the first pointer block if it points to another pointer block, the same search repeats until it reached any Data block, which may also contain data for multiple nodes.
Not sure If I can better explain it, but most important is that B* tree helps to very quickly find the final block, and their neighbours.
There is a workaround with a storage driver. Here is an example of ccontrol-wrapper which can help with it. And example of Dockerfile how it can be used.
I would argue about using VM instead of Docker. My choice is Docker for sure, for many reasons. It is not so difficult to make it worked in Docker, and you will get a lot from it. And if it is possible for you to move to IRIS, it would be a good way to go.
I've been working for many different projects at the same time, and use Docker for all of them.
Look at this my article where you will find some details, how to build Cache in docker on centos.
Instead of COPY and tar I would recommend using ADD command because it doing extract at the same time.
And for doing such build, you should have file cache-2017.1.3.317.0.18571-lnxrhx64.tar.gz close to the Dockerfile, or in the root of build context.
If you do build this way. Cache distributive should be in the current folder.
docker build .
But, you will face an issue with Storage Driver. It will look like, successful build but PROTECT error during startup. With previous versions of Docker it was possible to change Storage driver to aufs, but not with the latest version, where support for such driver already removed. There are some tricks on how to manage to work with it, but I would not recommend it.
Nowadays only IRIS 2019.1 works quite well in Docker with the default storage driver out of the box.
I usually prefer ways when I can automate as most as possible. So, I would suggest, to use simple export but, and automate it, as you already use %Installer to automate installation.
If you would like to do it with %Installer Manifiest, it is not going to be easy, unfortunately. CSPApplication there quite limited.
I can't just do it this way.
<CSPApplication Url="${CSPApp}" Directory="${CSPAppDir}" iKnowEnabled="yes"/>
You should first create simple csp application
<CSPApplication Url="${CSPApp}" Directory="${CSPAppDir}"/>Add something like this method
ClassMethod EnableiKnow(pCSPName As %String = "") As %Status
{
new $namespace
znspace "%SYS"
set props("iKnowEnabled")=1
d ##class(Security.Applications).Modify(pCSPName,.props)
quit $$$OK
}
But unfortunately, I also can't just call it from an installer, Invoke tag should be placed in Namespace tag. which is actually current namespace, but you should compute it first. This may help to declare a couple more default variables. Just place two first lines before your Installer generator
do %code.WriteLine($c(9)_"set pVars(""CURRENTCLASS"")="""_%classname_"""")
do %code.WriteLine($c(9)_"set pVars(""CURRENTNS"")=$namespace")
quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "setup")
And finally, you can add this to your installer. Place it after CSPApplication creation, but outside of Namespace tag.
<Namespace Name="${CURRENTNS}">
<Invoke Class="${CURRENTCLASS}" Method="EnableiKnow" CheckStatus="true">
<Arg Value="${CSPAPP}"/>
</Invoke>
</Namespace>
I did not know about "%%UPDATE","%%INSERT". I decided to add an extra field
CREATE TABLE "test" (
"identifier" VARCHAR(200) NOT NULL,
"value" INTEGER
COMPUTECODE { Set {*}={*}+{increment} }
COMPUTEONCHANGE ("%%UPDATE","%%INSERT"),
"increment" INTEGER,
PRIMARY KEY ("identifier")
)
and
INSERT OR UPDATE INTO "test" ("identifier", "increment")
VALUES ('someid', 1)
this solved my issue
We do not have any way to suppress warnings, yet. As I know only SonarQube for Java supports it.
I would not be so sure in your doubts about VSCode. VSCode itself supports refactoring staff, we just do not have it in ObjectScript extension, yet. Deleting obsolete classes, for sure very interesting and quite difficult task. But better to solve it another way, with just clean rebuild. Or for example I can add action delete in the context menu in server explorer, so, a developer will be able to manually delete any class/routine on the server from VSCode.
To activate OS authentication in your docker image, you can run this code, in %SYS namespace
Do ##class(Security.System).Get(,.p) Set p("AutheEnabled")=p("AutheEnabled")+16 Do ##class(Security.System).Modify(,.p)
If you work with community edition, you can use my image, where you can easily define also user and password for external use.
Running server
$ docker run -d --rm --name iris \
-p 52773:52773 \
-e IRIS_USER=test \
-e IRIS_PASSWORD=test \
daimor/intersystems-iris:2019.1.0S.111.0-communityTerminal connect
$ docker exec -it iris iris session iris
Node: 413a4da758e7, Instance: IRIS
USER>write $username
root
USER>write $roles
%AllOr with docker-compose, something like this
iris:
image: daimor/intersystems-iris:2019.1.0S.111.0-community
ports:
- 52773:52773
environment:
IRIS_USER: ${IRIS_PASSWORD:-test}
IRIS_PASSWORD: ${IRIS_PASSWORD:-test}
Just published version 0.7.10:
Unfortunately VSCode marketplace doesn't have any good analytics, but as I can see I have now already more then 300 installs.
Hi, very interesting, could you the issue, I'll try to investigate it. And I think I will make next release with API version fix out of the schedule.
You can extend UrlMap only by splitting routes
While in one class you have this
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
<Route Url="/class/:namespace/:classname" Method="GET" Call="GetClass" Cors="true"/>
<Map Prefix="/something" Forward="Some.Your.Class"/>
</Routes>
}You can add one more class, whic will work only with routes started with /something with
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
<Route Url="/more" Method="GET" Call="More" Cors="true"/>
</Routes>
}Where real route will be /something/more
I need a new good icon for the project, can anybody suggest or draw something?
Set ht = ##class(%Net.HttpRequest).%New()
Set ht.Server = "server"
Do ht.SetParam("param1", "true")
Do ht.SetHeader("myheader", "headervalue")
Set tSC = ht.Get("/api/get", 1)
Look at the second parameter in the call of Get method, it is a test flag, helps to understand how your request will actually go
GET /api/get?param1=true HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; InterSystems IRIS;) Host: server Accept-Encoding: gzip myheader: headervalue
Look at this code, it will do the same
Set ht = ##class(%Net.HttpRequest).%New()
Set ht.Server = "server"
Do ht.SetParam("param1", "true")
Do ht.SetHeader("myheader", "headervalue")
Set ht.Location = "/api/get"
Set tSC = ht.Get(, 1)
Or even this code
Set ht = ##class(%Net.HttpRequest).%New()
Do ht.SetHeader("myheader", "headervalue")
Set tSC = ht.Get("http://server/api/get?param1=true", 1)
You can find them in the source of README
[](https://www.intersystems.com/products/intersystems-iris/) [](https://www.intersystems.com/products/cache/) [](https://www.intersystems.com/products/ensemble/)
It would be better if you could provide some of your code.
I don't know exact task of Eduard, but I think, some time when you only one way to communicate with the server, and you need to do some task, why not to use it. But not all those tasks have to be asynchronous. Like here, you can connect, get response and disconnect, as well as with plain HTTP. Or connect, send request for some data, get response and disconnect. Websockets should keep connection alive. That's how it works, when you connected, you send any data, and get response, at any time, or get only response.
And how it looks like just with telnet
$ telnet echo.websocket.org 80
Copy-Paste this data
GET / HTTP/1.1 Accept: */* Host: echo.websocket.org Connection: Upgrade Upgrade: websocket Sec-WebSocket-Key: 7BOhi3I1WkBoazaXv+MfWA== Sec-WebSocket-Version: 13
After the empty line, it will show response
HTTP/1.1 101 Web Socket Protocol Handshake Connection: Upgrade Date: Tue, 05 Feb 2019 10:37:17 GMT Sec-WebSocket-Accept: /gSfI5y+P3MMhONARUXNHG5vrHc= Server: Kaazing Gateway Upgrade: websocket