pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedHex representation
10+ messages / 9 participants
[nested] [flat]
* Hex representation
@ 2008-09-24 19:20 Carol Walter <walterc@indiana.edu>
0 siblings, 3 replies; 10+ messages in thread
From: Carol Walter @ 2008-09-24 19:20 UTC (permalink / raw)
To: pgsql-admin
Hello,
Does anyone know what the format of hex characters for postgres are?
I'm trying to create files that contain a 0x55. It looks to me like
it should require a delimiter of some sort between the characters. I
don't know how postgres would know that the string was a hex
representation and not just a character zero, followed by a character
x, followed by a character 5, followed by a character 5.
Carol
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-24 19:32 Milen A. Radev <milen@radev.net>
parent: Carol Walter <walterc@indiana.edu>
2 siblings, 0 replies; 10+ messages in thread
From: Milen A. Radev @ 2008-09-24 19:32 UTC (permalink / raw)
To: pgsql-admin
Carol Walter написа:
> Hello,
>
> Does anyone know what the format of hex characters for postgres are?
> I'm trying to create files that contain a 0x55. It looks to me like it
> should require a delimiter of some sort between the characters. I don't
> know how postgres would know that the string was a hex representation
> and not just a character zero, followed by a character x, followed by a
> character 5, followed by a character 5.
http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
Look for "Also supported are \digits,..." in section "4.1.2.1. String Constants".
--
Milen A. Radev
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-24 19:43 Scott Marlowe <scott.marlowe@gmail.com>
parent: Carol Walter <walterc@indiana.edu>
2 siblings, 1 reply; 10+ messages in thread
From: Scott Marlowe @ 2008-09-24 19:43 UTC (permalink / raw)
To: Carol Walter <walterc@indiana.edu>; +Cc: pgsql-admin
I used this very simple little php script to make this
filename: mk55:
#!/usr/bin/php -q
<?php
for ($i=0;$i<262144;$i++){
print chr(85);
}
?>
and ran it:
./mk55 > 55
ls -l 55
-rw-r--r-- 1 smarlowe smarlowe 262144 2008-09-24 13:41 55
i.e. it's 256k.
And it's attached.
On Wed, Sep 24, 2008 at 1:20 PM, Carol Walter <walterc@indiana.edu> wrote:
> Hello,
>
> Does anyone know what the format of hex characters for postgres are? I'm
> trying to create files that contain a 0x55. It looks to me like it should
> require a delimiter of some sort between the characters. I don't know how
> postgres would know that the string was a hex representation and not just a
> character zero, followed by a character x, followed by a character 5,
> followed by a character 5.
>
> Carol
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
Attachments:
mk55 (application/octet-stream, 75B) download
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-25 17:40 Steve Crawford <scrawford@pinpointresearch.com>
parent: Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 2 replies; 10+ messages in thread
From: Steve Crawford @ 2008-09-25 17:40 UTC (permalink / raw)
To: Scott Marlowe <scott.marlowe@gmail.com>; +Cc: Carol Walter <walterc@indiana.edu>; pgsql-admin
Scott Marlowe wrote:
> I used this very simple little php script to make this
>
> filename: mk55:
> #!/usr/bin/php -q
> <?php
> for ($i=0;$i<262144;$i++){
> print chr(85);
> }
> ?>
>
Or, using standard *nix tools (Note: 0x55 = ascii U):
dd bs=1k count=256 if=/dev/zero | tr '\000' U > full_of_0x55
Cheers,
Steve
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-25 18:12 Tena Sakai <tsakai@gallo.ucsf.edu>
parent: Steve Crawford <scrawford@pinpointresearch.com>
1 sibling, 0 replies; 10+ messages in thread
From: Tena Sakai @ 2008-09-25 18:12 UTC (permalink / raw)
To: Steve Crawford <scrawford@pinpointresearch.com>; Scott Marlowe <scott.marlowe@gmail.com>; +Cc: Carol Walter <walterc@indiana.edu>; pgsql-admin
Hi Steve,
That's a cool way to do it. I wish I thought of it.
Here's yet another way by java:
public class lotsofhex55 {
public static void main (String[] argv) {
char myHex55;
myHex55 = (char) 0x55;
// replace 256 with 262144 after testing
for (int i = 0; i < 256; i++) {
System.out.print (myHex55);
}
} // end main()
} // end class
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: pgsql-admin-owner@postgresql.org on behalf of Steve Crawford
Sent: Thu 9/25/2008 10:40 AM
To: Scott Marlowe
Cc: Carol Walter; pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Hex representation
Scott Marlowe wrote:
> I used this very simple little php script to make this
>
> filename: mk55:
> #!/usr/bin/php -q
> <?php
> for ($i=0;$i<262144;$i++){
> print chr(85);
> }
> ?>
>
Or, using standard *nix tools (Note: 0x55 = ascii U):
dd bs=1k count=256 if=/dev/zero | tr '\000' U > full_of_0x55
Cheers,
Steve
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-25 18:15 Carol Walter <walterc@indiana.edu>
parent: Steve Crawford <scrawford@pinpointresearch.com>
1 sibling, 1 reply; 10+ messages in thread
From: Carol Walter @ 2008-09-25 18:15 UTC (permalink / raw)
To: Steve Crawford <scrawford@pinpointresearch.com>; +Cc: Scott Marlowe <scott.marlowe@gmail.com>; pgsql-admin
Well, it was a bit convoluted, but I created the file with Excel,
filling the right number of cells with \x55. This worked too. The
script wouldn't run for me. I got an error about a "bad interpreter".
Carol
On Sep 25, 2008, at 1:40 PM, Steve Crawford wrote:
> Scott Marlowe wrote:
>> I used this very simple little php script to make this
>>
>> filename: mk55:
>> #!/usr/bin/php -q
>> <?php
>> for ($i=0;$i<262144;$i++){
>> print chr(85);
>> }
>> ?>
>>
> Or, using standard *nix tools (Note: 0x55 = ascii U):
> dd bs=1k count=256 if=/dev/zero | tr '\000' U > full_of_0x55
>
> Cheers,
> Steve
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-25 18:39 Plugge, Joe R. <JRPlugge@west.com>
parent: Carol Walter <walterc@indiana.edu>
0 siblings, 1 reply; 10+ messages in thread
From: Plugge, Joe R. @ 2008-09-25 18:39 UTC (permalink / raw)
To: Carol Walter <walterc@indiana.edu>; Steve Crawford <scrawford@pinpointresearch.com>; +Cc: Scott Marlowe <scott.marlowe@gmail.com>; pgsql-admin
Change the shbang line to match where your php in installed (if it is at
all)
#!/full_path_to_my_php -q
-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Carol Walter
Sent: Thursday, September 25, 2008 1:15 PM
To: Steve Crawford
Cc: Scott Marlowe; pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Hex representation
Well, it was a bit convoluted, but I created the file with Excel,
filling the right number of cells with \x55. This worked too. The
script wouldn't run for me. I got an error about a "bad interpreter".
Carol
On Sep 25, 2008, at 1:40 PM, Steve Crawford wrote:
> Scott Marlowe wrote:
>> I used this very simple little php script to make this
>>
>> filename: mk55:
>> #!/usr/bin/php -q
>> <?php
>> for ($i=0;$i<262144;$i++){
>> print chr(85);
>> }
>> ?>
>>
> Or, using standard *nix tools (Note: 0x55 = ascii U):
> dd bs=1k count=256 if=/dev/zero | tr '\000' U > full_of_0x55
>
> Cheers,
> Steve
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-26 00:43 Steve Martin <steve.martin@nec.co.nz>
parent: Plugge, Joe R. <JRPlugge@west.com>
0 siblings, 1 reply; 10+ messages in thread
From: Steve Martin @ 2008-09-26 00:43 UTC (permalink / raw)
To: Carol Walter <walterc@indiana.edu>; +Cc: Plugge, Joe R. <JRPlugge@west.com>; Steve Crawford <scrawford@pinpointresearch.com>; Scott Marlowe <scott.marlowe@gmail.com>; pgsql-admin
Hi, - see below
Plugge, Joe R. wrote:
>Change the shbang line to match where your php in installed (if it is at
>all)
>
>#!/full_path_to_my_php -q
>
>-----Original Message-----
>From: pgsql-admin-owner@postgresql.org
>[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Carol Walter
>Sent: Thursday, September 25, 2008 1:15 PM
>To: Steve Crawford
>Cc: Scott Marlowe; pgsql-admin@postgresql.org
>Subject: Re: [ADMIN] Hex representation
>
>Well, it was a bit convoluted, but I created the file with Excel,
>filling the right number of cells with \x55. This worked too. The
>script wouldn't run for me. I got an error about a "bad interpreter".
>
>Carol
>
>On Sep 25, 2008, at 1:40 PM, Steve Crawford wrote:
>
>
>
>>Scott Marlowe wrote:
>>
>>
>>>I used this very simple little php script to make this
>>>
>>>filename: mk55:
>>>#!/usr/bin/php -q
>>><?php
>>>for ($i=0;$i<262144;$i++){
>>> print chr(85);
>>>}
>>>?>
>>>
>>>
>>>
>>Or, using standard *nix tools (Note: 0x55 = ascii U):
>>dd bs=1k count=256 if=/dev/zero | tr '\000' U > full_of_0x55
>>
>>Cheers,
>>Steve
>>
>>
>>
I liked Steve Crawford's idea, a good one liner but I could not get it
to work on sunos, version (Generic_118558-35). Worked on HPUX.
Just using basic shell scripting, the following are another way of doing it.
Using bash, it can be done like this:
--- Start u.sh ---
#!/usr/local/bin/bash <- change to output of "which bash"
max=`expr 256 \* 1024`
for (( i=0; i<$max; ++i )) ; do
echo -n U <- depends on system, try print
done
--- End u.sh ---
E.g
./u.sh > losOfUs.txt
% xd losOfUs.txt | less
0000000 5555 5555 5555 5555 5555 5555 5555 5555
*
0040000
Or ksh or sh
--- Start u.sh ---
#!/bin/ksh <- change to output of "which ksh"
max=`expr 256 \* 1024`
i=0
while [ $i -lt $max ] ; do
print -n U
i=`expr $i + 1`
done
--- End u.sh ---
./u.sh > losOfUs.txt
od -x losOfUs.txt | less
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0003720 <- still working, slow machine :-{
Regards
Steve Martin
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-27 15:24 Michelle Konzack <linux4michelle@tamay-dogan.net>
parent: Carol Walter <walterc@indiana.edu>
2 siblings, 0 replies; 10+ messages in thread
From: Michelle Konzack @ 2008-09-27 15:24 UTC (permalink / raw)
To: pgsql-admin
Am 2008-09-24 15:20:03, schrieb Carol Walter:
> Hello,
>
> Does anyone know what the format of hex characters for postgres are?
> I'm trying to create files that contain a 0x55. It looks to me like
> it should require a delimiter of some sort between the characters. I
> don't know how postgres would know that the string was a hex
> representation and not just a character zero, followed by a character
> x, followed by a character 5, followed by a character 5.
This is working:
#!/bin/sh
for MAJ in 0 1 2 3 ; do
for MIN in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do
for HEX in $(seq 1 262144) ; do
echo -n \x55 >>00${MAY}${MIN}
done
done
done
which should create your missing pg_clog files
Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
+49/177/9351947 50, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
Attachments:
signature.pgp (application/pgp-signature, 188B) download
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Hex representation
@ 2008-09-30 04:17 Reece Hart <reece@harts.net>
parent: Steve Martin <steve.martin@nec.co.nz>
0 siblings, 0 replies; 10+ messages in thread
From: Reece Hart @ 2008-09-30 04:17 UTC (permalink / raw)
To: Steve Martin <steve.martin@nec.co.nz>; +Cc: Carol Walter <walterc@indiana.edu>; Plugge, Joe R. <JRPlugge@west.com>; Steve Crawford <scrawford@pinpointresearch.com>; Scott Marlowe <scott.marlowe@gmail.com>; pgsql-admin
I can't resist one-liner games.
$ perl -e 'print "U"x(256*1024)' >Us
or, if you specifically want to specify hex:
$ perl -e 'print chr(hex(55))x(256*1024)' >Us
-Reece
--
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2008-09-30 04:17 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-09-24 19:20 Hex representation Carol Walter <walterc@indiana.edu>
2008-09-24 19:32 ` Milen A. Radev <milen@radev.net>
2008-09-24 19:43 ` Scott Marlowe <scott.marlowe@gmail.com>
2008-09-25 17:40 ` Steve Crawford <scrawford@pinpointresearch.com>
2008-09-25 18:12 ` Tena Sakai <tsakai@gallo.ucsf.edu>
2008-09-25 18:15 ` Carol Walter <walterc@indiana.edu>
2008-09-25 18:39 ` Plugge, Joe R. <JRPlugge@west.com>
2008-09-26 00:43 ` Steve Martin <steve.martin@nec.co.nz>
2008-09-30 04:17 ` Reece Hart <reece@harts.net>
2008-09-27 15:24 ` Michelle Konzack <linux4michelle@tamay-dogan.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox