codename one "cn1-data-access-lib" utf-8 source - utf-8

I wok on my first CN1 app.
I have to use sqlite database acces. I used the cn1-data-access-lib import from json file feature.
It works, but the file what I import is UTF-8 encoded and Includes accented characters. The Hungarian language is just that 🙂 .
After import the accented characters became unrecognizable in emulator.
Made an app on buidserver, the app worked fine on an android phone. The phone setted to Hungarian.
I checked the source code. The importer class has the “public final void importJSON(InputStream is, String selector)” method which instantiate an InputStreamReader without the second (charset or charsetName) parameter. This procedure can not be overridden.
Is there a solution proposal?
If I could get a free hand, I would be able to use custom inporter class. This is a solution to the problems not yet known.
Best regards,
Peter

It looks like a bug in DAO cn1lib: https://github.com/shannah/cn1-data-access-lib/blob/master/src/ca/weblite/codename1/db/Importer.java#L254
It uses this code:
Map data = parser.parseJSON(new InputStreamReader(is));
It should at least default to UTF8. I created a pull request for this: https://github.com/shannah/cn1-data-access-lib/pull/10
Steve should address it there.

Related

problem build fhir with german basis profil

i use vb.net with visualStudio. i have installed the nuget Hl7.Fhir Version3.6.0 and other Hl7.Fhir-nugets (serializer a.s.o V3.6.0)
i have a Problem to build a fhir with resource organization(for example, same with patient) with
german basis profil (https://simplifier.net/ditconnectathon/kbvprforpatient).
I init extension with URL and value, i have the organization and the address and the line. i can add enumerables to line, but no extension.
i am a newbie... All other resources i can build und serialize. My Question: is this a porblem with me and you can show me a solution, or is this (worst case) a problem with Fhir rh4 and the german basis profil. What is then the solution....?
here some primitive code :
dim organization as new organzation
dim adr as new address
dim ext as new extension 'i have a function to make extension returns
ext=FunctionBuildExtension(url,value)
adr.line=new string() {city,street}
' here should placed the addExtension, but i dont know how...
' adr.line.???
organzation.address.add(adr)
this i want to have:
fhir.organization.xml
thank you for your help
The Address.Line is of the native .Net string type, which indeed does not know anything about extensions. You should also have an Address.LineElement which can take an extension.
Here's an example in C# of adding an extension to a primitive typed element: https://docs.fire.ly/projects/Firely-NET-SDK/model/extensions.html

How to generate hash(SHA1) using beanshell in JMeter?

How do I want to generate a hash using beanshell(SHA1) in JMeter to sign up to a application?
I'm not able to get a substantial answer yet from net
Generating a hash is pretty easy, just use DigestUtils class from Apache Commons Codec library (it's a part of JMeter so you won't need to install anything external)
Something like:
import org.apache.commons.codec.digest.DigestUtils;
String foo = "bar";
String sha1Hex = DigestUtils.sha1Hex(foo);
Usually SHA1 is being required for signing requests to OAuth-protected applications, if it is your case, I believe How to Run Performance Tests on OAuth Secured Apps with JMeter will be extremely helpful.
There's a new JMeter function __digest, currently in nightly builds which can be used to encode strings
In your case to save in sha1Value variable the result of myVar variable use the following:
${__digest(SHA-1,${myVar},,,sha1Value)}
4th parameter is uppercase, so you can send true to automatically uppercase it.

msmq unsupported format name operation although the format names are correct

I am debugging though a wcf service. I have a service attached and debugging along with the exe. During the process, I get unsupported format name operation error when initializing queues with strings. However, I am pretty sure and double checked that the strings are of correct syntax, and I have all the permission and access to the queues.
RequestQueue = new System.Messaging.MessageQueue(correctString);
Any ideas are appreciated. Great thanks.
There are a couple of different formats that can be specified in the MessageQueue constructor, that use differing syntax, depending on if they are public/ private queues, dead-letter-queues, journal queues, and so on.
For example:
Public queue: MachineName\QueueName
Private queue: MachineName\Private$\QueueName
Can you post an example of what you are using?
Also, if you are using an Format Name, check the spelling of your format string:
FormatName:DIRECT=OS:YOURMACHINENAME\private$\YourQueueName
Please note that the first part FormatName:DIRECT is case-sensitive. (More in-depth documentation about the syntax can be found in the MSDN here: Direct Format Names)

Controlling WriteProfileString

Is it possible to specify the application name which is used by CWinApp::WriteProfileString()?
If I use CWinApp::SetRegistryKey to set the name of my company to "MyCompany", and I call AfxGetApp()->WriteProfileString in my application called "SomeApp", my string will be stored under the following registry key:
HKEY_CURRENT_USER\Software\MyCompany\SomeApp\...
The problem is that my users want to run multiple versions of SomeApp. So in order that the registry settings don't conflict I want to store them in keys like this:
HKEY_CURRENT_USER\Software\MyCompany\SomeApp 1.1\...
HKEY_CURRENT_USER\Software\MyCompany\SomeApp 2.0\...
etc.
I could replace all instances of WriteProfileString with my own function, but this would be quite difficult as it is used extensively in both our source code and some of the third-party libraries that we use.
Is there some way to force WriteProfileString to use a different string for the application name?
This code in the app constructor worked well:
free((void*)m_pszProfileName);
free((void*)m_pszRegistryKey);
m_pszRegistryKey = _tcsdup(L"nobugz");
m_pszProfileName = _tcsdup(L"myapp\\1.0");

SOAP::RPC::Driver formatting problems. How can I change it?

I'm dealing with a SOAP webservice call from a server that is expecting to receive method calls with the paramaters in the format of:
<urn:offeringId> 354 </urn:offeringId>
But SOAP::RPC::Driver is generating messages in the form of:
<offeringId xsi:type = "xsd:int">354</offeringId>
The server keeps erroring when it gets these messages (especially since it's expecting offeringId to be a custom type internal to itself, not an int).
Is there anyway to configure the driver to format things the way the server is expecting it. Is the server even doing SOAP? I'm having trouble finding reference to that style of formating for SOAP (I know it DOES work though, because SOAPUI works just fine with that type of message).
-Jenny
Edit: I've got at least part of it solved. the RPC::Driver (obviously) uses the RPC standard, whereas apparently the server I'm trying to talk to is doing "document". Now, when I look at RPC::Driver's API, I'm seeing a method named "add_document_method". That SOUNDS to me like it might be what I want, but I can't figure out what paramaters to give it. The examples I've seen around the net don't make much sense to me, things like:
def GetNamePair(response)
response.account.each do |x|
class << x
attr :configuration, true
end
x.configuration = Hash[*x.a.map do |y|
[y.__xmlattr[XSD::QName.new(nil, 'n')], String.new(y)]
end.flatten]
end
end
mNS = 'urn:zimbraAdmin'
drv.add_document_method('GetAllAdminAccountsRequest', mNS, [XSD::QName.new(mNS, 'GetAllAdminAccountsRequest')],
[XSD::QName.new(mNS, 'GetAllAdminAccountsResponse')] )
puts YAML.dump(GetNamePair(drv.GetAllAdminAccountsRequest([]))
All I really know is that I have a method that takes in certain parameters.... I really don't get why, if this method does what I think it does, it has to be more complicated. Isn't this just a matter of taking the exact same data and formating it differently? I'm so confused....
Okay, what I ended up doing was using SOAP:RPC:Drivers add_document_method, which requires me to give it the wsdl, namespace, etc, and then give it the attributes later as a single input hash thingy (and gives me the output in a similar format). It worked, it just wasn't as clean as add_rpc_method (which is waht add_method defaults to)
-Jenny

Resources