Get values of effect options in vintageJS - imagefilter

I am working on website that add effects to images online using vintageJS. I have the following effect
effect1 = {
vignette: 0.7,
viewFinder: "js/ImageEffects/assets/viewfinder/ttv-1.jpg",
screen: { r: 227, g: 12, b: 169, a: 0.15 }
};
and also I have the four basic effect of vintageJS( I get the four effects form the website of vintageJS . The website should have nine effects which mean that I need another four effects. I try to write some random values but I didn't get a good effect. Can anyone give some values that produce a good effect ?

Try the these effects:
var RetroCurveR = [0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 44, 45, 47, 48, 49, 52, 54, 55, 57, 59, 60, 62, 65, 67, 69, 70, 72, 74, 77, 79, 81, 83, 86, 88, 90, 92, 94, 97, 99, 101, 103, 107, 109, 111, 112, 116, 118, 120, 124, 126, 127, 129, 133, 135, 136, 140, 142, 143, 145, 149, 150, 152, 155, 157, 159, 162, 163, 165, 167, 170, 171, 173, 176, 177, 178, 180, 183, 184, 185, 188, 189, 190, 192, 194, 195, 196, 198, 200, 201, 202, 203, 204, 206, 207, 208, 209, 211, 212, 213, 214, 215, 216, 218, 219, 219, 220, 221, 222, 223, 224, 225, 226, 227, 227, 228, 229, 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 238, 238, 239, 239, 240, 241, 241, 242, 242, 243, 244, 244, 245, 245, 245, 246, 247, 247, 248, 248, 249, 249, 249, 250, 251, 251, 252, 252, 252, 253, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255];
var RetroCurveG = [0, 0, 1, 2, 2, 3, 5, 5, 6, 7, 8, 8, 10, 11, 11, 12, 13, 15, 15, 16, 17, 18, 18, 19, 21, 22, 22, 23, 24, 26, 26, 27, 28, 29, 31, 31, 32, 33, 34, 35, 35, 37, 38, 39, 40, 41, 43, 44, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 83, 84, 85, 86, 88, 89, 90, 92, 93, 94, 95, 96, 97, 100, 101, 102, 103, 105, 106, 107, 108, 109, 111, 113, 114, 115, 117, 118, 119, 120, 122, 123, 124, 126, 127, 128, 129, 131, 132, 133, 135, 136, 137, 138, 140, 141, 142, 144, 145, 146, 148, 149, 150, 151, 153, 154, 155, 157, 158, 159, 160, 162, 163, 164, 166, 167, 168, 169, 171, 172, 173, 174, 175, 176, 177, 178, 179, 181, 182, 183, 184, 186, 186, 187, 188, 189, 190, 192, 193, 194, 195, 195, 196, 197, 199, 200, 201, 202, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 223, 224, 225, 226, 226, 227, 228, 228, 229, 230, 231, 232, 232, 232, 233, 234, 235, 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 241, 242, 242, 242, 243, 244, 245, 245, 246, 246, 247, 247, 248, 249, 249, 249, 250, 251, 251, 252, 252, 252, 253, 254, 255];
var RetroCurveB = [53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, 60, 61, 61, 61, 62, 62, 63, 63, 63, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 69, 69, 69, 70, 70, 71, 71, 72, 73, 73, 73, 74, 74, 75, 75, 76, 77, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 83, 84, 85, 85, 86, 86, 87, 87, 88, 89, 89, 90, 90, 91, 91, 93, 93, 94, 94, 95, 95, 96, 97, 98, 98, 99, 99, 100, 101, 102, 102, 103, 104, 105, 105, 106, 106, 107, 108, 109, 109, 110, 111, 111, 112, 113, 114, 114, 115, 116, 117, 117, 118, 119, 119, 121, 121, 122, 122, 123, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 142, 143, 144, 145, 145, 146, 146, 148, 148, 149, 149, 150, 151, 152, 152, 153, 153, 154, 155, 156, 156, 157, 157, 158, 159, 160, 160, 161, 161, 162, 162, 163, 164, 164, 165, 165, 166, 166, 167, 168, 168, 169, 169, 170, 170, 171, 172, 172, 173, 173, 174, 174, 175, 176, 176, 177, 177, 177, 178, 178, 179, 180, 180, 181, 181, 181, 182, 182, 183, 184, 184, 184, 185, 185, 186, 186, 186, 187, 188, 188, 188, 189, 189, 189, 190, 190, 191, 191, 192, 192, 193, 193, 193, 194, 194, 194, 195, 196, 196, 196, 197, 197, 197, 198, 199];
var EnhanceCurveR = [], EnhanceCurveG = [], EnhanceCurveB = [];
for (var i = 0; i <= 255; ++i)
EnhanceCurveB[i] = EnhanceCurveG[i] = EnhanceCurveR[i] = Math.round(-12 * Math.sin(i * 2 * Math.PI / 255) + i);
effect1 = {
noise: 20,
vignette: 0.6,
desaturate: 0.05,
curves: { r: EnhanceCurveR, g: EnhanceCurveG, b: EnhanceCurveB },
screen: { r: 12, g: 75, b: 153, a: 0.3 }
};
effect2 = {
noise: 20,
lighten: 0.1,
vignette: 0.6,
desaturate: 0.05,
curves: { r: RetroCurveR, g: RetroCurveG, b: RetroCurveB },
screen: { r: 0, g: 0, b: 255, a: 0.25 }
};
effect3 = {
sepia: true,
lighten: 0.1,
desaturate: 0.8,
curves: { r: EnhanceCurveR, g: EnhanceCurveG, b: EnhanceCurveB },
};

Related

Problem in decoding h264 raw frame in swift

I try to decode an inputstream of [UInt8] to h264 video , I have search the whole web and read the beautiful detailed answer of olivia How to use VideoToolbox to decompress H.264 video stream , I tried to convert her objc answer to swift but it didn't worked for me .
Then i came to this nice pod https://github.com/songbihai/VideoDecoder?ref=iosexample.com the problem is i am getting some of images completely and some other in half green ,
Beside this image issue , the other issue i have is this code doesn't work on real device(iPad pro 2019 , iOS 15), and gives me
DecodeError.decompressionOutputCallback(-12909)
which as I searched means bad data(!?) , and this is just for my stream the example file included in pod is ok, I tried to tweak some parameters but when I did it just didn't give me anything both on simulator and the real device.
this is one part of data that I'm getting
1, 0, 0, 0, 85, 3, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 253, 8, 0, 0, 6, 102, 1, 0, 53, 3, 0, 0, 4, 1, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 97, 224, 112, 124, 79, 87, 150, 179, 234, 117, 62, 173, 161, 255, 77, 252, 87, 185, 125, 113, 31, 255, 255, 87, 241, 151, 222, 199, 142, 213, 117, 121, 250, 180, 99, 215, 101, 247, 175, 94, 229, 188, 214, 166, 189, 243, 107, 139, 188, 215, 170, 203, 138, 174, 181, 38, 226, 122, 180, 220, 187, 228, 229, 239, 8, 47, 215, 235, 245, 253, 98, 247, 23, 186, 235, 81, 26, 155, 189, 241, 21, 87, 142, 235, 95, 90, 159, 171, 212, 35, 147, 171, 244, 228, 234, 241, 61, 106, 78, 173, 84, 174, 242, 195, 61, 125, 117, 175, 171, 205, 85, 105, 175, 25, 213, 165, 234, 247, 214, 162, 124, 208, 133, 123, 95, 87, 174, 181, 17, 187, 235, 95, 87, 133, 191, 93, 111, 35, 249, 122, 212, 41, 214, 164, 235, 215, 205, 127, 212, 223, 191, 12, 49, 122, 123, 105, 188, 144, 238, 35, 171, 86, 253, 195, 143, 233, 252, 109, 215, 213, 170, 173, 234, 94, 181, 9, 119, 175, 142, 147, 179, 235, 213, 246, 229, 234, 213, 213, 190, 251, 201, 221, 120, 222, 175, 243, 111, 164, 55, 101, 191, 19, 17, 151, 155, 215, 94, 241, 253, 90, 47, 171, 117, 151, 81, 92, 215, 125, 87, 147, 63, 55, 180, 77, 221, 99, 43, 223, 175, 17, 141, 239, 79, 44, 51, 215, 213, 103, 228, 247, 87, 147, 173, 77, 201, 218, 147, 247, 136, 172, 188, 180, 250, 234, 213, 173, 105, 235, 123, 234, 213, 19, 87, 174, 181, 10, 94, 171, 93, 90, 42, 176, 142, 19, 221, 127, 47, 74, 185, 123, 207, 133, 101, 198, 233, 100, 132, 57, 111, 253, 94, 90, 196, 86, 126, 11, 123, 232, 246, 155, 147, 165, 9, 117, 120, 158, 189, 92, 102, 143, 189, 157, 143, 96, 95, 193, 85, 27, 119, 109, 46, 214, 131, 171, 227, 175, 233, 116, 116, 252, 22, 117, 183, 99, 243, 102, 190, 47, 58, 134, 47, 69, 241, 158, 187, 123, 116, 244, 31, 193, 12, 210, 216, 216, 141, 189, 245, 168, 67, 115, 241, 126, 158, 223, 198, 250, 91, 116, 52, 61, 122, 15, 151, 211, 252, 41, 236, 39, 76, 149, 239, 122, 119, 191, 205, 175, 224, 135, 216, 153, 240, 133, 47, 64, 126, 255, 31, 211, 219, 247, 246, 89, 24, 227, 55, 39, 87, 159, 113, 187, 142, 234, 208, 75, 184, 107, 130, 75, 125, 136, 156, 146, 110, 93, 250, 140, 234, 245, 120, 158, 93, 15, 124, 157, 168, 142, 181, 238, 28, 235, 221, 226, 123, 167, 196, 98, 100, 220, 70, 225, 77, 215, 86, 251, 239, 47, 55, 181, 226, 116, 251, 89, 186, 180, 61, 201, 111, 139, 230, 239, 92, 212, 184, 107, 171, 198, 106, 106, 205, 201, 127, 228, 239, 25, 213, 253, 43, 201, 201, 127, 230, 244, 15, 203, 75, 146, 209, 188, 184, 42, 241, 60, 154, 235, 151, 75, 124, 221, 185, 111, 55, 90, 159, 154, 203, 136, 172, 70, 235, 190, 178, 240, 81, 218, 191, 98, 184, 158, 221, 127, 190, 213, 242, 122, 248, 202, 210, 233, 94, 148, 170, 149, 14, 184, 78, 191, 183, 226, 180, 187, 31, 225, 46, 236, 73, 255, 25, 239, 163, 214, 235, 97, 176, 252, 37, 239, 189, 112, 81, 234, 170, 142, 223, 8, 251, 237, 167, 106, 190, 16, 238, 235, 178, 176, 255, 31, 207, 11, 59, 185, 55, 191, 130, 207, 44, 45, 232, 156, 198, 255, 17, 181, 75, 68, 161, 30, 79, 114, 113, 93, 236, 249, 121, 111, 205, 194, 22, 182, 244, 237, 255, 8, 119, 245, 98, 254, 46, 213, 83, 206, 24, 15, 197, 221, 191, 127, 132, 111, 125, 157, 200, 65, 219, 126, 59, 96, 94, 195, 158, 25, 249, 169, 255, 8, 123, 62, 205, 28, 141, 75, 193, 85, 135, 172, 112, 221, 213, 45, 34, 241, 222, 77, 161, 49, 253, 175, 139, 221, 171, 21, 143, 229, 218, 252, 20, 216, 246, 223, 175, 175, 138, 239, 162, 252, 18, 119, 215, 197, 123, 105, 115, 117, 233, 234, 111, 75, 223, 181, 228, 245, 39, 94, 139, 226, 55, 223, 251, 223, 241, 30, 233, 255, 116, 139, 15, 196, 211, 96, 189, 126, 74, 86, 171, 143, 223, 183, 250, 249, 50, 209, 159, 238, 203, 79, 242, 81, 214, 184, 139, 243, 193, 47, 196, 82, 73, 157, 36, 177, 60, 186, 89, 121, 54, 13, 63, 146, 151, 91, 147, 114, 110, 54, 241, 29, 106, 78, 246, 121, 47, 27, 29, 119, 230, 239, 210, 63, 37, 248, 138, 199, 245, 121, 55, 62, 235, 8, 43, 68, 110, 159, 10, 197, 117, 105, 249, 186, 197, 245, 98, 126, 172, 85, 97, 110, 111, 105, 64

How flutter parses ArrayBuffer

flutter 2.0.0 uses the long connection websocket protocol, the returned data is ArrayBuffer, how to convert it into json data
[31, 139, 8, 0, 0, 0, 0, 0, 0, 0, 37, 144, 49, 79, 195, 48, 16, 70, 255, 10, 186, 217, 61, 249, 206, 103, 59, 241, 214, 38, 65, 68, 13, 36, 212, 41, 66, 221, 2, 237, 192, 208, 5, 194, 84, 229, 191, 115, 41, 147, 101, 125, 239, 61, 75, 190, 193, 231, 245, 12, 9, 126, 126, 63, 240, 123, 154, 47, 96, 224, 60, 205, 19, 164, 27, 28, 115, 61, 174, 231, 208, 119, 25, 146, 160, 48, 137, 129, 93, 126, 131, 196, 145, 48, 82, 136, 6, 218, 62, 43, 100, 209, 122, 239, 165, 208, 185, 122, 130, 20, 98, 68, 9, 6, 170, 237, 190, 81, 216, 161, 13, 106, 62, 182, 29, 36, 138, 1, 197, 137, 154, 117, 175, 162, 88, 100, 17, 29, 235, 109, 86, 145, 11, 198, 82, 43, 221, 160, 155, 35, 36, 13, 254, 231, 169, 8, 108, 160, 25, 43, 133, 244, 42, 209, 25, 120, 63, 12, 26, 68, 231, 136, 244, 177, 174, 125, 217, 171, 196, 120, 175, 159, 154, 149, 36, 143, 190, 92, 27, 207, 107, 132, 138, 184, 114, 247, 134, 148, 24, 189, 129, 215, 241, 168, 19, 9, 150, 236, 138, 101, 49, 48, 127, 93, 47, 250, 29, 108, 153, 54, 86, 54, 68, 15, 76, 73, 202, 100, 9, 150, 63, 238, 197, 136, 230, 44, 1, 0, 0]

BadSessionNotActivated,0x80270000,The session cannot be used because ActivateSession has not been called

Whenever I try to send an ActivateSessionRequest to the opcua server, it throws an error stating "BadSessionNotActivated". Below is the message format of ActivateSessionRequest:
var ActivateSessionRequest v_activateSessionReq := {
requestHeader := session_reqHeader,
clientSignature := {
algorithm := valueof(tr_String("http://opcfoundation.org/UA/SecurityPolicy#None")),
Signature := valueof(tr_ByteString({48, 130, 4, 19, 48, 130, 2, 251, 160, 3, 2, 1, 2, 2, 2, 16, 26, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 40, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 18, 48, 16, 6, 3, 85, 4, 3, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 48, 34, 24, 15, 50, 48, 49, 56, 48, 50, 48, 53, 49, 51, 53, 54, 48, 50, 90, 24, 15, 50, 48, 49, 57, 48, 50, 48, 53, 49, 51, 53, 54, 48, 50, 90, 48, 40, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 18, 48, 16, 6, 3, 85, 4, 3, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 178, 243, 137, 233, 196, 81, 105, 65, 195, 121, 2, 212, 193, 216, 187, 73, 213, 135, 135, 163, 140, 13, 165, 74, 203, 63, 212, 221, 158, 178, 59, 89, 71, 118, 141, 147, 102, 111, 5, 111, 52, 36, 160, 187, 189, 244, 38, 0, 200, 206, 33, 174, 227, 110, 132, 79, 202, 59, 223, 29, 116, 217, 12, 193, 191, 44, 87, 168, 113, 69, 125, 23, 239, 71, 139, 38, 121, 203, 255, 54, 196, 68, 199, 249, 43, 206, 32, 255, 192, 10, 134, 200, 71, 104, 150, 176, 66, 233, 241, 17, 227, 3, 96, 172, 169, 164, 96, 113, 114, 190, 194, 28, 232, 161, 46, 241, 170, 0, 70, 215, 89, 228, 130, 219, 152, 216, 85, 234, 72, 142, 103, 63, 211, 101, 238, 224, 160, 84, 134, 171, 241, 148, 60, 212, 190, 250, 16, 203, 248, 212, 153, 16, 56, 159, 153, 185, 202, 239, 135, 150, 185, 188, 80, 207, 62, 122, 172, 25, 110, 80, 124, 166, 227, 86, 32, 97, 137, 35, 164, 156, 1, 150, 51, 64, 140, 180, 196, 162, 32, 131, 207, 170, 144, 19, 90, 251, 239, 173, 33, 65, 135, 125, 110, 137, 2, 184, 106, 146, 55, 166, 217, 141, 127, 163, 137, 57, 91, 158, 133, 29, 218, 205, 174, 98, 208, 123, 30, 240, 42, 29, 102, 187, 113, 26, 166, 30, 55, 207, 49, 32, 132, 173, 115, 155, 7, 207, 206, 201, 27, 209, 52, 198, 119, 210, 142, 161, 2, 3, 1, 0, 1, 163, 130, 1, 65, 48, 130, 1, 61, 48, 12, 6, 3, 85, 29, 19, 1, 1, 255, 4, 2, 48, 0, 48, 29, 6, 3, 85, 29, 14, 4, 22, 4, 20, 162, 197, 27, 92, 111, 157, 37, 181, 146, 213, 162, 250, 174, 112, 194, 229, 164, 3, 176, 205, 48, 81, 6, 3, 85, 29, 35, 4, 74, 48, 72, 128, 20, 162, 197, 27, 92, 111, 157, 37, 181, 146, 213, 162, 250, 174, 112, 194, 229, 164, 3, 176, 205, 161, 44, 164, 42, 48, 40, 49, 18, 48, 16, 6, 3, 85, 4, 10, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 49, 18, 48, 16, 6, 3, 85, 4, 3, 19, 9, 78, 111, 100, 101, 79, 80, 67, 85, 65, 130, 2, 16, 26, 48, 91, 6, 3, 85, 29, 17, 4, 84, 48, 82, 134, 44, 117, 114, 110, 58, 97, 118, 100, 111, 111, 116, 99, 104, 97, 108, 107, 101, 45, 86, 105, 114, 116, 117, 97, 108, 66, 111, 120, 58, 78, 111, 100, 101, 79, 80, 67, 85, 65, 45, 83, 101, 114, 118, 101, 114, 130, 9, 108, 111, 99, 97, 108, 104, 111, 115, 116, 130, 23, 97, 118, 100, 111, 111, 116, 99, 104, 97, 108, 107, 101, 45, 86, 105, 114, 116, 117, 97, 108, 66, 111, 120, 48, 44, 6, 9, 96, 134, 72, 1, 134, 248, 66, 1, 13, 4, 31, 22, 29, 79, 112, 101, 110, 83, 83, 76, 32, 71, 101, 110, 101, 114, 97, 116, 101, 100, 32, 67, 101, 114, 116, 105, 102, 105, 99, 97, 116, 101, 48, 14, 6, 3, 85, 29, 15, 1, 1, 255, 4, 4, 3, 2, 2, 252, 48, 32, 6, 3, 85, 29, 37, 1, 1, 255, 4, 22, 48, 20, 6, 8, 43, 6, 1, 5, 5, 7, 3, 1, 6, 8, 43, 6, 1, 5, 5, 7, 3, 2, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 3, 130, 1, 1, 0, 147, 168, 16, 170, 204, 221, 81, 100, 167, 38, 104, 142, 27, 107, 108, 87, 94, 195, 100, 124, 141, 117, 46, 23, 231, 145, 68, 182, 241, 225, 148, 94, 144, 1, 142, 61, 228, 88, 64, 243, 126, 180, 17, 33, 164, 128, 234, 183, 198, 31, 223, 59, 125, 218, 110, 0, 112, 182, 244, 199, 220, 139, 114, 162, 153, 76, 245, 134, 167, 163, 199, 175, 153, 82, 214, 106, 142, 15, 52, 87, 11, 230, 95, 75, 23, 170, 137, 92, 144, 76, 111, 179, 1, 36, 150, 191, 84, 226, 252, 199, 228, 38, 97, 138, 26, 32, 230, 65, 110, 154, 179, 104, 146, 186, 104, 248, 246, 26, 136, 12, 15, 220, 6, 203, 220, 141, 230, 11, 185, 247, 250, 9, 76, 236, 74, 101, 149, 32, 100, 220, 249, 46, 255, 129, 21, 126, 6, 86, 230, 198, 94, 228, 51, 50, 73, 103, 57, 212, 105, 255, 9, 181, 189, 104, 121, 27, 21, 78, 196, 226, 99, 176, 44, 194, 176, 211, 216, 13, 81, 142, 35, 52, 76, 116, 49, 190, 253, 199, 166, 51, 41, 105, 81, 90, 222, 232, 223, 74, 100, 203, 192, 130, 48, 46, 116, 37, 236, 199, 70, 81, 60, 244, 6, 45, 51, 246, 4, 254, 178, 240, 14, 22, 64, 200, 134, 199, 249, 171, 118, 219, 81, 124, 218, 91, 175, 65, 59, 233, 19, 110, 217, 72, 165, 91, 75, 182, 12, 214, 215, 30, 169, 153, 36, 7, 69, 60 ,224, 153, 75, 106, 120, 118, 227, 63, 4, 63, 14, 101, 116, 161, 229, 230, 127, 196, 14, 37, 23, 251, 174, 94, 204, 114, 180, 26, 77, 200, 61, 148}))
},
clientSoftwareCertificates := { realArray := { arrayLength := 0, arrayValues := { } } },
localeIds := valueof(tr_ListOfLocaleId({})),
userIdentityToken := {
encodingByte := 1,
twoByteNodeValue := omit,
namespaceIndex := 0,
fourByteNodeValue := 321,
encoding := 1,
parameterLength := 13,
extensibleParameterBody := {
anonymousIdentityToken := {
policyId := valueof(tr_String( "username_basic256"))
}
}
},
userTokenSignature := {
algorithm := valueof(tr_StringNull),
Signature := valueof(tr_ByteStringNull)
}
}
Client-Server Communication
As shown in the image, ActivateSessionRequest is successful by sending SessionId and AuthenticationToken to the server. The header of ActivateSessionRequest contains AuthenticationToken. But How shall I provide the SessionId to the server? Is it because I am not providing the SessionId in the ActivateSessionRequest that the server throws an error or due to some other mistake? can someone guide me?
Any feedback is highly appreciated. Thank you in Advance
With Regards,
Avdoot

Unable to get an indexvalue of an object in nsmutablearray in iphone

in my application at one place I have to get the index value of a particular object. For this I coded in this manner as shown below.
NSString *a=[NSString stringWithFormat:#"%d",[imagesdmobject.proofID intValue]];
NSLog(#"a value is %#",a);
Here a value is 56
Now I have to get the index of 56 from appdelegate.projectTitlesProofIDArray.
int value=[appdelegate.projectTitlesProofIDArray indexOfObjectIdenticalTo:a];
data in appdelegate.projectTitlesProofIDArray is :
41,
34,
35,
64,
45,
1,
67,
75,
76,
77,
78,
79,
80,
81,
82,
83,
85,
68,
86,
87,
88,
89,
90,
92,
69,
95,
97,
98,
100,
101,
70,
71,
72,
73,
74,
39,
37,
109,
108,
110,
38,
91,
93,
94,
36,
96,
99,
102,
103,
104,
105,
106,
107,
65,
66,
40,
46,
47,
48,
49,
50,
52,
53,
54,
60,
61,
62,
32,
55,
56,
57,
58,
59,
42,
43,
44,
63,
47,
48,
41,
34,
35,
64,
1,
91,
93,
94,
36,
96,
99,
102,
103,
104,
105,
106,
107,
65,
66,
40,
60,
61,
62,
32,
55,
56,
57,
58,
59,
54,
34,
35,
41,
34,
35,
64,
67,
75,
76,
77,
78,
79,
80,
81,
82,
83,
85,
68,
86,
87,
88,
89,
90,
92,
69,
95,
97,
98,
100,
101,
70,
71,
72,
73,
74,
39,
37,
109,
108,
110,
38,
91,
93,
94,
36,
96,
99,
102,
103,
104,
105,
106,
107,
65,
66,
40,
46,
47,
48,
49,
50,
52,
53,
54,
41,
34,
35,
64,
45,
1,
67,
75,
76,
77,
78,
79,
80,
81,
82,
83,
85,
68,
86,
87,
88,
89,
90,
92,
69,
95,
97,
98,
100,
101,
70,
71,
72,
73,
74,
39,
37,
109,
108,
110,
38,
91,
93,
94,
36,
96,
99,
102,
103,
104,
105,
106,
107,
65,
66,
40,
46,
47,
48,
49,
50,
52,
53,
54,
60,
61,
62,
32,
55,
56,
57,
58,
59,
42,
43,
44,
47,
34,
35,
39,
37,
109,
108,
110,
38,
46,
47,
48,
49,
50,
52,
53,
54,
42,
43,
44,
41,
34,
35,
64,
45,
1,
67,
75,
76,
77,
78,
79,
80,
81,
83,
85,
68,
86,
87,
88,
89,
90,
92,
69,
95,
97,
98,
100,
70,
71,
73,
74,
39,
37,
109,
108,
110,
38,
91,
94,
36,
96,
99,
102,
103,
104,
105,
106,
107,
65,
66,
40,
46,
47,
48,
49,
50,
52,
54,
60,
61,
62,
32,
55,
56,
57,
58,
59,
42,
43,
63,
41,
34,
35,
64,
45,
1,
67,
75,
76,
77,
78,
79,
80,
81,
82,
83,
85,
68,
86,
87,
88,
89,
90,
92,
69,
95,
97,
98,
100,
101,
70,
71,
72,
73,
74,
39,
37,
109,
108,
110,
38,
91,
93,
94,
36,
96,
99,
102,
103,
104,
105,
106,
107,
65,
66,
40,
46,
47,
48,
49,
50,
52,
53,
54,
60,
61,
62,
32,
55,
56,
57,
58,
59,
42,
43,
44,
63,
41,
34,
35,
64,
45,
1,
67,
75,
76,
77,
78,
79,
80,
81,
82,
83,
85,
68,
86,
87,
88,
89,
90,
92,
69,
95,
97,
98,
100,
101,
70,
71,
72,
73,
74,
39,
37,
109,
108,
110,
38,
91,
93,
94,
36,
96,
99,
102,
103,
104,
105,
106,
107,
65,
66,
40,
46,
47,
48,
49,
50,
52,
53,
54,
60,
61,
62,
32,
55,
56,
57,
58,
59,
42,
43,
44,
63,
46
56 is there, but I am getting the incorrect value as 2147483647.
Please help me in this issue. I am stuck at this place.
You need to do this:-
Suppose you array contains:-
[array addObject:#"1"];
[array addObject:#"2"];
[array addObject:#"3"];
[array addObject:#"4"];
[array addObject:#"5"];
[array addObject:#"6"];
Now you need to find the index of object 5
if([array containsObject:#"5"])
{
int index=[array indexOfObject:#"5"];
}

Byte Array to NSData

In a WebService JSON response is coming. In the response, there is image is coming as a byte array. I have to show the image in a UIImageView. I am trying to convert the byte array to NSData. But not getting how to do that. Any help would be appreciated.
I am confident that the byte array has image data in it.
Sample Byte array for your reference:
(137,
80,
78,
71,
...
66,
96,
130)
Thanks
Here is an example of getting your data into a NSData object.
const unsigned char bytes[] = {values here};
NSData *data = [NSData dataWithBytes:bytes length:sizeof(bytes)];
NSLog(#"%#", data);
You have to convert the JSON to an array of strings first; you can, for example, use the NSJSONSerialization class:
NSArray *strings = [NSJSONSerialization JSONObjectWithData:theJSONString options:kNilOptions error:NULL];
Then walk the strings array, convert each entry to an integer, and add it to an allocated byte pointer/array:
unsigned c = strings.count;
uint8_t *bytes = malloc(sizeof(*bytes) * c);
unsigned i;
for (i = 0; i < c; i++)
{
NSString *str = [strings objectAtIndex:i];
int byte = [str intValue];
bytes[i] = byte;
}
Then finally make an NSData out of the bytes, then init an UIImage object using it:
NSData *imageData = [NSData dataWithBytesNoCopy:bytes length:c freeWhenDone:YES];
UIImage *image = [UIImage imageWithData:imageData];
and here's how to do it in Swift...
var bytes:[Byte] = [137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 130, 0, 0, 0, 22, 8, 6, 0, 0, 0, 12, 244, 68, 168, 0, 0, 0, 1, 115, 82, 71, 66, 0, 174, 206, 28, 233, 0, 0, 0, 4, 103, 65, 77, 65, 0, 0, 177, 143, 11, 252, 97, 5, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 14, 196, 0, 0, 14, 196, 1, 149, 43, 14, 27, 0, 0, 3, 212, 73, 68, 65, 84, 104, 67, 237, 153, 61, 139, 20, 65, 16, 134, 55, 17, 253, 3, 114, 127, 224, 208, 204, 64, 228, 18, 3, 19, 21, 19, 35, 217, 200, 204, 15, 48, 19, 228, 48, 50, 242, 76, 12, 245, 2, 99, 47, 55, 88, 83, 65, 220, 76, 48, 57, 19, 49, 220, 95, 224, 125, 120, 34, 126, 224, 120, 207, 65, 141, 53, 189, 213, 85, 189, 238, 172, 176, 210, 5, 195, 206, 77, 87, 87, 247, 84, 189, 245, 118, 213, 220, 160, 169, 82, 61, 112, 232, 129, 65, 245, 66, 245, 0, 30, 168, 64, 168, 56, 56, 242, 64, 5, 66, 5, 66, 5, 66, 197, 192, 31, 15, 12, 142, 29, 63, 209, 228, 174, 209, 232, 101, 199, 87, 147, 201, 36, 171, 139, 141, 55, 227, 113, 179, 122, 234, 180, 171, 115, 110, 109, 173, 217, 217, 217, 53, 99, 112, 241, 210, 229, 169, 185, 216, 244, 246, 88, 50, 134, 93, 145, 18, 125, 79, 231, 230, 173, 219, 217, 253, 47, 51, 176, 92, 32, 156, 92, 89, 233, 188, 219, 189, 245, 245, 16, 8, 219, 219, 239, 27, 230, 69, 206, 76, 157, 246, 112, 99, 99, 106, 14, 78, 71, 230, 13, 94, 159, 64, 96, 47, 218, 222, 50, 7, 95, 239, 221, 5, 2, 47, 77, 96, 17, 178, 56, 10, 48, 217, 139, 192, 36, 81, 240, 158, 111, 109, 181, 251, 176, 178, 30, 102, 233, 43, 139, 75, 128, 192, 187, 161, 39, 87, 196, 108, 226, 23, 15, 8, 223, 70, 47, 154, 131, 7, 247, 155, 253, 27, 215, 155, 79, 103, 86, 59, 23, 207, 24, 67, 71, 203, 175, 253, 189, 230, 235, 179, 39, 157, 235, 199, 187, 183, 13, 23, 250, 123, 195, 171, 71, 118, 248, 229, 111, 158, 91, 130, 221, 207, 119, 239, 52, 59, 231, 207, 154, 107, 179, 6, 107, 137, 132, 64, 128, 202, 145, 167, 155, 155, 97, 112, 5, 8, 232, 91, 25, 174, 193, 129, 227, 113, 38, 0, 179, 156, 206, 49, 84, 2, 132, 89, 51, 50, 7, 208, 52, 203, 217, 151, 7, 102, 253, 174, 233, 30, 126, 126, 252, 208, 6, 44, 5, 128, 245, 55, 65, 101, 14, 66, 96, 83, 29, 43, 152, 90, 231, 251, 235, 87, 237, 22, 176, 19, 233, 235, 185, 2, 196, 16, 8, 165, 103, 191, 232, 105, 167, 64, 237, 158, 51, 1, 217, 181, 225, 112, 74, 7, 16, 105, 241, 108, 244, 5, 4, 246, 66, 112, 229, 138, 128, 239, 49, 130, 100, 109, 9, 8, 68, 103, 247, 202, 133, 44, 16, 34, 59, 4, 94, 196, 2, 1, 207, 96, 32, 139, 153, 176, 13, 248, 90, 32, 224, 136, 156, 195, 117, 198, 122, 122, 105, 150, 144, 85, 158, 190, 181, 158, 117, 254, 70, 199, 140, 55, 158, 218, 155, 199, 150, 204, 245, 106, 4, 178, 211, 10, 28, 52, 205, 24, 23, 247, 150, 14, 99, 22, 35, 136, 46, 129, 204, 101, 59, 64, 128, 238, 83, 187, 28, 31, 233, 209, 147, 234, 0, 220, 22, 8, 81, 6, 136, 19, 60, 61, 139, 46, 75, 106, 11, 177, 205, 113, 97, 117, 20, 243, 4, 175, 111, 32, 68, 93, 131, 21, 12, 28, 157, 138, 197, 26, 204, 205, 29, 13, 114, 116, 96, 199, 2, 3, 243, 172, 140, 103, 29, 97, 3, 126, 249, 219, 154, 223, 2, 129, 5, 162, 2, 73, 186, 136, 92, 96, 114, 231, 38, 52, 90, 18, 204, 180, 93, 45, 169, 17, 116, 129, 103, 221, 75, 231, 81, 98, 43, 98, 22, 93, 183, 228, 142, 36, 11, 8, 60, 75, 37, 167, 103, 1, 1, 6, 209, 98, 129, 136, 121, 127, 115, 36, 9, 59, 116, 128, 16, 177, 130, 156, 221, 179, 2, 129, 151, 136, 90, 79, 198, 115, 242, 47, 106, 4, 214, 240, 186, 34, 41, 110, 163, 154, 164, 132, 158, 177, 1, 101, 167, 20, 157, 99, 132, 20, 72, 86, 230, 151, 50, 130, 102, 7, 125, 223, 1, 66, 196, 10, 146, 17, 139, 0, 66, 238, 35, 19, 123, 138, 170, 119, 93, 228, 165, 247, 227, 195, 2, 80, 23, 118, 158, 173, 40, 17, 116, 75, 59, 11, 35, 16, 112, 221, 38, 114, 111, 213, 8, 60, 183, 24, 161, 20, 8, 95, 30, 63, 10, 107, 4, 169, 37, 210, 22, 117, 10, 8, 57, 103, 80, 221, 71, 244, 234, 181, 84, 81, 59, 233, 101, 90, 201, 177, 18, 209, 122, 180, 119, 230, 35, 81, 167, 83, 242, 49, 105, 150, 246, 77, 3, 130, 190, 126, 30, 32, 48, 223, 90, 155, 35, 3, 144, 88, 44, 196, 250, 204, 153, 2, 2, 206, 176, 40, 178, 36, 171, 254, 7, 32, 148, 116, 58, 105, 123, 155, 130, 56, 151, 241, 94, 27, 40, 140, 49, 15, 16, 216, 199, 172, 107, 3, 2, 10, 209, 129, 20, 88, 250, 101, 96, 5, 93, 120, 105, 54, 64, 79, 198, 104, 13, 245, 189, 215, 91, 243, 37, 49, 87, 216, 201, 71, 171, 28, 43, 48, 47, 93, 43, 183, 7, 235, 185, 174, 63, 188, 226, 82, 214, 231, 61, 162, 34, 52, 250, 178, 136, 115, 115, 25, 168, 1, 129, 142, 238, 8, 184, 151, 234, 94, 126, 211, 175, 143, 100, 183, 238, 6, 244, 7, 41, 222, 1, 102, 64, 199, 99, 38, 198, 244, 145, 83, 255, 13, 29, 85, 127, 61, 140, 19, 92, 249, 76, 44, 191, 58, 248, 61, 44, 225, 154, 72, 215, 182, 148, 43, 16, 22, 29, 133, 37, 177, 95, 129, 176, 36, 129, 90, 244, 54, 43, 16, 22, 237, 225, 37, 177, 255, 27, 38, 183, 224, 140, 178, 26, 189, 95, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130];
var imageData:NSData = NSData(bytes: bytes, length: bytes.count);
var image:UIImage = UIImage(data: imageData);
var imageView:UIImageView = UIImageView(image: image);
I have my way to do it in Swift
if let serverBytesArray = serverAnswer as? NSArray {
var bytes:[Byte] = []
for serverByte in serverBytesArray {
bytes.append(Byte(serverByte as UInt))
}
var data = NSData(bytes: bytes, length: bytes.count);
let tmpDir = NSTemporaryDirectory()
data.writeToFile(tmpDir.stringByAppendingPathComponent("test.pdf"), atomically: true)
}