Re: [PLUG] Sort numbers in 'natural' order

2015-05-31 Thread Russell Senior
> "Rich" == Rich Shepard  writes:

Rich>   [...] Using -g (general sort), [...]

I want to take this opportunity to personally take credit for the -g
option to sort.  The patch that added this was at my behest, it
interpretted numbers in scientific notation.

commit 34fc818d7edaefcc4a420f1da3b7002d35aa4103
Author: Jim Meyering 
Date:   Wed Nov 15 21:42:47 1995 +

Add support for sorting numbers in scientific notation.
Include xstrtod.h.
(struct keyfield): Add field: general_numeric.
(usage): Describe -g option.
(general_numcompare): New function.
(keycompare): Use new comparison function when general_numeric
flag is set.
(set_ordering): Honor `g' flag.
(main): Initialize and use new field.
From Marcus Daniels .

Marcus was working for us at the time.  It is much slower than a normal
sort, but if you need to sort scientific notation, it's real helpful.


-- 
Russell Senior, President
russ...@personaltelco.net
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Sort numbers in 'natural' order

2015-05-31 Thread Roderick A Anderson
Well I didn't think it up my self so I had to look it up again.

http://larsmichelsen.com/open-source/quickie-sort-ip-addresses-on-linux-command-line-bash/

Rod
-- 


On May 31, 2015 10:55:44 AM Rich Shepard  wrote:

> On Sun, 31 May 2015, Roderick Anderson wrote:
>
> > I think this is the solution.  Been a long time since I looked at the
> > (very long pipe) script it was in so YMMV.
> >
> >sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n
>
> Rod,
>
>Thanks! That does the trick. I don't understand the keydefs, but as long
> as it does the job I'll take it on faith. :-)
>
> Much appreciated,
>
> Rich
> ___
> PLUG mailing list
> PLUG@lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug


___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Sort numbers in 'natural' order

2015-05-31 Thread Rich Shepard
On Sun, 31 May 2015, Roderick Anderson wrote:

> I think this is the solution.  Been a long time since I looked at the
> (very long pipe) script it was in so YMMV.
>
>sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n

Rod,

   Thanks! That does the trick. I don't understand the keydefs, but as long
as it does the job I'll take it on faith. :-)

Much appreciated,

Rich
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Sort numbers in 'natural' order

2015-05-31 Thread Rich Shepard
On Sun, 31 May 2015, Atom Powers wrote:

> And the solution I'm aware of its too convert the dotted-quad to hex, sort
> it, and then convert it back. Or just use a programming library (perl,
> ruby, python, etc.) to do the sorting  for you.

   Thanks, Atom.

Rich
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Sort numbers in 'natural' order

2015-05-31 Thread Roderick Anderson
Rich,

I think this is the solution.  Been a long time since I looked at the 
(very long pipe) script it was in so YMMV.

sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n


Rod
-- 
On 05/31/2015 10:25 AM, Rich Shepard wrote:
> Thought I found the correct option for sorting CIDR IP addresses, but
> apparently haven't.
>
> Using -g (general sort), -h (human readable sort), and -n (numeric sort)
> all leave xxx.11 following xxx.100. I thought one of these would put them in
> the same order as would us carbon forms.
>
> Is there such an option to sort that I've missed?
>
> Rich
> ___
> PLUG mailing list
> PLUG@lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Sort numbers in 'natural' order

2015-05-31 Thread Atom Powers
And the solution I'm aware of its too convert the dotted-quad to hex, sort
it, and then convert it back. Or just use a programming library (perl,
ruby, python, etc.) to do the sorting  for you.

On Sun, May 31, 2015, 10:29 Atom Powers  wrote:

> I think this means sort sees the dot and assumes it is a string, which
> doesn't sort numerically.
>
> On Sun, May 31, 2015, 10:26 Rich Shepard  wrote:
>
>>Thought I found the correct option for sorting CIDR IP addresses, but
>> apparently haven't.
>>
>>Using -g (general sort), -h (human readable sort), and -n (numeric
>> sort)
>> all leave xxx.11 following xxx.100. I thought one of these would put them
>> in
>> the same order as would us carbon forms.
>>
>>Is there such an option to sort that I've missed?
>>
>> Rich
>> ___
>> PLUG mailing list
>> PLUG@lists.pdxlinux.org
>> http://lists.pdxlinux.org/mailman/listinfo/plug
>>
>
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Sort numbers in 'natural' order

2015-05-31 Thread Atom Powers
I think this means sort sees the dot and assumes it is a string, which
doesn't sort numerically.

On Sun, May 31, 2015, 10:26 Rich Shepard  wrote:

>Thought I found the correct option for sorting CIDR IP addresses, but
> apparently haven't.
>
>Using -g (general sort), -h (human readable sort), and -n (numeric sort)
> all leave xxx.11 following xxx.100. I thought one of these would put them
> in
> the same order as would us carbon forms.
>
>Is there such an option to sort that I've missed?
>
> Rich
> ___
> PLUG mailing list
> PLUG@lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


[PLUG] Sort numbers in 'natural' order

2015-05-31 Thread Rich Shepard
   Thought I found the correct option for sorting CIDR IP addresses, but
apparently haven't.

   Using -g (general sort), -h (human readable sort), and -n (numeric sort)
all leave xxx.11 following xxx.100. I thought one of these would put them in
the same order as would us carbon forms.

   Is there such an option to sort that I've missed?

Rich
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] QR Code generator with text label

2015-05-31 Thread Chuck Hast
OK, I have a boat load of info here, now to try it all and see what works,
if any
one has anymore recommendations I am all ears.

What I want to have visible on the label is the QR code and a brief descrip-
tion of the labeled item along with the P#. The QR code will have the full
des-
cription and the next step will be to capture the info into the parts db so
that
as we use parts off of the vehicles all we have to do is image the QR code
and the part is noted and removed, but first step is to get the labels so
that
I can label the parts.

Thanks folks for all of this great info.

On Sun, May 31, 2015 at 9:39 AM, Galen Seitz  wrote:

> On 05/30/15 21:33, Chuck Hast wrote:
> > I have been looking for something that will generate QR codes to
> > create labels, I also want to add a short human readable line on
> > the label but so far I have not found a single step Linux solution to
> > do so.  What I want is the QR code and above or below it a short
> > human readable description. I can find windows stuff that will do it
> > and I can find some on line generators, but not sure that they would
> > like it if I did a whole parts inventory.
> >
> > I see some people have used other applications to overlay the QR
> > code onto something with the text or vice versa, but I want something
> > that is reasonably simple to use and runs on Linux so that I can set
> > it up for non-tech types to use.
>
>
> I agree with Michael R.  It sounds like a job for Imagemagick.  Generate
> the QR png file, then use convert to add the text.
>
> http://www.imagemagick.org/Usage/annotating/>
>
>
> galen
> --
> Galen Seitz
> gal...@seitzassoc.com
> ___
> PLUG mailing list
> PLUG@lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



-- 

Chuck Hast  -- KP4DJT --
Glass, five thousand years of history and getting better.
The only container material that the USDA gives blanket approval on.
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] QR Code generator with text label

2015-05-31 Thread Galen Seitz
On 05/30/15 21:33, Chuck Hast wrote:
> I have been looking for something that will generate QR codes to
> create labels, I also want to add a short human readable line on
> the label but so far I have not found a single step Linux solution to
> do so.  What I want is the QR code and above or below it a short
> human readable description. I can find windows stuff that will do it
> and I can find some on line generators, but not sure that they would
> like it if I did a whole parts inventory.
> 
> I see some people have used other applications to overlay the QR
> code onto something with the text or vice versa, but I want something
> that is reasonably simple to use and runs on Linux so that I can set
> it up for non-tech types to use.


I agree with Michael R.  It sounds like a job for Imagemagick.  Generate
the QR png file, then use convert to add the text.

http://www.imagemagick.org/Usage/annotating/>


galen
-- 
Galen Seitz
gal...@seitzassoc.com
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] QR Code generator with text label

2015-05-31 Thread John Jason Jordan
On Sat, 30 May 2015 21:33:29 -0700
Chuck Hast  dijo:

>I have been looking for something that will generate QR codes to
>create labels, I also want to add a short human readable line on
>the label but so far I have not found a single step Linux solution to
>do so.  

Scribus (since 1.4.3) has the ability to create QR codes in its barcode
generator utility. You'd have to add the text line manually, though.
And then export both as whatever form you want the ultimate output.

I also believe LibreOffice can generate QR codes, although it might
require installing an extension.
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] QR Code generator with text label

2015-05-31 Thread Bill Barry
On Sat, May 30, 2015 at 10:59 PM, Chuck Hast  wrote:
> Qrencode (cmd line tool) generates png files, Qreator (gui tool) generates
> png files too. I think I will see if I can take a look at the source of
> qreator and
> see how hard it might be to "bend" it to do a line of text adjacent to the
> QR
> code. If I can do that, i have my solution, put it on some older computers
> and
> add a label printer and done. The Brother QL-570 will work quite well and
> Brother has a nice set of Linux/Unix drivers for their products. Worse case
> is
> I create the QR codes and use Gimp to put them into something that has a
> text line on it , then turn the whole thing into a small file to be
> printed. I do
> one for each piece of hardware I need to label.
>

Here is a python script I wrote a while back that does something like
you want.. The QR code is a URL (https://example.com/stuff/rack/1) and
there is some txt  "rack 1" underneath it. It has been a while since I
wrote it, so it looks like gibberish to me.

Bill

from PIL import Image, ImageDraw,ImageFont
import qrcode

qr = qrcode.QRCode(
version=3,
error_correction=qrcode.constants.ERROR_CORRECT_Q,
box_size=10,
border=4,
)

image  = Image.new( "RGBA", ( 410, 480 ) ,"white");

qr.add_data('https://example.com/stuff/rack/1')
qr.make(fit=True)

img = qr.make_image()
print img.size
image.paste(img, (0,0), img.convert("RGBA") );


draw = ImageDraw.Draw(image)
font = ImageFont.truetype("/usr/lib/cinelerra/fonts/arial.ttf",60)
#font = ImageFont.load_default()
txt = "rack 1"
draw.text((100, 410), txt, (0,0,0), font=font)


image.save("qr.png")
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] QR Code generator with text label

2015-05-31 Thread Rich Shepard
On Sat, 30 May 2015, Chuck Hast wrote:

> I have qrencode on my machine and have been playing around with it, I also
> have qreator which is a gui, but both of them just generate the QR code,
> so I will have to figure out what I can do to merge a QR code with a short
> line of text for the label.

Chuck,

   The python print() function will produce that text line. Put it all in a
simple script and you can place the text either above or below the QR code.

Rich
___
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug