PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > [ANN] mechanize 0.7.3 Released
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
[ANN] mechanize 0.7.3 Released

Réponse
 
LinkBack Outils de la discussion
Vieux 12/03/2008, 21h17   #1
Aaron Patterson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut [ANN] mechanize 0.7.3 Released

mechanize version 0.7.3 has been released!

* <http://mechanize.rubyforge.org/>

The Mechanize library is used for automating interaction with websites.
Mechanize automatically stores and sends , follows redirects,
can follow links, and submit forms. Form fields can be populated and
submitted. Mechanize also keeps track of the sites that you have
visited as
a history.

Changes:

# Mechanize CHANGELOG

## 0.7.3

* Pages are now yielded to a blocks given to WWW::Mechanize#get
* WWW::Mechanize#get now takes hash arguments for uri parameters.
* WWW::Mechanize#post takes an IO object as a parameter and posts correctly.
* Fixing a strange zlib inflate problem on windows

* <http://mechanize.rubyforge.org/>

--
Aaron Patterson
http://tenderlovemaking.com/

  Réponse avec citation
Vieux 12/03/2008, 23h58   #2
Roger Pack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mechanize 0.7.3 Released

Aaron Patterson wrote:
> mechanize version 0.7.3 has been released!


Thanks for mechanize--we use mechanize at work and it works well.

Question on strings:
I seem incapable of figuring out how to 'recreate' this string in
"string" format:

Here it is byte by byte

bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,
32, 112, 114, 101, 118, 105, 111, 117]
for b in bytes do all << b; end # create the string
all == "dent?<80><99>s previou" # it compared with itself in string form


?
Thanks!
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 13/03/2008, 00h53   #3
Aaron Patterson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mechanize 0.7.3 Released

On Thu, Mar 13, 2008 at 07:58:44AM +0900, Roger Pack wrote:
> Aaron Patterson wrote:
> > mechanize version 0.7.3 has been released!

>
> Thanks for mechanize--we use mechanize at work and it works well.


Thank you!

>
> Question on strings:
> I seem incapable of figuring out how to 'recreate' this string in
> "string" format:
>
> Here it is byte by byte
>
> bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,
> 32, 112, 114, 101, 118, 105, 111, 117]
> for b in bytes do all << b; end # create the string
> all == "dent?<80><99>s previou" # it compared with itself in string form


Try using pack:

bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,
32, 112, 114, 101, 118, 105, 111, 117]
bytes.pack('C*') == "dent?<80><99>s previou"

--
Aaron Patterson
http://tenderlovemaking.com/

  Réponse avec citation
Vieux 13/03/2008, 01h13   #4
7stud --
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mechanize 0.7.3 Released

Roger Pack wrote:
> Aaron Patterson wrote:
>> mechanize version 0.7.3 has been released!

>
> Thanks for mechanize--we use mechanize at work and it works well.
>
> Question on strings:
> I seem incapable of figuring out how to 'recreate' this string in
> "string" format:
>
> Here it is byte by byte
>
> bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,
> 32, 112, 114, 101, 118, 105, 111, 117]
> for b in bytes do all << b; end # create the string
> all == "dent?<80><99>s previou" # it compared with itself in string form
>
>
> ?
> Thanks!



ascii_codes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62,
115,
32, 112, 114, 101, 118, 105, 111, 117]
str = ""

for code in ascii_codes
str << code.chr
end

puts str
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 13/03/2008, 03h34   #5
William James
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mechanize 0.7.3 Released

On Mar 12, 4:58 pm, Roger Pack <rogerpack2...@gmail.com> wrote:
> Aaron Patterson wrote:
> > mechanize version 0.7.3 has been released!

>
> Thanks for mechanize--we use mechanize at work and it works well.
>
> Question on strings:
> I seem incapable of figuring out how to 'recreate' this string in
> "string" format:
>
> Here it is byte by byte
>
> bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,
> 32, 112, 114, 101, 118, 105, 111, 117]
> for b in bytes do all << b; end # create the string


bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57,
62, 115, 32, 112, 114, 101, 118, 105, 111, 117]

puts bytes.map{|n| n.chr}.join
  Réponse avec citation
Vieux 13/03/2008, 03h56   #6
David A. Black
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mechanize 0.7.3 Released

Hi --

On Thu, 13 Mar 2008, Aaron Patterson wrote:

> On Thu, Mar 13, 2008 at 07:58:44AM +0900, Roger Pack wrote:
>> Aaron Patterson wrote:
>>> mechanize version 0.7.3 has been released!

>>
>> Thanks for mechanize--we use mechanize at work and it works well.

>
> Thank you!
>
>>
>> Question on strings:
>> I seem incapable of figuring out how to 'recreate' this string in
>> "string" format:
>>
>> Here it is byte by byte
>>
>> bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,
>> 32, 112, 114, 101, 118, 105, 111, 117]
>> for b in bytes do all << b; end # create the string
>> all == "dent?<80><99>s previou" # it compared with itself in string form

