Hash function doesn't work

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Hash function doesn't work

evansste
I ran across the following link, which makes it seem as if Octave has a hash function:

https://octave.sourceforge.io/octave/function/hash.html

However, when I try to use the hash function, Octave doesn't seem to know what I'm talking about.  For instance, if I type the following, at an Octave prompt:

hash ("md5", "abc")

Octave returns:

error: 'hash' undefined near line 1 column 1

As you can see, I'm using the exact example which is shown in the link.  So why does Octave return an error message?
At the bottom of the link, it says that this is an Octave package.  Doesn't that mean that it's already installed in Octave?  If not, then how would I install it?

Thanks for your time, and I appreciate any help that anyone is willing to provide.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Hash function doesn't work

Allen.Windhorn-3
Steven,

> -----Original Message-----
> From: Help-octave [mailto:help-octave-
>
>...  For instance, if I type the following, at an Octave prompt:
>
> hash ("md5", "abc")
>
> Octave returns:
>
> error: 'hash' undefined near line 1 column 1
>
> As you can see, I'm using the exact example which is shown in the link.  So
> why does Octave return an error message?
> At the bottom of the link, it says that this is an Octave package.  Doesn't
> that mean that it's already installed in Octave?  If not, then how would I
> install it?

hash appears to be in the io package.  I have that installed already, but if
you don't, then type:

pkg install  -forge io

then

pkg load io

and try it again.  I get:

>> pkg load io
>> hash('md2', "foo")
ans = d11f8ce29210b4b50c5e67533b699d02

Regards,
Allen

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

Kire Pudsje
In reply to this post by evansste


On Thu, Mar 30, 2017 at 7:28 PM, evansste <[hidden email]> wrote:
hash ("md5", "abc")

Octave returns:

error: 'hash' undefined near line 1 column 1

Which version of octave?
for older versions, you could try md5sum.

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

evansste
Thanks for your response, Kire Pudsje.

I'm running Octave 3.8.1.  As far as I know, it's the latest version that can be installed on Lubuntu 14.04.3 using ppa.

I received an E-mail about this, also.  Allen suggested that I try the following:

pkg install  -forge io

then

pkg load io

I think my Octave version is too old for these commands to work, since I get an error when running the first command.  After a little online searching, I found the following shell command instead:

sudo apt-get install octave-io

This command ran, however, towards the end of all of the things it printed on the screen, I saw a lot of "404 Not Found" and "E: Failed to fetch http://..." messages.  So when I shut down Octave, and restarted it, I wasn't surprised to learn that it still wasn't working.

At least I seem to have a better idea of what the problem is.  I may not have the io package installed because of my older version of Octave.  I did a quick search about upgrading Octave, but from what I can tell, I would probably have to uninstall, and then reinstall the latest version from source.  I may give that a shot, if worse comes to worst.  However, I rarely have successful installations when installing from source.  I'd much rather find out how to install the io package.

Thanks for the response.  I'll keep looking into installing the io package, for now.  If you, or anyone else, has any other ideas, I'd love to hear them.  Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

evansste
Well I just installed Octave 4.0.3 on a different machine that is running a newer version of Lubuntu.  However, even with Octave 4.0.3, I get the same exact results.  The io package wasn't installed initially, so I installed it with:

sudo apt-get install octave-io

The installation seemed to work, and the package is shown as being installed in Octave when I type:

pkg list

However, the hash command still doesn't seem to be recognized.  I typed "pkg load io" and then "hash('md5','abc')" and I still get a message which says "error: 'hash' undefined near line 1 column 1".

This is very puzzling since it seems to work well for Alan.  Any ideas as to why this still isn't working after the io package has been installed?

Thanks again for your time.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

Thomas D. Dean-2
On 03/30/2017 04:07 PM, evansste wrote:

> Well I just installed Octave 4.0.3 on a different machine that is running a
> newer version of Lubuntu.  However, even with Octave 4.0.3, I get the same
> exact results.  The io package wasn't installed initially, so I installed it
> with:
>
> sudo apt-get install octave-io
>
> The installation seemed to work, and the package is shown as being installed
> in Octave when I type:
>
> pkg list
>
> However, the hash command still doesn't seem to be recognized.  I typed "pkg
> load io" and then "hash('md5','abc')" and I still get a message which says
> "error: 'hash' undefined near line 1 column 1".
>
> This is very puzzling since it seems to work well for Alan.  Any ideas as to
> why this still isn't working after the io package has been installed?
>
> Thanks again for your time.
>
>
>
> --
> View this message in context: http://octave.1599824.n4.nabble.com/Hash-function-doesn-t-work-tp4682691p4682696.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-octave
>
try

 > pkg load io
 > which hash

Tom Dean


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

evansste
Thanks, Tom, for the suggestion.  Unfortunately, that didn't seem to work either.

I typed "pkg load io", and received no error messages or anything, and the same thing for "which hash".  Octave simply returned a prompt with no problem, after each command.  However, after that, when I type "hash('md5','abc')", it still says "error: 'hash' undefined near line 1 column 1".

I've been searching online in order to see if this hash function is actually included in a different package, not the io package.  However, I haven't been able to find anything that's definitive.

Thanks again for all of the suggestions from everyone.  I look forward to hearing any more ideas.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Plot

Thomas D. Dean-2
In reply to this post by Thomas D. Dean-2
I have some 'treadmill' data, one heart rate reading per second for 20
minutes.

I can simulate this with:

T=[]; B=[];
for day=1:29
   t1=day+(10+([1:1400]/60/60))/24;
   t2=day+(16+([1:1520]/60/60))/24;
   bmp1=(1+rand(size(t1)))*10+80;
   bmp2=(1+rand(size(t2)))*10+83;
   T=[T;t1';t2'];
   B=[B;bmp1';bmp2'];
endfor;
## if I plot time vs bmp, I get all the bmp values in one vertical
## line with a line connecting to the next set of bmp values.
plot(T,B);
## plot with points demonstrates this:
plot(T,B,'.');
## I want the plot to look something like this:
plot(B);

Is there a simple way to accomplish this?

Tom Dean

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

Thomas D. Dean-2
In reply to this post by evansste
On 03/30/2017 05:17 PM, evansste wrote:
send the resutls of

 > pkg list
 > version

Tom Dean

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

Mike Miller-4
In reply to this post by evansste
On Thu, Mar 30, 2017 at 17:17:26 -0700, evansste wrote:
> I typed "pkg load io", and received no error messages or anything, and the
> same thing for "which hash".  Octave simply returned a prompt with no
> problem, after each command.  However, after that, when I type
> "hash('md5','abc')", it still says "error: 'hash' undefined near line 1
> column 1".

The hash function is new in Octave 4.2. It has never been part of the io
package or any other add-on package that I know of.

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

Thomas D. Dean-2
In reply to this post by evansste
On 03/30/2017 05:17 PM, evansste wrote:
>
> I've been searching online in order to see if this hash function is actually
> included in a different package, not the io package.  However, I haven't
> been able to find anything that's definitive.
>


octave:103> which hash
'hash' is a built-in function from the file libinterp/corefcn/hash.cc
octave:104> version
ans = 4.3.0+

Tom Dean

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

tmacchant
In reply to this post by evansste
----- Original Message -----

> From: evansste 
> To: help-octave
> Cc:
> Date: 2017/3/31, Fri 09:17
> Subject: Re: Hash function doesn't work
>
>T hanks, Tom, for the suggestion.  Unfortunately, that didn't seem to work
> either.
>
> I typed "pkg load io", and received no error messages or anything, and
> the
> same thing for "which hash".  Octave simply returned a prompt with no
> problem, after each command.  However, after that, when I type
> "hash('md5','abc')", it still says "error:
> 'hash' undefined near line 1
> column 1".
>
> I've been searching online in order to see if this hash function is actually
> included in a different package, not the io package.  However, I haven't
> been able to find anything that's definitive.
>
> Thanks again for all of the suggestions from everyone.  I look forward to
> hearing any more ideas.
>
Seeing the reference of octave, hash is core function of octave from ver. 4.2 but
not of the current io package.

Tatsuro

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

evansste
In reply to this post by evansste
Thanks, everyone.

I think I finally see what the problem is.  My version of Octave is still too old.  The newer version, which I recently installed on the other machine, is version 4.0.3.  So that explains why none of this is working, since the hash function is new in version 4.2.

Anyway, when I type "pkg list" I receive the following:

Package Name  | Version | Installation directory
--------------+---------+-----------------------
          io *|   2.4.2 | /usr/share/octave/packages/io-2.4.2

After typing "version" I get:
ans = 4.0.3

So I think that officially explains it.  If I want to use the hash function, I have to install a newer version of Octave -- at least 4.2, or newer.

Thanks for all of this help.  I appreciate it greatly.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plot

Juan Pablo Carbajal-2
In reply to this post by Thomas D. Dean-2
On Fri, Mar 31, 2017 at 2:30 AM, Thomas D. Dean <[hidden email]> wrote:

> T=[]; B=[];
> for day=1:29
>   t1=day+(10+([1:1400]/60/60))/24;
>   t2=day+(16+([1:1520]/60/60))/24;
>   bmp1=(1+rand(size(t1)))*10+80;
>   bmp2=(1+rand(size(t2)))*10+83;
>   T=[T;t1';t2'];
>   B=[B;bmp1';bmp2'];
> endfor;
> ## if I plot time vs bmp, I get all the bmp values in one vertical
> ## line with a line connecting to the next set of bmp values.
> plot(T,B);
> ## plot with points demonstrates this:
> plot(T,B,'.');
> ## I want the plot to look something like this:
> plot(B);

I am not sure what you need, but
t1 has length 1400, t2 has length 1520; bmp1 and bmop2 has those
lengths respectively with values between 90 and 100, and 93 and 103.
Repeated 29 times. So:
n1 = 1400;
n2 = 1520;
B = (1+rand (29*(n1+n2),1))*10 + repmat ([80*ones(n1,1); 83*ones(n2,1)],29,1);
# now I create a linear timestamp
T = (1:29*(n1+n2)).';
plot (T,B)

is this what you want?

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

tmacchant
In reply to this post by evansste
----- Original Message -----

> From: evansste 
> To: help-octave
> Cc:
> Date: 2017/3/31, Fri 09:39
> Subject: Re: Hash function doesn't work
>
>T hanks, everyone.
>
> I think I finally see what the problem is.  My version of Octave is still
> too old.  The newer version, which I recently installed on the other
> machine, is version 4.0.3.  So that explains why none of this is working,
> since the hash function is new in version 4.2.
>
> Anyway, when I type "pkg list" I receive the following:
>
> Package Name  | Version | Installation directory
> --------------+---------+-----------------------
>           io *|   2.4.2 | /usr/share/octave/packages/io-2.4.2
>
> After typing "version" I get:
> ans = 4.0.3
>
> So I think that officially explains it.  If I want to use the hash function,
> I have to install a newer version of Octave -- at least 4.2, or newer.
>
> Thanks for all of this help.  I appreciate it greatly.
>
If you want to build octave-4.2.1 on Ubuntu 16.04, the below may be helpful.

https://www.scivision.co/compiling-octave-4-on-ubuntu/


Tatsuro

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plot

Thomas D. Dean-2
In reply to this post by Juan Pablo Carbajal-2
On 03/30/2017 06:21 PM, Juan Pablo Carbajal wrote:

> On Fri, Mar 31, 2017 at 2:30 AM, Thomas D. Dean <[hidden email]> wrote:
>> T=[]; B=[];
>> for day=1:29
>>   t1=day+(10+([1:1400]/60/60))/24;
>>   t2=day+(16+([1:1520]/60/60))/24;
>>   bmp1=(1+rand(size(t1)))*10+80;
>>   bmp2=(1+rand(size(t2)))*10+83;
>>   T=[T;t1';t2'];
>>   B=[B;bmp1';bmp2'];
>> endfor;
>> ## if I plot time vs bmp, I get all the bmp values in one vertical
>> ## line with a line connecting to the next set of bmp values.
>> plot(T,B);
>> ## plot with points demonstrates this:
>> plot(T,B,'.');
>> ## I want the plot to look something like this:
>> plot(B);
>
> I am not sure what you need, but
> t1 has length 1400, t2 has length 1520; bmp1 and bmop2 has those
> lengths respectively with values between 90 and 100, and 93 and 103.
> Repeated 29 times. So:
> n1 = 1400;
> n2 = 1520;
> B = (1+rand (29*(n1+n2),1))*10 + repmat ([80*ones(n1,1); 83*ones(n2,1)],29,1);
> # now I create a linear timestamp
> T = (1:29*(n1+n2)).';
> plot (T,B)
>
> is this what you want?
>

 From my simulation above, both T and B have size (84680,1).

I am reading the data from a file that changes in size, growing some
2600 lines per day.  The file currently has 84000+ entries of a time
stamp and a heart beat rate, I called bmp from the mfg's android app.

I was offering a simulation to generate a similar grouping of data points.

I want to plot B, but, keep the correlation and x-axis labels with the
correct timestamp from T.

Tom Dean



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plot

Kire Pudsje


On Fri, Mar 31, 2017 at 5:46 AM, Thomas D. Dean <[hidden email]> wrote:

From my simulation above, both T and B have size (84680,1).

I am reading the data from a file that changes in size, growing some 2600 lines per day.  The file currently has 84000+ entries of a time stamp and a heart beat rate, I called bmp from the mfg's android app.

I was offering a simulation to generate a similar grouping of data points.

I want to plot B, but, keep the correlation and x-axis labels with the correct timestamp from T.


Not exactly sure what you want.
If you want to get rid of the connecting line in between, add NaN values
  T=[T;NaN;t1';NaN;t2'];
  B=[B;NaN;bmp1';NaN;bmp2'];


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plot

Juan Pablo Carbajal-2
On Fri, Mar 31, 2017 at 7:31 AM, Kire Pudsje <[hidden email]> wrote:

>
>
> On Fri, Mar 31, 2017 at 5:46 AM, Thomas D. Dean <[hidden email]>
> wrote:
>>
>>
>> From my simulation above, both T and B have size (84680,1).
>>
>> I am reading the data from a file that changes in size, growing some 2600
>> lines per day.  The file currently has 84000+ entries of a time stamp and a
>> heart beat rate, I called bmp from the mfg's android app.
>>
>> I was offering a simulation to generate a similar grouping of data points.
>>
>> I want to plot B, but, keep the correlation and x-axis labels with the
>> correct timestamp from T.
>>
>
> Not exactly sure what you want.
> If you want to get rid of the connecting line in between, add NaN values
>   T=[T;NaN;t1';NaN;t2'];
>   B=[B;NaN;bmp1';NaN;bmp2'];
>
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-octave
>
It seems we do not understand your needs yet.
Please correct my statement:
    You want to plot data being written to a file in a "live" screen.
Like this: https://youtu.be/d1If8XOL73c?t=29s
So the problems you might be facing are related to:
1. Loading only the last chunk of the file
2. Concatenating the data for plotting
3. Obtaining the desired plot (as in the looks of the plot).

If this is correct, could you choose the item you need help with?

Thanks

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hash function doesn't work

Francesco Potortì
In reply to this post by Kire Pudsje
>> error: 'hash' undefined near line 1 column 1
>>
>> Which version of octave?
>for older versions, you could try md5sum.

Or, if you need sha1, you can use the SHA1 function from the "general"
package.  Which works on Windows but has problems on Linux.  If you need
sha1 on Linux with Octave older than 4.2, you can invoke the system's
sha1sum command using popen2 (I can provide an example if you need
that).

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Hash function doesn't work

Allen.Windhorn-3
In reply to this post by Mike Miller-4
> -----Original Message-----
> From: Help-octave [mailto:help-octave-
>
> On Thu, Mar 30, 2017 at 17:17:26 -0700, evansste wrote:
> > I typed "pkg load io", and received no error messages or anything, and the
> > same thing for "which hash".  Octave simply returned a prompt with no
> > problem, after each command.  However, after that, when I type
> > "hash('md5','abc')", it still says "error: 'hash' undefined near line 1
> > column 1".
>
> The hash function is new in Octave 4.2. It has never been part of the io
> package or any other add-on package that I know of.

Sorry, my bad -- I read "sourceforge.io" as "sourceforge/io".  Anyway it
does work for me under 4.2.

Regards,
Allen

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
12
Loading...