search for: myhash

Displaying 17 results from an estimated 17 matches for "myhash".

Did you mean: mdhash
2011 Feb 27
10
How to store the same key multi times in a Hash ?
given an Arra tags[] I need to produce a resulting Hash as following .. { "$in" => [tags[0]], "$in" =>[tags[1], ...} in which the key should be always the same and the value being an Array I tried this : myHash = {} tags.each do |tag| h = {"$in" => [tag]} myHash.merge!(h) end but the merge! is only changing the value ... (as the key is always the same ..) (there is no += as with Array class ...) thanks for your feedback -- You received this messa...
2006 May 05
1
Sorting a hash
Quick Prototype.js hash question. Given: MyHash = {"Alpha" : {name:"Foo",val:3}, "Delta" : {name:"Bar",val:2}, "Beta" : {name:"Baz",val:4} } I want to display this set ordered by key - Alpha,Beta,Delta and by val - 2,3,4 Prototype.js helps with the hash: $H(MyHash).keys().sort() will...
2006 Apr 09
1
http request, hash table
Hello, My problem is that I cannot figure out how to format data in the http post request using external C++ application, so then I could write in my controller: @myHash = params[:person] print ''Name: '', @myHash[:name] or @name = params[:person][:name] Thanks in advance! -- Jakub P. Nowak
2006 Jan 24
2
collect array values
This may be more of a Ruby question, but I wasn''t sure. Is there a way to run a find on a model and then save two fields as key => value in an array for each row. Then use this array on the template for checking if various checkbox or select values are checked? I''m trying to avoid running one query to check the value for each box in the form. - Kyle
2023 Mar 18
2
Custom SASL authentication
An HTML attachment was scrubbed... URL: <https://dovecot.org/pipermail/dovecot/attachments/20230318/8ce3c29a/attachment-0001.htm>
2010 May 30
4
Data Frame as Hash Table
I'm interested in using a data frame as if it were a hash table. For instance if I had the following, > (d <- data.frame(key=seq(0.5, 3, 0.5), value=rnorm(6))) key value 1 0.5 -1.118665122 2 1.0 0.465122921 3 1.5 -0.529239211 4 2.0 -0.147324638 5 2.5 -1.531503795 6 3.0 -0.002720434 Then I'd like to be able to quickly retrieve the "value" of "key" 1.5
2016 Dec 01
0
clang error: static_assert failed "Cache the hash code or make functors involved in hash code and bucket index computation default constructible"
Hi, Consider below test case: 1 #include <unordered_map> 2 3 using key=const int; 4 struct Myhash { 5 Myhash() = default; 6 std::hash<int> hash_int_t; 7 inline size_t operator()(const key& x) const throw() { 8 return hash_int_t(x); 9 } 10 }; 11 std::unordered_map<key,int, Myhash> mm; It comp...
2006 Jun 18
4
share an hash ..
Hello, How to share an Hash between all objects (model, controller ect ...) => I did a static Hash in my model where a static method fill it basically, this is the code class Person < ActiveModel @@anHash.new def Person.anHelperMethod(aKey) if anHash.size==0 ... load the hash, some SQL to fill the Hash end return anHash[aKey] end => The problem,: it always
2006 Jul 10
11
prototype hash method
var v1 = { a: ''value for a'', b:''value for b'' } var v2 = { c: ''value for c'', d: function(){some code...} }; var v3 = v2.merge(v1); I''m getting an error doing this... what is wrong?
2006 Feb 16
0
RE: Applying list-item format depending on action (Diego Scataglini)
...t;>Search</li> If this is what you wanted. Btw, if this where links to pages, you could just extend the link_to to automatically add a class or id set to "current" if the link_to target and the params coincided. Or you could put the [list, index, search] in a hash like this myhash = {"list" => ["admin", "list"], "index" => ["admin", "index"]} and do something like this in the view <% myhash.each do |idx, pparams| -%> <%= "<li #{current_id_select(pparams[0], pparams[1])}>#{idx}</li>&q...
2006 Apr 19
2
how to pass a hash as a parameter in link_to_remote
...#39;s a hash of dynamic data that can change with each request. But I get an error when rails trying to "stringify" the hash. For the regular link_to, it works because it turns the hash into a regular GET-like query string. I''m expecting to be able to get my hash as params[:myhash] # => my hash data inside my controller action, but this only works for link_to, not link_to_remote. My workaround was to write my own helper method to convert the hash into a querystring-looking string, and then to de-stringify inside the controller. But I feel like I must be reinventing...
2023 Mar 17
1
Custom SASL authentication
Hello, I'm looking for a good way to apply a custom hash to passwords.? My hope is to add passwords to a (MySQL) database: INSERT INTO users (user='joblo', pass=MYHASH('plain-password').. For SASL authentication, my thought first was to apply the same hash to the issued password and compare it with the hashed password in the database.? I soon discovered the sql driver supplied by Dovecot doesn't provide that ability, unless I'm missing somethi...
2010 Jul 12
13
ANNOUNCE: Puppet 2.6.0 - Release Candidate 2 available!
...ner syntax to the Puppet DSL: hashes. Hashes are defined like Ruby Hashes: { key1 => val1, ... } The Hash keys are strings but hash values can be any possible right values admitted in Puppet DSL (i.e. a function call or a variable) Currently it is possible: * to assign hashes to a variable $myhash = { key1 => "myval", key2 => $b } * to access hash members (recursively) from a variable containing a hash (works for array too): $myhash = { key => { subkey => "b" }} notice($myhash[key][subkey]] * to use hash member access as resource title * to use hash in def...
2005 Oct 14
7
validates_confirmation_of not working
Hello, I''m having a weird problem in my user model. For the change_password method I have the following: def change_password(oldpass, newpass, confirmation) oldpass = self.class.myhash(oldpass) reload passhash = self.password self.password = newpass self.password_confirmation = confirmation if valid? and oldpass == passhash save! else # valid? method clears errors so we have to call this after it errors.add_to_base ''Invalid cur...
2006 Jul 27
16
Net::LDAP 0.0.3 released, adds TLS encryption
We''re pleased to announce version 0.0.3 of Net::LDAP, the first pure-Ruby LDAP library. Net::LDAP intends to be a feature-complete LDAP client which can access as much as possible of the functionality of the most-used LDAP server implementations. This library does not wrap any existing native-code LDAP libraries, creates no Ruby extensions, and has no dependencies external to Ruby.
2005 Dec 16
10
Associative arrays
I just started playing with rails this week and am working on porting our existing website to rails in our navigation we have a list that has the days of the week that link to the articles for those days. this seems to be working when I had it in the template it would give me the array I was looking for so I decided to move it to the helper so that I could use it on all my templates.
2007 Oct 26
14
''Considered Harmful'' Considered Harmful
Because here in Puppet-land we''re all about self-reference and recursion, and because I actually have to give a talk at RubyConf next weekend about abusing self-reference, and because parent nodes aren''t considered harmful in my own world, I give you: http://www.codinghorror.com/blog/archives/000982.html I think it manages to somehow be both on- and off-topic at the same