Hello all! I'm trying to take a URL's hash value, send it through a function, turn that value into an object, but ultimately send the value to JSON. I have the following setup:
function content(cur){
var mycur = $H(cur);
var pars = "p="+mycur.toJSON();
new Ajax.Updater('my_box', 'test.php', {
parameters: pars
});
}...
I have to write my own hash function. If I wanted to just make the simple hash function that maps each letter in the string to a numerical value (i.e. a=1, b=2, c=3, ...), is there a way I can perform this hash on a string without having to first convert it to a c-string to look at each individual char? Is there a more efficient way of h...
Hi guys,
I'm having difficulties to get the same string in Javascript and I'm thinking that I'm doing something wrong...
Java code:
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.GregorianCalendar;
import sun.misc....
Hi everyone,
I have a counter hash that I am trying to sort by count. The problem I am running into is that the default Hash.sort function sorts numbers like strings rather than by number size.
i.e. Given Hash:
metrics = {"sitea.com" => 745, "siteb.com" => 9, "sitec.com" => 10 }
Running this code:
metrics.sort {|a1,a2| a2[1]<=>a1[1...
Hi. I just got a site to manage, but am not too sure about the code the previous guy wrote. I'm pasting the login procedure below, could you have a look and tell me if there are any security vulnerabilities? At first glance, it seems like one could get in through SQL injection or manipulating cookies and the ?m= parameter.
define ( ...
Inspired by http://stackoverflow.com/questions/2552363/how-can-i-marshal-a-hash-with-arrays I wonder what's the reason that Array#<< won't work properly in the following code:
h = Hash.new{Array.new}
#=> {}
h[0]
#=> []
h[0] << 'a'
#=> ["a"]
h[0]
#=> [] # why?!
h[0] += ['a']
#=> ["a"]
h[0]
#=> ["a"] # as expected
Does it have to do wit...
Is it possible to hash flv videos so it is unplayable by itself and the format is unrecognizable by softwares, but i could actually de-hash them and play in my as3 script?
This is going to be realized on a CD so I can't use server scripts.
...
Lets assume I have two hashes. One of them contains a set of data that only needs to keep things that show up in the other hash.
e.g.
my %hash1 = (
test1 => { inner1 => { more => "alpha", evenmore => "beta" } },
test2 => { inner2 => { more => "charlie", somethingelse => "delta" } },
test3 => { inner9999 => { oh...
I am having a hard time figuring out a reasonable way to generate a mixed-case hash in Python.
I want to generate something like: aZeEe9E
Right now I'm using MD5, which doesn't generate case-sensitive hashes.
Do any of you know how to generate a hash value consisting of upper- and lower- case characters + numbers?
-
Okay, GregS's ad...
Too bad even the trace doesn't say which hash is involved.
Sorry this post is long: am trying to provide enough context to be meaningful.
Occurs intermittently when rake jobs:work is pulling a command out of delayed_jobs while my status observer is in the process of parsing a log file for detailed results of the previous delayed_job de...
Let's say there is a file called myfile.txt with the following contents:
one two three
Another file called yourfile.txt with following contents:
two three one
Will the SHA-1 hash be the same for both of these files, because the content are same but in different order?
...
I'm trying this:
{:id => 5, :foos => [1,2,3]}.each {|k,v| v.to_s}
But that's returning this:
{:id=>5, :foos=>[1, 2, 3]}
I'd like to see this:
{:id=>"5", :foos=>"[1, 2, 3]"}
I've also tried variations of Hash#collect and Hash#map. Any ideas?
...
I've had a look around for the answer to this, but I only seem to be able to find software that does it for you. Does anybody know how to go about doing this in python?
...
If my math is right, I can quickly generate a new hash value for the concatenation of two strings if I already have the individual hash values for each string. But only if the hash function is of the form:
hash(n) = k * hash(n-1) + c(n), and h(0) = 0.
In this case,
hash( concat(s1,s2) ) = k**length(s2) * hash(s1) + hash(s2)
eg.
h...
Can anyone, please, explain to me how to transform a phrase like "I want to buy some milk" into MD5? I read Wikipedia article on MD5, but the explanation given there is beyond my comprehension:
"MD5 processes a variable-length
message into a fixed-length output of
128 bits. The input message is broken
up into chunks of 512-bi...
Hello,
I'm looking for a special hash-function. Let's say I have a large list of strings, if I order them by their hash-values they should be ordered quasi randomly.
The most important point is: it must be super fast. I've tried md5 and sha1 and they're using to much cpu power.
Clashes are not a problem.
I'm using javascript, so it ...
Hi.
I need help supporting back button with jquery ajax.load method.
I have tried a couple of plugins but i cant get any of them to work.
I am loading my content like this:
$('.pagination a').click(function(){
var url = $(this).attr('href');
ajaxLoad(url,null,'.container');
return false;...
Hello, with the hash below, I would like the clients array's reference :
my $this =
{
'name' => $name,
'max_clients' => $max_clients,
'clients' => ()
};
I can't do "\$this{'clients'};" to retrieve the reference.
...
I'm taking 5 strings (protocol, source IP and port, destination IP and port) and using them to store some values in a hash. The problem is that if the IPs or ports are switched between source and destination, the key is supposed to be the same.
If I was doing this in C#/Java/whatever I'd have to create a new class and overwrite the hash...
I am creating a web application to integrate with Chargify. I want to return a hash with customer_id set if the user has a customer associated with the account, and customer_attributes if a customer has to be created.
Is there any way that I could do this with an if..end block inside of the hash definition. For example, I would be wanti...