>
> Try using pack:


In other words:

pack, Pack!

The roster of community members whose last names are core methods
(give or take a capital letter) is growing. There are at least three
at this point (Freeze, Keys, and Pack).


David

--
Upcoming Rails training from David A. Black and Ruby Power and Light:
ADVANCING WITH RAILS, April 14-17 2008, New York City
CORE RAILS, June 24-27 2008, London (Skills Matter)
See http://www.rubypal.com for details. Berlin dates coming soon!

  Réponse avec citation
Vieux 13/03/2008, 04h10   #7
Roger Pack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mechanize 0.7.3 Released

Questions:

The following ways all recreate my original string, however I am having
trouble getting the comparison work to itself expressed in string
form--it's like the string form doesn't express all the inside chars or
something--am I missing something? Is there a way to recreate the
string along the lines of "dent?\226" and, as a follow up, is
complicated_string.inspect just not displaying the interior characters
right?


>> bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,

?> 32, 112, 114, 101, 118, 105, 111, 117]
>> bytes.pack('C*') == "dent?<80><99>s previou"

=> false
>> str = ""

=> ""
>>

?> for code in bytes
>> str << code.chr
>> end

=> [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115, 32,
112, 114, 101, 118, 105, 111, 117]
>> str == "dent?<80><99>s previou"

=> false
>> str = bytes.map{|n| n.chr}.join

=> "dent?<80><99>s previou"
>> str == "dent?<80><99>s previou"

=> false

Just wondering if anybody can enlighten me.
Guess we just need more people named by Ruby names, huh?
Take care.
-R
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 13/03/2008, 07h22   #8
William James
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mechanize 0.7.3 Released



Roger Pack wrote:
> Questions:
>
> The following ways all recreate my original string, however I am having
> trouble getting the comparison work to itself expressed in string
> form--it's like the string form doesn't express all the inside chars or
> something--am I missing something? Is there a way to recreate the
> string along the lines of "dent?\226" and, as a follow up, is
> complicated_string.inspect just not displaying the interior characters
> right?
>
>
> >> bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,

> ?> 32, 112, 114, 101, 118, 105, 111, 117]
> >> bytes.pack('C*') == "dent?<80><99>s previou"

> => false
> >> str = ""

> => ""
> >>

> ?> for code in bytes
> >> str << code.chr
> >> end

> => [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115, 32,
> 112, 114, 101, 118, 105, 111, 117]
> >> str == "dent?<80><99>s previou"

> => false
> >> str = bytes.map{|n| n.chr}.join

> => "dent?<80><99>s previou"
> >> str == "dent?<80><99>s previou"

> => false


irb(main):002:0> ?A
=> 65
irb(main):003:0> ??
=> 63
irb(main):004:0> 226.chr
=> "\342"
irb(main):005:0> puts 226.chr
Ã

The character whose ASCII code is 226 is not a question mark.
The ASCII code of a question mark is 63.

irb(main):008:0> puts [100, 101, 110, 116, 226].map{|n| n.chr}.join
dentÃ
irb(main):009:0> "342".to_i(8)
=> 226

Octal for 226 is 342.
  Réponse avec citation
Vieux 13/03/2008, 18h22   #9
Aaron Patterson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mechanize 0.7.3 Released

On Thu, Mar 13, 2008 at 11:56:28AM +0900, David A. Black wrote:
> Hi --
>
> On Thu, 13 Mar 2008, Aaron Patterson wrote:
>
>> On Thu, Mar 13, 2008 at 07:58:44AM +0900, Roger Pack wrote:
>>> Aaron Patterson wrote:
>>>> mechanize version 0.7.3 has been released!
>>>
>>> Thanks for mechanize--we use mechanize at work and it works well.

>>
>> Thank you!
>>
>>>
>>> Question on strings:
>>> I seem incapable of figuring out how to 'recreate' this string in
>>> "string" format:
>>>
>>> Here it is byte by byte
>>>
>>> bytes = [100, 101, 110, 116, 226, 60, 56, 48, 62, 60, 57, 57, 62, 115,
>>> 32, 112, 114, 101, 118, 105, 111, 117]
>>> for b in bytes do all << b; end # create the string
>>> all == "dent?<80><99>s previou" # it compared with itself in string form

>>
>> Try using pack:

>
> In other words:
>
> pack, Pack!
>
> The roster of community members whose last names are core methods
> (give or take a capital letter) is growing. There are at least three
> at this point (Freeze, Keys, and Pack).


I've submitted my patch to add the "patterson" method to Array, but I
haven't heard anything back.....

--
Aaron Patterson
http://tenderlovemaking.com/

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h53.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17010 seconds with 17 queries