Printing on two labels at the same time with ZPL - zebra-printers

I have a roll of labels that are 5,1cm x 1,6cm (two per row) and I need to print two different labels on each row (expected result), but the print command of the ZPL format only prints one label and feeds the next, leaving the adjacent label blank.
This is the ZPL code that I have:
^XA
~TA000
~JSN
^LT0
^MNW
^MTT
^PON
^PMN
^LH0,0
^JMA
^PR8,8
~SD15
^JUS
^LRN
^CI27
^PA0,1,1,0
^XZ
^XA
^MMT
^PW871
^LL152
^LS0
^BY2,3,60^FT23,73^B3N,N,,N,N
^FDId_bono^FS
^FT90,120^A0N,47,46^FB220,1,12,C^FH\^CI28^FDId_bono^FS^CI27
^PQ1,,,Y
^XZ
I believe that I need to add in this label a shift to print side by side label-1 and label-2 and print two at I time, but I cannot figure out how to add a side-shift in the label.

You have to print both labels as a single format, using ^LH to shift the second label to the right the appropriate number of dots. Basically, something like:
^XA
^LH0,0
... left label here ...
^LHnnn,0
... right label here ...
^LH0,0
^XZ
The first and third ^LH commands reset the home position. The second ^LH shifts it to the right nnn dots.

Related

Subfigures in latex never shrinks to be on one row (pfd file)

I'm trying to adjust two subfigures into one row. This is my code:
\begin{figure}[ht]
\centering
\caption{Migration rates and nightlights in Albania in 1992-1995}
\begin{subfigure}[a]{0.3\textwidth}
\caption{Emigration rate before 1995 at the municipality level}
\label{fig: migration_rate}
\includegraphics[width=\linewidth, trim = 5cm 0cm 5cm 0cm, clip]{Figures/migration_rate.pdf}
\end{subfigure}
\begin{subfigure}[b]{0.3\textwidth}
\caption{Night luminosity in 1992}
\label{fig: nighlights}
\includegraphics[width=\linewidth, trim = 5cm 0cm 5cm 0cm, clip]{Figures/nightlight.pdf}
\end{subfigure}
\caption*{\footnotesize{\textbf{Notes}:}}.
\end{figure}
enter image description here
Even if I shrink the subfigure to tiny size (for example {0.01\textwidth}), the two always appear in one column. I have deep blank space on the left and right of both figures that I have tried to trim. Including or excluding "trim" does not change much.
How do I get the two into one row?
Thank you!

Find cursor's coordinates in NSTextView

