Question Nael Nasereldeen · Oct 26, 2021

Hi,

I wonder if anyone tackled the following problem-

Sending a mail with an embedded image is straight forward using %Net.SMTP

status=Message.AttachFile(Dir,FileName)

Message.TextData.Write("..<img src=""cid:xyz.png"">..")

Outlook displays such an Email as expected- with the image in the body of the mail.

Gmail displays the image as an attached file.

There are a lot of suggestions online about this, but none is working for me.

Did anyone face and solved this issue?

Regards,

Nael Naseraldeen

6
0 475
Question Nael Nasereldeen · Dec 10, 2019

Hi,

The class %JSON.Adaptor is very convenient,

I wonder if anyone faced the following scenario using it-

Exporting an object, that has a many to many relationship, and getting the details of the related objects.

For example, if we have three classes - Teachers, Students, and an intermediate class TeacherStudent .

The classes extend %JSON.Adaptor, and we would like to open a Student object, use %JSONExport, and get a JSON

That  includes the details of the student and all the teachers that teach the student, something like:

6
0 587
Question Nael Nasereldeen · Nov 12, 2019

Hi,

I am trying to use the %Net.HttpRequest Class, and the request has to pass through a proxy server that requires authentication.

I am usually able to do that by using the following code:

S httprequest.ProxyServer=proxyServer
S httprequest.ProxyPort=proxyPort
S httprequest.ProxyAuthorization="Basic xyzxyzxyz"
 

I have a problem accessing a site that is accessible only using SSL-

The combination of the proxy authentication code and the SSL code-

S httprequest.Https=1
S httprequest.SSLConfiguration = "XYZ"
S httprequest.ProxyHTTPS=1
 

Does not work- I get the following error:

5
0 1134
Question Nael Nasereldeen · Oct 27, 2019

Hi,

We wanted to use the MD5Hash function,

And had trouble understanding it's return value , as documented:

"Return value: 16-byte MD5 hash."

The value we wanted should have been a simple string, and we did not know how to convert the output to string.

Searching for a solution we found this article:

https://groups.google.com/forum/#!msg/intersystems-public-cache/FdkHIgS9PkQ/P7s-92kN70UJ

That had this solution that works:

"If you know what this gibberish stuff is about, it can be very simple ;)

8
0 1637
Question Nael Nasereldeen · Jun 27, 2019

Hi,

We have a function that takes two parameters, the second one is for output value:

MyFunc(Param1,Param2)

 S Param2="it's all good"

Q 1

How can we detect if the caller called the function with one, or two arguments?

Meaning,  how to distinguish this call:

S Result=$$MyFunc(1)

from this call:

S Result=$$MyFunc(1,.OutVal)

Thanks!

Nael

7
0 337
Question Nael Nasereldeen · Jan 1, 2019

Hi,

When Creating a custom security role, what privileges do I need to add to it, in order for the users that I grant him the role, to be able to use 

dynamic SQL to perform read only queries on all tables in a namespace?

I have a security role, that contains the %Service_SQL privilege,

And yet when I connect to a terminal and try to run an SQL query using dynamic SQL , I get a "user is not privileged for the operation" error.

reading the documentation , I understand that %Service_SQL privilege privilege is not enough, but I don't understand what privilege to add,

7
0 1606
Question Nael Nasereldeen · Apr 24, 2018

Hi,
Trying to work with REST protocol, using IIS 8, both client and server are Cache servers,
I have the following problem- 
When I send a PUT command, I get the following error:
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>

2
0 969
Question Nael Nasereldeen · Apr 16, 2018

Hi,

I need to read a UTF8 encoded text file and translate the content to 8-bit.

Using %File class and $ZCVT(TXT,"I","UTF8") works , but I see that if the content is larger than max string  (32000) and we cut the content

To max string chunks, we can get a <translate> error if we cut it in the "wrong" point..

Is there a better way to do this task?

My code looks like this:

    S file=##class(%File).%New(..LocalFileName)
    D file.Open("R")
    While 'file.AtEnd {    
        S Line=$ZCVT(Line,"I","UTF8")
    }
    D file.Close()

and an example of such an error:

10
0 2211
Question Nael Nasereldeen · Feb 11, 2018

Hi,

Is it possible to Save a base64 data string, representing a png, as a binary png file, In Cache?

When I search google , in general , not Cache specifically,  I see such articles:

https://stackoverflow.com/questions/11511511/how-to-save-a-png-image-se…

and this answer:

You need to extract the base64 image data from that string, decode it and then you can save it to disk, you don't need GD since it already is a png.

But I don't know how to implement that in Cache.

Regards,

Nael

2
0 5455
Question Nael Nasereldeen · Dec 10, 2017

Hi,

I'm trying to use the IN operator in SQL.

does not work, can anyone tell me why that could be?

for example:

SELECT * FROM TafnitCore_Logistics_TransferPackage_DB.PackageData  WHERE ID IN ('1||1||9852553062' , '1||1||9852553061' ) ORDER BY Building

And I get the following error:

3
0 511
Question Nael Nasereldeen · Aug 31, 2017

Hi guys,

How do you deal with underscore characters when using jsonProvider  and exporting or importing ?

for example:

USER>s jsonString="{""what"":""1"",""up"":""2"",""test_test"":""3""}"
 
USER>set status = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(jsonString,,.outputObj)
 
USER>w outputObj.what
1
USER>w outputObj.up
2
USER>w outputObj.test_test
 
W outputObj.test_test
^
<UNDEFINED> *test

we found out that we can access it like this, but not sure if it's the recommended method-

w outputObj.%data("test_test")

Regards,

Nael

11
0 641
Question Nael Nasereldeen · Nov 21, 2016

Hello,

When we need to create a utf-8 encoded XML file, we  use the Charset property of %XML.Writer:

set writer=##class(%XML.Writer).%New()
set writer.Charset="UTF-8"

How can we create regular txt files with such encoding?

Our Cache Installations are 8 bit and not unicode.

Thanks,

Nael Naser eldeen

10
1 3831