CPCL command not working with Zebra printer iMZ320 but work with MZ 320 - printing

The CPCL command which is use to communicate with Zebra Printer MZ 320 is
not working with iMZ 320 model.
Following is the CPCL command used:
Works with MZ 320 but not with iMZ 320
var testPrint = '! 0 200 200 210 1 \r\n' + 'TEXT 4 0 200 100 TESTPRINT' + ' \r\n' + 'FORM \r\n' + 'PRINT\r\n';
Works for both MZ 320 and iMZ 320
var barcodeTxt = "123456789";
var barcode = '! 0 200 200 210 1 \r\n' + 'BARCODE 128 1 1 50 150 10 ' + barcodeTxt + ' \r\n' + 'TEXT 7 0 210 60 ' + barcodeTxt + ' \r\n' + 'FORM \r\n' + 'PRINT\r\n';
It will be helpful if someone provided the solution.
Thanks in Advance.

try
var testPrint = '\r\n! 0 200 200 210 1 \r\n' + 'TEXT 4 0 200 100 TESTPRINT' + ' \r\n' + 'FORM \r\n' + 'PRINT\r\n';

Make sure that the iMZ320 is in line mode as it may come configured differently due to the different architecture and application. Also you may have to calibrate the printer for the Mark media you use (see the printer manual).

Related

unmapped reads using bwa