I have wrapping NSTextView instances stacked vertically, for example:
The quick brown fox
jumps over the lazy dog
Jackdaws love my big
sphinx of quartz
I need to move between them with up/down arrows. For example, when the cursor is positioned after the l in "lazy" and the user presses the down arrow, the cursor should jump right after the y in "my" – like it would do if these sentences were in the same text view.
By default, when the down arrow is pressed while the cursor is at the last wrapped line, a text view moves it to the end of that line. While I can use textView(_:doCommandBy:) in NSTextViewDelegate to detect the "arrow down" selector and override the default behavior, there are two problems:
I can determine if the cursor is at the last line by getting its position via the selectedRanges property and then checking for the newline character after this position, but it is not possible to know if it is at the last wrapped line, i.e. near the border of the current text view.
I need to know the X coordinate of the cursor to place it at approximately the same X coordinate in another text view (the fonts won't necessarily be fixed-width, so I can't rely on the character count).
I suppose both of them can be resolved via NSLayoutManager, but I can't wrap my head around all of its available methods.
It turned out to be relatively easy, here's what I've done (the examples are in C#). First, boundingRect(forGlyphRange:in:) gets the cursor's location in the current view:
var cursorLocation = new NSRange(CurrentTextView.SelectedRange.Location, 0);
var cursorCoordinates = CurrentTextView.LayoutManager.BoundingRectForGlyphRange(cursorLocation, CurrentTextView.TextContainer).Location;
Then if the second text view is below, the insertion point will be at 0 on the Y axis:
var insertionPoint = new CGPoint(cursorCoordinates.X, 0);
And if it is above, then another view's height should be used (reduced by 1, otherwise the resulting character index will be incorrect and the cursor will be placed at the end of the line):
var insertionPoint = new CGPoint(cursorCoordinates.X, AnotherTextView.Bounds.Size.Height - 1);
After getting the insertion point, another view needs to become the first responder and then characterIndexForInsertion(at:) does the job:
Window.MakeFirstResponder(AnotherTextView);
var index = AnotherTextView.CharacterIndex(insertionPoint);
AnotherTextView.SelectedRange = new NSRange(index, 0);

BIRT - How to insert different data set rows in different places in a single text element

I'm developing a BIRT report and this is my situation.
I have one text element, let's say this:
blue square: 111
blue triangle: 222
red circle: 333
At the moment is static, and always displays the numbers you see. I would like to make the numbers dynamic so I created a SQL query and I have embedded it in a dataset. Let's say this is the output:
color shape count
blue square 123
red circle 456
blue triangle 789
I would like to set it up in such a way that each data set row matches the correct row in the text file, so it would become:
blue square: 123
blue triangle: 456
red circle: 789
And will be automatically updated.
I've binded the text element with the dataset and wrote this as a test:
blue square: <VALUE-OF>if (row["color"].toUpperCase() == "BLUE") { row["count"] }</VALUE-OF>
blue triangle: 222
red circle: 333
But when I run the report it doesn't work and the value is blank.
What am I doing wrong?
Thank you all for the help and let me know if you need more info.
You now have a dataset with row[color], row[shape], row[count] to simplify your desired output I would add a "computed column" to your dataset.
e.g. row[output] = row[color] + ' ' + row[shape] + ': ' row[count]
Once you added the computed column just drag and drop your dataset into your report (where you now have the text element) and delete the unused columns.
Tip: if don't know "computed columns":
  use Google image search for "bird computed column example"
  the Google text search might get you lost in birt forum lists.
Update:
It’s possible you have some typo in your scriptlet. In BIRT a scriptlet resolves to the last expression within itself.
Your scrptlet <VALUE-OF>if (foo) { bar }</VALUE-OF> doesn’t have a last expression. (It's not wrong but BIRT may not "understand" it this way) Try instead <VALUE-OF>var result = ''; if (foo) { result = bar }; result;</VALUE-OF> and format the scriptlet to several code lines with result; as last line. This is the same as if we consider the scriptlet as a function in some programming language and the last line of the function would be return result.

d3js Multiline ... How can I have the Y values?

I am using this sample that is very nice ...
http://bl.ocks.org/aiMojica10/7a3a9233f3bcd60f0c3935c5875e850d
Partidos followers
or the sample ...
http://bl.ocks.org/asielen/44ffca2877d0132572cb
We can see the values of "Y" being updated as we move the mouse. But, I would like to know how to display the legend and values at the top of the chart, for example next to the caption "Day:" or "Year" in the samples ?
In other words, I would like all values of Y in separeted variables.
Well, what I need to change in the multiline.js ?
Thanks,

use text column from data file as points label in gnuplot

I have a data file consisting of 2 columns with a name and value in it.
foo 0.1
bar 0.2
fff 0.4
bbb 0.7
I want to plot this and annotate the text entry next to the data point.
I tried
plot 'file' using 1:2 with labels
but it didn't work. I guess the proble is that I have to rely on gnuplot using only the second column for y and equally spacing the x axis.
You can do something like
plot 'file' using 0:2 title 'title', \
'' using 0:2:1 with labels offset 0,char 1
This will first plot the data normally, then plot with labels on top, offset up by one character. The 0 column is a dummy column which gives an index to the data--0 for the first data point, 1 for the second, etc.
Another alternative would be to plot using a histogram.

Resources