Search Results

Search found 3339 results on 134 pages for 'hash collision'.

Page 111/134 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • Dynamic Custom Fields for Data Model

    - by Jerry Deng
    I am in the process of creating a dynamic database where user will be able to create resource type where he/she can add custom fields (multiple texts, strings, and files) Each resource type will have the ability to display, import, export its data; I've been thinking about it and here are my approaches. I would love to hear what do you guys think. Ideas: just hashing all the custom data in a data field (pro: writing is easier, con: reading back out may be harder); children fields (the model will have multiple fields of strings, fields of text, and fields for file path); fixed number of custom fields in the same table with a key mapping data hash stored in the same row; Non-SQL approach, but then the problem would be generating/changing models on the fly to work with different custom fields;

    Read the article

  • What is a simple C library for a set of integer sets?

    - by conradlee
    I've got to modify a C program and I need to include a set of unsigned integer sets. That is, I have millions of sets of integers (each of these integer sets contains between 3 and 100 integers), and I need to store these in some structure, lets call it the directory, that can in logarithmic time tell me whether a given integer set already exists in the directory. The only operations that need to be defined on the directory is lookup and insert. This would be easy in languages with built-in support for useful data structures, but I'm a foreigner to C and looking around on Google did (surprisingly) not answer my question satisfactorily. This project looks about right: http://uthash.sourceforge.net/ but I would need to come up with my own hash key generator. This is a standard, simple problem, so I hope there is a standard and simple solution.

    Read the article

  • Constants in Model and View with select option and show view

    - by caplod
    i have a some values ,that i use in my model as constants. class Animal < ActiveRecord::Base LEGS = {:vierbeiner => 4, :zweibeiner => 2 } end in the form (formtastic) for the collection i use: <%= f.input :legs, :as => :select, :collection => Animal::LEGS => but how do i format the show view so instead showing me the number , the key of the hash? in show view i have: <p> <strong>Legs:</strong> <%=h @animal.legs %> </p>

    Read the article

  • Prevent Users from Performing an Action Twice

    - by TheOnly92
    We have some problems with users performing a specific action twice, we have a mechanism to ensure that users can't do it but somehow it still happens. Here is how our current mechanism works: Client side: The button will be disabled after 1 click. Server side: We have a key hash in the URL which will be checked against the key stored in SESSIONS, once it matches, the key is deleted. Database side: Once the action is performed, there is a field to be flagged indicating the user has completed the action. However, with all these measures, still there are users able to perform the action twice, are there any more safer methods?

    Read the article

  • How to I count key collisions when using boost::unordered_map?

    - by Nikhil
    I have a data structure with 15 unsigned longs, I have defined a hash function using hash_combine as follows: friend std::size_t hash_value(const TUPLE15& given) { std::size_t seed = 0; boost::hash_combine(seed, val1); boost::hash_combine(seed, val2); ... return seed; } I insert a large number of values into a boost::unordered_map but the performance is not good enough. Probably, I could do better with an alternative hashing function. To confirm this, I need to check how many collisions I am getting. How do I do this?

    Read the article

  • PHP Variable Encryption

    - by NCoder
    I have the following code that creates an encryption in PHP: $password = "helloworld"; $passwordupper = strtoupper($password); $passwordencode = mb_convert_encoding($passwordupper, 'UTF-16LE'); $passwordsha1 = hash("SHA1", $passwordencode); $passwordbase64 = base64_encode($passwordsha1); The instructions I have from the system I'm trying to connect to states: The encoding process for passwords is: first convert to uppercase, then Unicode it in little-endian UTF 16, then SHA1 it then base64 encode it. I think I'm doing something wrong in my code. Any ideas?! Thanks! NCoder

    Read the article

  • Mongoose Not Creating Indexes

    - by wintzer
    I have been trying all afternoon to get my node.js application to create MongoDB indexes properly. I am using the Mongoose ODM and in my schema definition below I have the username field set to a unique index. The collection and document all get created properly, it's just the indexes that aren't working. All the documentation says that the ensureIndex command should be run at startup to create any indexes, but none are being made. I'm using MongoLab for hosting if that matters. I have also repeatedly dropped the collection. Please tell me what I'm doing wrong. var schemaUser = new mongoose.Schema({ username: {type: String, index: { unique: true }, required: true}, hash: String, created: {type: Date, default: Date.now} }, { collection:'Users' }); var User = mongoose.model('Users', schemaUser); var newUser = new Users({username:'wintzer'}) newUser.save(function(err) { if (err) console.log(err); });

    Read the article

  • .NET Publishing files but allowing them to be edited?

    - by acidzombie24
    I had media files require in the project so i did this + set built action to content Now here are my problems I would like my app to check for .NET and to check for other installs which is fine now that i made a prerequisite I would like to copy media files when i publish One of these files is a config file i like the user to edit Problem is after doing 1 which gives me a publish folder with a setup.exe + files i have no idea where my installed files are and if i modify the file.ext.deploy i get an error about the hash of the file modified. Is there a way i can have plain non deploy files or distribute the bin/release folder as i normally do but add something to check my prerequisite?

    Read the article

  • [perl] Efficient processing of large text

    - by jesper
    I have text file that contains over one million urls. I have to process this file in order to assign urls to groups, based on host address: { 'http://www.ex1.com' = ['http://www.ex1.com/...', 'http://www.ex1.com/...', ...], 'http://www.ex2.com' = ['http://www.ex2.com/...', 'http://www.ex2.com/...', ...] } My current basic solution takes about 600mb of RAM to do this (size of file is about 300mb). Could You provide some more efficient ways? My current solution simply reads line by line, extracts host address by regex and put url into hash.

    Read the article

  • Not a statement?

    - by abelenky
    I have a simple little code fragment that is frustrating me: HashSet<long> groupUIDs = new HashSet<long>(); groupUIDs.Add(uid)? unique++ : dupes++; At compile time, it generates the error: Only assignment, call, increment, decrement, and new object expressions can be used as a statement HashSet.Add is documented to return a bool, so the ternary (?) operator should work, and this looks like a completely legitimate way to track the number of unique and duplicate items I add to a hash-set. When I reformat it as a if-then-else, it works fine. Can anyone explain the error, and if there is a way to do this as a simple ternary operator?

    Read the article

  • A new Rails idea in views and no more controller. maybe better maybe worse, i need help if this is t

    - by Totty
    Hy, I was thinking that all my website will have use of cells, using the known plugin cell for rails, so this is my idea: A table that contains 3 fields: id, view_name and layout. the layout will be a serialized hash. When a request is made, the layout field is requested and then in the view, default layout, will be unserialized the layout var, that looks like this: @layout[:sidecol][:gallery] = {... some params for it...}; @layout[:maincol][:comments] = {..params...}; In the <% #ruby code to render the cells in the @layout[:sidecol] % will be some ruby code that will loop over the @layout[:sidecol] and render all cells in it. the same occurs in the maincol div. What do you think? Positive in my opinion: More modular controller is used only for post easy change of structure easier to implement some kind of traking to see diferences on what layout is better or not. Negative: not found yet

    Read the article

  • Where can I find an array of the unassigned Unicode code points for a particular block?

    - by gitparade
    At the moment, I'm writing these arrays by hand. For example, the Miscellaneous Mathematical Symbols-A block has an entry in hash like this: my %symbols = ( ... miscellaneous_mathematical_symbols_a => [(0x27C0..0x27CA), 0x27CC, (0x27D0..0x27EF)], ... ) The simpler, 'continuous' array miscellaneous_mathematical_symbols_a => [0x27C0..0x27EF] doesn't work because Unicode blocks have holes in them. For example, there's nothing at 0x27CB. Take a look at the code chart [PDF]. Writing these arrays by hand is tedious, error-prone and a bit fun. And I get the feeling that someone has already tackled this in Perl!

    Read the article

  • Can you use POST to run a query in Solr (/select)

    - by RyanFetz
    I have queries that I am running against out solr index that sometimes have very long query parameters, I get errors when i run these queries, which i assume are do to the limit of a GET query parameters. Here is the method I use to query (JSON), this is to show I am using the Http Extensions (the client i use is a thin wrapper for HttpClient) not an end to end solution. 90% of the queries run fine, it is just when the params are large i get the 500 error from solr. I have read somewhere you can use POSt's when doing the select command but have not found examples of how to do it. Any help would be fantastic! public string GetJson(HttpQueryString qs) { using (var client = new DAC.US.Web.XmlHttpServiceClient(this.Uri)) { client.Client.DefaultHeaders.Authorization = new Microsoft.Http.Headers.Credential("Basic", DAC.US.Encryption.Hash.WebServiceCredintials); qs.Add("wt", "json"); if (!String.IsNullOrEmpty(this.Version)) qs.Add("version", this.Version); using (var response = client.Get(new Uri(@"select/", UriKind.Relative), qs)) { return response.Content.ReadAsString(); } } }

    Read the article

  • How to fix missing RAID1 drive

    - by Sodved
    I had to do some fiddling about with my cables inside thebox and now I am getting a "Critical Error" about the RAID disks during startup. I have a gigabyte GA-MA770T-UD3 motherboard. Aparently the RAID controller is an AMD SB710 chip. I'm pretty sure I know what happenned. The first time I rebooted I had forgotten the power cable on one of the disks in the RAID1 (mirror) and let it boot up. So I shut down and put the power back in. So now when it boots up I go into the RAID admin interface (between the BIOS screen and the OS loading): it shows the RAID1 as in error the logical device has one disk and says the other is disconnected or missing the other physical disk shows up as a single disk If I boot to the OS (Windows 7 32 bit) the data all seems to be there. If I go into computer management it says my partition is on a disk and working OK. But the other disk is offline because: "The disk is offline because it has a signature collision with another disk that is online" So I am guessing because I STUPIDLY booted up with only one of the disks powered on, the other disk fell out of synch with the mirror and so now cannot rejoin the mirror. How do I fix this? I want to get the RAID1 mirror working again. There does not appear to be any "Repair" option in the basic RAID admin tool which I get into during startup before the OS boots. I have not made any explicit changes to the online one (but I guess the OS has probably written some admin data).

    Read the article

  • Where can I find an array of the (un)assigned Unicode code points for a particular block?

    - by gitparade
    At the moment, I'm writing these arrays by hand. For example, the Miscellaneous Mathematical Symbols-A block has an entry in hash like this: my %symbols = ( ... miscellaneous_mathematical_symbols_a => [(0x27C0..0x27CA), 0x27CC, (0x27D0..0x27EF)], ... ) The simpler, 'continuous' array miscellaneous_mathematical_symbols_a => [0x27C0..0x27EF] doesn't work because Unicode blocks have holes in them. For example, there's nothing at 0x27CB. Take a look at the code chart [PDF]. Writing these arrays by hand is tedious, error-prone and a bit fun. And I get the feeling that someone has already tackled this in Perl!

    Read the article

  • [PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query]

    - by doniyor
    i need help. i am trying to select from database thru sql statement in play framework, but it gives me error, i cannot figure out where the clue is. here is the code: @Transactional public static Users findByUsernameAndPassword(String username, String password){ String hash = DigestUtils.md5Hex(password); Query q = JPA.em().createNativeQuery("select * from USERS where" + "USERNAME=? and PASSWORD=?").setParameter(1, username).setParameter(2, password); List<Users> users = q.getResultList(); if(users.isEmpty()){ return null; } else{ return users.get(0); here is the eror message: [PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query] can someone help me please! any help i would appreciate! thanks

    Read the article

  • NoMethodError using Memcached Sinatra-style

    - by sevennineteen
    I've just installed Memcached on my Mac and updated my Sinatra app configuration as described in Heroku's documentation, but I'm getting a NoMethodError when trying to use the hash-based syntax they specify: >> CACHE['color'] = 'blue' >> CACHE['color'] Using explicit get and set methods as below seems to work fine. >> CACHE.set('color', 'blue') >> CACHE.get('color') If necessary I can use the latter syntax, but the former seems more elegant. I haven't tested this on Heroku's environment since I'd like whatever implementation I use to work on my local environment as well. Thanks!

    Read the article

  • Find a common element within N arrays

    - by kunjaan
    If I have N arrays, what is the best(Time complexity. Space is not important) way to find the common elements. You could just find 1 element and stop. Edit: The elements are all Numbers. Edit: These are unsorted. Please do not sort and scan. This is not a homework problem. Somebody asked me this question a long time ago. He was using a hash to solve the problem. I was thinking if SO has solved similar problems.

    Read the article

  • how to save image and data locally in iphone device

    - by MaheshBabu
    Hi folks, I am getting image and some details from .net web server. I need to store these details in iphone device memory(not in sdcard),Because I need to connect web services only one time,that is at installing my app. From Next time onwards i need to get data from device. I have some knowledge in java,In java i use files to store image and Hash table to store details. How can i done this in iphone. can any one pls help me. Thank u in advance.

    Read the article

  • what is the underlying data structure of a set c++?

    - by zebraman
    I would like to know how a set is implemented in C++. If I were to implement my own set container without using the STL provided container, what would be the best way to go about this task? I understand STL sets are based on the abstract data structure of a binary search tree. So what is the underlying data structure? An array? Also, how does insert() work for a set? How does the set check whether an element already exists in it? I read on wikipedia that another way to implement a set is with a hash table. How would this work?

    Read the article

  • Javascript object encapsulation that tracks changes

    - by Raynos
    Is it possible to create an object container where changes can be tracked Said object is a complex nested object of data. (compliant with JSON). The wrapper allows you to get the object, and save changes, without specifically stating what the changes are Does there exist a design pattern for this kind of encapsulation Deep cloning is not an option since I'm trying to write a wrapper like this to avoid doing just that. The solution of serialization should only be considered if there are no other solutions. An example of use would be var foo = state.get(); // change state state.update(); // or state.save(); client.tell(state.recentChange()); A jsfiddle snippet might help : http://jsfiddle.net/Raynos/kzKEp/ It seems like implementing an internal hash to keep track of changes is the best option. [Edit] To clarify this is actaully done on node.js on the server. The only thing that changes is that the solution can be specific to the V8 implementation.

    Read the article

  • Username correct, password incorrect?

    - by jonnnnnnnnnie
    In a login system, how can you tell if the user has entered the password incorrectly? Do you perform two SQL queries, one to find the username, and then one to find the username and matching (salted+hashed etc) password? I'm asking this because If the user entered the password incorrectly, I want to update the failed_login_attempts column I have. If you perform two queries wouldn't that increase overhead? If you did a query like this, how would you tell if the password entered was correct or not, or whether the username doesn't exist: SELECT * FROM author WHERE username = '$username' AND password = '$password' LIMIT 1 ( ^ NB: I'm keeping it simple, will use hash and salt, and will sanitize input in real one.) Something like this: $user = perform_Query() // get username and password? if ($user['username'] == $username && $user['password'] == $password) { return $user; } elseif($user['username'] == $username && $user['password'] !== $password) { // here the password doesn't match // update failed_login_attemps += 1 }

    Read the article

  • Secure Webservice?

    - by cam
    I'm trying to create a secure webservice (that provides simple database data) with PHP that can be connected to through my Silverlight application. I don't know enough about PHP to be able to see another way to do this. The webservice should only be accessible through the client, and only with the proper username/password. The only two ways I can imagine to do this would be by passing the username/password hash via URL, or use a "hidden form" and do it via POST_. I'm just trying to get past this point, I'm the sole developer on this project and I'm just trying to get past this PHP webservice part so I can get back to being an application programmer :) Normally, I would learn PHP, but I'm on the clock, so I'm just looking for a point in the right direction on how to achieve this!

    Read the article

  • Perl: Greedy nature refuses to work

    - by faezshingeri
    I am trying to replace a string with another string, but the greedy nature doesn't seem to be working for me. Below is my code where "PERFORM GET-APLCY" is identified and replaced properly, but string "PERFORM GET-APLCY-SOI-CVG-WVR" and many other such strings are being replaced by the the replacement string for "PERFORM GET-APLCY". s/PERFORM $func[$i]\.?/# PERFORM $func[$i]\.\n $hash{$func[$i]}/g; where the full stop is optional during string match and replacement. Please help me understand what the issue could be. Thanks in advance, Faez

    Read the article

  • Best way to have unique key over 500M varchar(255) records in mysql/innodb?

    - by taw
    I have url column with unique key over it - but its performance on updates is absolutely atrocious. I suspect that's because the index doesn't all fit in memory. So I was thinking, how about adding a column of md5(url) with 16 bytes of binary data and unique-keying that instead. What would be the best datatype for that? I'd love to be able to just see 32-character hex hash, while mysql would convert it to/from 16 binary bytes and index that, as programs using the database might have some troubles with arbitrary binary data that I'd rather avoid if possible (also I'm a bit afraid that mysql might get some strange ideas about character sets and for example overalocating storage for that by 3:1 because it thinks it might need utf8, how do I avoid that for cure?).

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >