GNUPlot: From 3D scatter plot to Countour map - c#

Given the following list of x,y,z points (z is actually a signal strength indicator in dBm):
63 371 -21
142 371 -9
233 374 -18
288 371 -36
310 373 -38
349 374 -39
415 348 -44
507 334 -49
689 337 -56
635 254 -57
422 284 -42
380 278 -39
281 280 -39
214 299 -34
146 285 -30
81 302 -39
76 246 -39
80 214 -44
137 200 -44
64 134 -48
73 87 -48
200 101 -46
230 202 -44
246 105 -53
285 109 -53
278 191 -50
334 87 -54
395 189 -56
513 208 -58
510 99 -61
553 101 -62
593 100 -65
634 101 -64
679 102 -68
731 196 -70
I can quite easily generate a 3D scatter plot using this command in gnuplot:
splot "C:/path/to/points.dat" with points
What I'm really after is a way to "fill in the gaps" and create a surface. The ultimate goal is to use data like the points shown above to generate an RF map for a given WiFi access point. The resulting map would be used to calculate the possible locations of a device, given its RSSI (received signal strength indicator).
(Several APs and their associated RF maps will be used, however I don't think the specifics are relevant to this question.)
What would be the best way to interpolate the z-values (RSSI in dBm, in this case) for the remaining points?
EDIT :
I seem to have made some progress. Using set dgrid3d 50,100 splines before the splot command seems to generate more or less what I'm looking for. So the next question is: how can I replicate this kind of function in code (C#, ideally)?

Related

Can Photoshop Caption Digest metadata be added by another program?

I have to analyse a picture and figure out if it has been modified by Photoshop. Using MetadataExtractor I got the following information (in the format of Directory:TagName=TagDescription):
JPEG:Data Precision=8 bits
JPEG:Image Height=1600 pixels
JPEG:Image Width=1200 pixels
JPEG:Number of Components=3
JPEG:Component 1=Y component: Quantization table 0
Sampling factors 2 horiz/2 vert
JPEG:Component 2=Cb component: Quantization table 1
Sampling factors 1 horiz/1 vert
JPEG:Component 3=Cr component: Quantization table 1
Sampling factors 1 horiz/1 vert
JFIF:Version=1.1
JFIF:Resolution Units=none
JFIF:X Resolution=72 dots
JFIF:Y Resolution=72 dots
JFIF:Thumbnail Width Pixels=0
JFIF:Thumbnail Height Pixels=0
Exif IFD0:Orientation=Top
left side (Horizontal / normal)
Exif SubIFD:Color Space=sRGB
Exif SubIFD:Exif Image Width=1200 pixels
Exif SubIFD:Exif Image Height=1600 pixels
Photoshop:Caption Digest=212 29 140 217 143 0 178 4 233 128 9 152 236 248 66 126
File:File Name=mypicture.jpg
File:File Size=175794 bytes
File:File Modified Date=Thu Sep 29 14:22:44 +02:00 2016
Now, question is: can the Photoshop:Caption Digest=212 29 140 217 143 0 178 4 233 128 9 152 236 248 66 126 metadata be generated by a program that is NOT Photoshop? Or is it an evidence that the image was photoshopped?

How to Export data from WebBrowser to Excel using C#?

I have taken the data from a web browser. Now I want to export the data from the web browser to excel.
I get data from web browser such formats:
1
20 143
10 180
1 653
8 310
1 280
1 280
1 280
1 280
:
:
:
2
19 339
9 800
1 767
7 773
1 280
1 280
1 280
1 280
H2:DA_MI
H2:DA_MI
H2:DA_MI

Unrecognized Ciphers from mobile application

I'm writing an Android application with Xamarin (C#) that makes calls to Exchange Web Services. The code sets the out of office message. The code I have written works from a standard Windows Forms application, but fails with a "Request Invalid" SOAP exception. I've captured the requests using Fiddler, and it appears to be a cipher issue.
The Windows Forms request is this:
A SSLv3-compatible ClientHello handshake was found. Fiddler extracted the parameters below.
Version: 3.1 (TLS/1.0)
Random: 53 B1 31 EF DD 96 01 7E 0A 0A 1F 85 60 8F 2F BD D6 77 08 2D B0 C6 52 91 BC A0 19 2F 20 08 F1
SessionID: empty
Extensions:
renegotiation_info 00
server_name
elliptic_curves secp256r1 [0x17], secp384r1 [0x18]
ec_point_formats uncompressed [0x0]
Ciphers:
[002F] TLS_RSA_AES_128_SHA
[0035] TLS_RSA_AES_256_SHA
[0005] SSL_RSA_WITH_RC4_128_SHA
[000A] SSL_RSA_WITH_3DES_EDE_SHA
[C013] TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA
[C014] TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA
[C009] TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
[C00A] TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
[0032] TLS_DHE_DSS_WITH_AES_128_SHA
[0038] TLS_DHE_DSS_WITH_AES_256_SHA
[0013] SSL_DHE_DSS_WITH_3DES_EDE_SHA
[0004] SSL_RSA_WITH_RC4_128_MD5
Compression:
[00] NO_COMPRESSION
The Android request is this:
A SSLv3-compatible ClientHello handshake was found. Fiddler extracted the parameters below.
Version: 3.1 (TLS/1.0)
Random: 53 B1 30 9C 9A A2 AE 57 A9 98 A3 C8 DF 94 E0 04 1D 3F E1 34 A8 8A DF 8B 5E 8B 60 67 96 6D 1B
SessionID: empty
Extensions:
server_name
Ciphers:
[0035] TLS_RSA_AES_256_SHA
[002F] TLS_RSA_AES_128_SHA
[000A] SSL_RSA_WITH_3DES_EDE_SHA
[0005] SSL_RSA_WITH_RC4_128_SHA
[0004] SSL_RSA_WITH_RC4_128_MD5
[0009] SSL_RSA_WITH_DES_SHA
[0003] SSL_RSA_EXPORT_WITH_RC4_40_MD5
[0006] SSL_RSA_EXPORT_WITH_RC2_40_MD5
[0008] SSL_RSA_EXPORT_WITH_DES40_SHA
[0060] Unrecognized cipher - See http://www.iana.org/assignments/tls-parameters/
[0061] Unrecognized cipher - See http://www.iana.org/assignments/tls-parameters/
[0062] TLS_RSA_EXPORT1024_WITH_DES_SHA
[0064] TLS_RSA_EXPORT1024_WITH_RC4_56_SHA
Compression:
[00] NO_COMPRESSION
The "unrecognized cipher" message leaps out here. Any help on how to resolve this issue would be great.
thanks
That two ciphers are not recognized does not mean that there are no ciphers to choose from. Unless the TLS is explicitly broken down further on, it's likely another issue.
I think you are better off looking at the SOAP messages.

Why I have different compression byte array sizes using DeflateStream on different machines

I'm compressing short string on my machine using DeflateStream
public byte[] Compress(byte[] oryginalBytes)
{
using (var msi = new MemoryStream(oryginalBytes))
using (var mso = new MemoryStream())
{
using (var gs = new DeflateStream(mso, CompressionMode.Compress))
{
msi.CopyTo(gs);
}
return mso.ToArray();
}
}
And run this code:
Compress(Encoding.Unicode.GetBytes("[TEST]"));
On my machine (windows 7 64 bit) I get 12 elements byte array:
139 102 8 97 112 101 8 6 146 177 12 0
And running this on my build server (Windows 2008 64bit) I have 120 elements byte array.
236 189 7 96 28 73 150 37 38 47 109 202 123 127 74 245 74 215 224 116 161 8 128 96 19 36 216 144 64 16 236 193 136 205 230 146 236 29 105 71 35 41 171 42 129 202 101 86 101 93 102 22 64 204 237 157 188 247 222 123 239 189 247 222 123 239 189 247 186 59 157 78 39 247 223 255 63 92 102 100 1 108 246 206 74 218 201 158 33 128 170 200 31 63 126 124 31 63 34 190 247 107 188 249 53 78 127 141 215 244 239 247 127 141 255 39 0 0 255 255
Anybody has an idea why this behave so strange?
DeflateStream manual
This class represents the Deflate algorithm, which is an industry-standard algorithm for lossless file compression and decompression. Starting with the .NET Framework 4.5, the DeflateStream class uses the zlib library. As a result, it provides a better compression algorithm and, in most cases, a smaller compressed file than it provides in earlier versions of the .NET Framework.

Why does my text not print?

Realizing that I should be using Line Print mode (as opposed to label mode) for sending CPCL to the Zebra QL 220 belt printer, I'm in the process of refactoring my working code (Why does everything print on the same line, even though I'm adding crlfs?) to this:
serialPort.Write("! 0 200 200 210 1\r\n");
serialPort.Write(string.Format("! U1 setvar {0} {1}", "device.languages", "line_print"));
serialPort.Write("Hallo die Welt\r\n\r\n"); //Bonjour le Monde --- Hola el Mundo --- Hallo die Welt
serialPort.Write("BARCODE-TEXT 7 0 5\r\n");
serialPort.Write(string.Format("BARCODE 128 1 1 50 150 130 {0}\r\n\r\n", barcode));
serialPort.Write("POSTFEED 120\r\n"); // empirical observation shows 120 is about the right amount of extra tape to expel after printing
serialPort.Write("PRINT\r\n");
This prints the barcode and its human-readable number beneath it (the value in "barcode"),but the text "Hallo die Welt" is not printed. Why not? Do I need a call to Print after each line, or...???
UPDATE
It still prints the barcode only (not "Hallo die Welt") with this code:
serialPort.Write("! 0 200 200 210 1\r\n");
serialPort.Write("! U1 SETLP 7 0 24\r\n");
serialPort.Write("Hallo die Welt\r\n\r\n");
serialPort.Write("BARCODE-TEXT 7 0 5\r\n");
serialPort.Write(string.Format("BARCODE 128 1 1 50 150 130 {0}\r\n\r\n", barcode));
serialPort.Write("POSTFEED 120\r\n");
serialPort.Write("PRINT\r\n");
UPDATE 2
This works (label mode):
serialPort.Write("! 0 200 200 210 1\r\n");
serialPort.Write("TEXT 4 0 30 40 Hallo die Welt\r\n\r\n"); //Bonjour le Monde --- Hola el Mundo --- Hallo die Welt
serialPort.Write("BARCODE-TEXT 7 0 5\r\n");
serialPort.Write(string.Format("BARCODE 128 1 1 50 150 130 {0}\r\n\r\n", barcode));
serialPort.Write("POSTFEED 120\r\n");
serialPort.Write("PRINT\r\n");
It prints:
~~~~~~~~~~~~~~~~~~~~~~~
Hallo die Welt
<barcode as a barcode>
<barcode as a number>
~~~~~~~~~~~~~~~~~~~~~~~
...but this doesn't work (line print mode):
serialPort.Write(string.Format("! U1 setvar {0} {1}", "device.languages", "line_print"));
serialPort.Write("! U1 SETLP 7 0 24\r\n");
serialPort.Write("Hallo die Welt\r\n\r\n");
serialPort.Write("! U1 BARCODE-TEXT 7 0 5\r\n");
serialPort.Write(string.Format("! U1 BARCODE 128 1 1 50 150 130 {0}\r\n\r\n", barcode));
serialPort.Write("! U1 SETLP 5 2 46");
serialPort.Write(barcode);
serialPort.Write("! U1 PRINT\r\n");
The problem is, I need to use Line Print mode.
You also need a \r\n after every SGD command (your setvar in this case)
It should be
! U1
setvar "device.languages" "line_print"\r\n
You also need to put the double quotes around the 2 parameters of the SETVAR command.
UPDATE:
oh, btw, just because the printer is in line_print mode, doesn't mean that it doesn't understand CPCL code. So the code above in your example is CPCL code, not just line print. If you put TEXT in front, it should work

Categories