i'm trying to use BWA MEM to align some WGS files, but i notice something strange.
When I used samtools flagstat to check these .bam files, I notice that most reads were unmapped.
76124692 + 0 in total (QC-passed reads + QC-failed reads)
308 + 0 secondary
0 + 0 supplementary
0 + 0 duplicates
708109 + 0 mapped (0.93% : N/A)
76124384 + 0 paired in sequencing
38062192 + 0 read1
38062192 + 0 read2
0 + 0 properly paired (0.00% : N/A)
12806 + 0 with itself and mate mapped
694995 + 0 singletons (0.91% : N/A)
11012 + 0 with mate mapped to a different chr
1682 + 0 with mate mapped to a different chr (mapQ>=5)
Previously, I used Samtofastq to convert my .bam file to .fastq. When I head this file, this is shown:
#SRR1513845.100000000/1
AACGAAACGAAAAGAAAAGAAAAGAAAGAAAAAGAAAGGAACAGAAAAG
+
AAA?=>'2&)&)&&))2(-'(,.%)&31%%'6/6,(1,501046124&6
#SRR1513845.100000000/2
AATTAATTAAGCCCCGAAGGAAGCGAGAAACACTG
+
AAA?B=AB#A#A=?A>AA#?.#?8<.1;><*17?<
#SRR1513845.100000001/1
TATAACCATATAACAAATCCAAGCCCAACAGAGAAGAGAAACAAAAAGA
+
>27<#>&856;.'.&9.%>%::-5194&:+'5);;%1&'/%%999%5(8
#SRR1513845.100000001/2
TCCAACTGATATCGTAATT
+
#3<#A>:8;?:383>=3:=
#SRR1513845.100000003/1
TATCGGTCTTGTTTAG
+
=1;=6?(4>4A13?0A
#SRR1513845.100000003/2
TTCAGGTGCCTCGAAGTTGGATAAGG
+
==>>9#;?3<A5>7);)<9-<25<9?
#SRR1513845.100000004/1
GTCATTTAGCCCAAGAGAATGGC
+
BB#ABA##A?</A>>25A;#4:5
#SRR1513845.100000004/2
GGAGATCGAGTCAAATTTTATGCTAGGTAT
+
%A:<#7A##=4AA?7<A5>#;3&?>>:;:>
#SRR1513845.100000012/1
GCGTCGTTATCCAAAA
+
>A:9:?88=<=0&>>9
#SRR1513845.100000012/2
TGGAAATATTTATTACCCCCCCCCCCCCCCCCCCCCCCCCC
+
A;>#A;4;=??8=:#;-4<?632;=:67;>=):9>9%88=9
#SRR1513845.100000016/1
CGTGGAATGGGGTGTGATTTAATTATCGAATGGCGTCCGATCCAGATT
These characters (<.#;:) are normal and influence in bwa's alignment?
Here is my bwa code:
bwa mem -M -t 38 -p hsa_GRCh38.fa SRR1513_fastqtosam.fq -o SRRR1513_aligned.bam
and my samtofastq code
java -Xmx8G -jar picard.jar SamToFastq \
I= SRR1513_fastqtosam.bam \
FASTQ= SRR1513_fastqtosam.fq \
CLIPPING_ATTRIBUTE=XT \
CLIPPING_ACTION=2 \
INTERLEAVE=true \
NON_PF=true TMP_DIR=./temp
I'm stuck in this from a few hours.
Thanks in advance!
UPDATE:
I just notice a flag during bwa mem alignment
[M::mem_pestat] skip orientation FF as there are not enough pairs
[M::mem_pestat] skip orientation RF as there are not enough pairs
[M::mem_pestat] skip orientation FR as there are not enough pairs
[M::mem_pestat] skip orientation RR as there are not enough pairs

receive 10002 error from paypal doDirectPaymentMethod

i send a request http://api-3t.paypal.com/nvp/ but i receive the 10002 error and my api signature and username and password is true
the invoice number is 10 digit number that is created in random C#.
my code is :
string strNVP = "METHOD=DoDirectPayment" +
"&VERSION=" + ApiVersion +
"&PWD=" + ApiPassword +
"&USER=" + ApiUsername +
"&SIGNATURE=" + ApiSignature +
"&PAYMENTACTION=Sale" +
"&IPADDRESS=151.243.189.92" +
"&RETURNFMFDETAILS=0" +
"&CREDITCARDTYPE=" + creditCard.type +
"&ACCT=" + creditCard.number +
"&EXPDATE=" + expirationMonth + "20" + expirationYear +
"&CVV2=" + creditCard.cvv2 +
"&STARTDATE=" +
"&ISSUENUMBER=" +
"&EMAIL=MatinF#outlook.com" +
//the following represents the billing details
"&FIRSTNAME=" + billingFirstName +
"&LASTNAME=" + billingLastName +
"&STREET=" + billingAddress1 +
"&STREET2=" + "" +
"&CITY=" + Address[8].ToString() +
"&STATE=" + stateName +
"&COUNTRYCODE=SW" +
"&ZIP=" + Address[5].ToString() +
"&AMT=" + TotalPrice +//orderdetails.GrandTotal.ToString("0.0")+
"&CURRENCYCODE=SEK" +
"&DESC=Test Sale Tickets" +
"&INVNUM=" + InvoiceNumber;
this appears to be a limit issue based on the recipient, version 122 for doDirect APIs update.
(10002) You've exceeded the receiving limit. This transaction can't be completed
Click here for more info

How to avoid Restart Bluetooth Printer after print?

I have developed windows mobile 6.1 application which search nearby Bluetooth devices and send files.Also I did print functionality to print document on Bluetooth printer.
First time print functionality is working perfectly fine but when I print the document again, then I need to restart the printer and then after it will print.
Is there any solution to avoid restart printer??
Below is my print code from reference of https://32feet.codeplex.com/discussions/355451
private void btPrint_Click(object sender, EventArgs e)
{
// Activate BT
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable;
System.Threading.Thread.Sleep(1000);
// Connect
BluetoothAddress btAddress;
btAddress = BluetoothAddress.Parse("0022583165F7");
BluetoothClient btClient = new BluetoothClient();
try
{
btClient.Connect(new BluetoothEndPoint(btAddress, BluetoothService.SerialPort));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
// Send data
string CPCLStr1 =
"! 0 200 200 210 1" + Environment.NewLine +
"ML 25" + Environment.NewLine +
"TEXT 7 0 10 20" + Environment.NewLine +
"Just" + Environment.NewLine +
"Testing" + Environment.NewLine +
"ENDML" + Environment.NewLine +
"FORM" + Environment.NewLine +
"PRINT" + Environment.NewLine;
// Convert CPCL String to byte array
byte[] CPCLbytes1 = ASCIIEncoding.ASCII.GetBytes(CPCLStr1);
NetworkStream ns = btClient.GetStream();
ns.Write(CPCLbytes1, 0, CPCLbytes1.Length);
btClient.Close();
}
Although you close the client stream, the printer seems to wait some time before it resets it's session.
Try to send a <EOF> or <EOT> byte at the end.
Acording to CPCL reference guide there is no simple reset command as with ESC/p for example ({esc}#).
Doing a device reset after every print seems an overkill.
EDIT: SDK sample for sendFile:
Byte[] cpclLabel = Encoding.Default.GetBytes("! 0 200 200 406 1\r\n" + "ON-FEED IGNORE\r\n"
+ "BOX 20 20 380 380 8\r\n"
+ "T 0 6 137 177 TEST\r\n"
+ "PRINT\r\n");
The above runs fine on my RW420 without the need to reset between prints.

Try to simulate a neural network in MATLAB by myself

I tried to create a neural network to estimate y = x ^ 2. So I created a fitting neural network and gave it some samples for input and output. I tried to build this network in C++. But the result is different than I expected.
With the following inputs:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 -1
-2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71
and the following outputs:
0 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400
441 484 529 576 625 676 729 784 841 900 961 1024 1089 1156 1225 1296
1369 1444 1521 1600 1681 1764 1849 1936 2025 2116 2209 2304 2401 2500
2601 2704 2809 2916 3025 3136 3249 3364 3481 3600 3721 3844 3969 4096
4225 4356 4489 4624 4761 4900 5041 1 4 9 16 25 36 49 64 81 100 121 144
169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841
900 961 1024 1089 1156 1225 1296 1369 1444 1521 1600 1681 1764 1849
1936 2025 2116 2209 2304 2401 2500 2601 2704 2809 2916 3025 3136 3249
3364 3481 3600 3721 3844 3969 4096 4225 4356 4489 4624 4761 4900 5041
I used fitting tool network. with matrix rows. Training is 70%, validation is 15% and testing is 15% as well. The number of hidden neurons is two. Then in command lines I wrote this:
purelin(net.LW{2}*tansig(net.IW{1}*inputTest+net.b{1})+net.b{2})
Other information :
My net.b[1] is: -1.16610230053776 1.16667147712026
My net.b[2] is: 51.3266249426358
And net.IW(1) is: 0.344272596370387 0.344111217766824
net.LW(2) is: 31.7635369693519 -31.8082184881063
When my inputTest is 3, the result of this command is 16, while it should be about 9. Have I made an error somewhere?
I found the Stack Overflow post Neural network in MATLAB that contains a problem like my problem, but there is a little difference, and the differences is in that problem the ranges of input and output are same, but in my problem is no. That solution says I need to scale out the results, but how can I scale out my result?
You are right about scaling. As was mentioned in the linked answer, the neural network by default scales the input and output to the range [-1,1]. This can be seen in the network processing functions configuration:
>> net = fitnet(2);
>> net.inputs{1}.processFcns
ans =
'removeconstantrows' 'mapminmax'
>> net.outputs{2}.processFcns
ans =
'removeconstantrows' 'mapminmax'
The second preprocessing function applied to both input/output is mapminmax with the following parameters:
>> net.inputs{1}.processParams{2}
ans =
ymin: -1
ymax: 1
>> net.outputs{2}.processParams{2}
ans =
ymin: -1
ymax: 1
to map both into the range [-1,1] (prior to training).
This means that the trained network expects input values in this range, and outputs values also in the same range. If you want to manually feed input to the network, and compute the output yourself, you have to scale the data at input, and reverse the mapping at the output.
One last thing to remember is that each time you train the ANN, you will get different weights. If you want reproducible results, you need to fix the state of the random number generator (initialize it with the same seed each time). Read the documentation on functions like rng and RandStream.
You also have to pay attention that if you are dividing the data into training/testing/validation sets, you must use the same split each time (probably also affected by the randomness aspect I mentioned).
Here is an example to illustrate the idea (adapted from another post of mine):
%%# data
x = linspace(-71,71,200); %# 1D input
y_model = x.^2; %# model
y = y_model + 10*randn(size(x)).*x; %# add some noise
%%# create ANN, train, simulate
net = fitnet(2); %# one hidden layer with 2 nodes
net.divideFcn = 'dividerand';
net.trainParam.epochs = 50;
net = train(net,x,y);
y_hat = net(x);
%%# plot
plot(x, y, 'b.'), hold on
plot(x, x.^2, 'Color','g', 'LineWidth',2)
plot(x, y_hat, 'Color','r', 'LineWidth',2)
legend({'data (noisy)','model (x^2)','fitted'})
hold off, grid on
%%# manually simulate network
%# map input to [-1,1] range
[~,inMap] = mapminmax(x, -1, 1);
in = mapminmax('apply', x, inMap);
%# propagate values to get output (scaled to [-1,1])
hid = tansig( bsxfun(#plus, net.IW{1}*in, net.b{1}) ); %# hidden layer
outLayerOut = purelin( net.LW{2}*hid + net.b{2} ); %# output layer
%# reverse mapping from [-1,1] to original data scale
[~,outMap] = mapminmax(y, -1, 1);
out = mapminmax('reverse', outLayerOut, outMap);
%# compare against MATLAB output
max( abs(out - y_hat) ) %# this should be zero (or in the order of `eps`)
I opted to use the mapminmax function, but you could have done that manually as well. The formula is a pretty simply linear mapping:
y = (ymax-ymin)*(x-xmin)/(xmax-xmin) + ymin;

Can I write reverse div operator?

I have a mathematical equation and How can I find the it's reverse ?
My equation:
var
x,y:integer;
begin
//example x=1234;
x-(x div 100):=y
end;
after the code I konw "y" how can I find the "x"?(1234)
In general, you can't. Since div does integer division, there are potentially many inputs that can/will produce the same result. Starting from that result, and of those inputs is an equally likely possibility as the original input. For example:
175 div 7 = 25
176 div 7 = 25
177 div 7 = 25
178 div 7 = 25
179 div 7 = 25
180 div 7 = 25
181 div 7 = 25
Starting from 25, any of those numbers from 175 to 181 would be an equally viable answer.

Resources