Search Results

Search found 4650 results on 186 pages for 'perfect hash'.

Page 17/186 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • PHP Zend Hash Vulnerability Exploitation Vector [closed]

    - by Resurrected Laplacian
    Possible Duplicate: CVE-2007-5416 PHP Zend Hash Vulnerability Exploitation Vector (Drupal) According to exploit-db, http://www.exploit-db.com/exploits/4510/, it says the following: Example: http://www.example.com/drupal/?_menu[callbacks][1][callback]=drupal_eval&_menu[items][][type]=-1&-312030023=1&q=1/ What are "[callbacks]","[1]" and all these stuffs? What should I put in to these stuffs? Can anyone present a real possible example? I wasn't asking for a real website; I was asking for a possible example! So, how would address be like - what should I put in to these stuffs, as the question says..

    Read the article

  • How can I share Perl data structures through a socket?

    - by pavun_cool
    In sockets I have written the client server program. First I tried to send the normal string among them it sends fine. After that I tried to send the hash and array values from client to server and server to client. When I print the values using Dumper, it gives me only the reference value. What should I do to get the actual values in client server? Server Program: use IO::Socket; use strict; use warnings; my %hash = ( "name" => "pavunkumar " , "age" => 20 ) ; my $new = \%hash ; #Turn on System variable for Buffering output $| = 1; # Creating a a new socket my $socket= IO::Socket::INET->new(LocalPort=>5000,Proto=>'tcp',Localhost => 'localhost','Listen' => 5 , 'Reuse' => 1 ); die "could not create $! \n" unless ( $socket ); print "\nUDPServer Waiting port 5000\n"; my $new_sock = $socket->accept(); my $host = $new_sock->peerhost(); while(<$new_sock>) { #my $line = <$new_sock>; print Dumper "$host $_"; print $new_sock $new . "\n"; } print "$host is closed \n" ; Client Program use IO::Socket; use Data::Dumper ; use warnings ; use strict ; my %hash = ( "file" =>"log.txt" , size => "1000kb") ; my $ref = \%hash ; # This client for connecting the specified below address and port # INET function will create the socket file and establish the connection with # server my $port = shift || 5000 ; my $host = shift || 'localhost'; my $recv_data ; my $send_data; my $socket = new IO::Socket::INET ( PeerAddr => $host , PeerPort => $port , Proto => 'tcp', ) or die "Couldn't connect to Server\n"; while (1) { my $line = <stdin> ; print $socket $ref."\n"; if ( $line = <$socket> ) { print Dumper $line ; } else { print "Server is closed \n"; last ; } } I have given my sample program about what I am doing. Can any one tell me what I am doing wrong in this code? And what I need to do for accessing the hash values?

    Read the article

  • Ruby 1.9: turn these 4 arrays into hash of key/value pairs

    - by randombits
    I have four arrays that are coming in from the client. Let's say that there is an array of names, birth dates, favorite color and location. The idea is I want a hash later where each name will have a hash with respective attributes: Example date coming from the client: [name0, name1, name2, name3] [loc0, loc1] [favcololor0, favcolor1] [bd0, bd1, bd2, bd3, bd4, bd5] Output I'd like to achieve: name0 => { location => loc0, favcolor => favcolor0, bd => bd0 } name1 => { location => loc1, favcolor => favcolor1, bd => bd1 } name2 => { location => nil, favcolor => nil, bd => bd2 } name3 => { location => nil, favcolor => nil, bd => bd3 } I want to have an array at the end of the day where I can iterate and work on each particular person hash. There need not be an equivalent number of values in each array. Meaning, names are required.. and I might receive 5 of them, but I only might receive 3 birth dates, 2 favorite colors and 1 location. Every missing value will result in a nil. How does one make that kind of data structure with Ruby 1.9?

    Read the article

  • eXML-PARSER output contains unwanted hash references

    - by seaworthy
    So I wrote a parser routine to take one xml file and reparse into another one. This code I later modified to split a large xml file into many small xml files. I am having a problem with an output. Parsing works fine the only thing output also includes unwanted strings like HASH(0x19f9b58), I am not sure why and need set of friendly eyes. use Encode; use XML::Parser; my $parser = XML::Parser->new( Handlers => {Start => \&handle_elem_start, End => \&handle_elem_end,Char => \&handle_char_data,}); my $record; my $file = shift @ARGV; if( $file ) {$parser->parsefile( $file );} exit; sub handle_elem_start { my( $expat, $name, %atts ) = @_; if ($name eq 'articles'){$file="_data.xml";unlink($file);} $record .= "<"; $record .= "$name"; foreach my $key (keys %atts){$record .= " $key=\"$atts{$key}\"";} $record .= ">"; } sub handle_char_data { my( $expat, $text ) = @_; $text = decode_utf8( $text ); $record .= "$text"; } sub handle_elem_end { my( $expat, $name ) = @_; $record .= "</$name>"; if( $name eq 'article' ) { open (MYFILE, '>>'.$file); print MYFILE $record; close (MYFILE); print $record; $record = {}; } return unless( $name eq 'article' ); } Sample output: ... </article>HASH(0x19f9b40) <article doi="10.1103/PhysRevSeriesI.9.304"> <journal short="Phys. Rev. (Series I)" jcode="PRI">Physical Review (Series I)</journal> <volume>9</volume> <issue printdate="1899-11-00">5</issue> <fpage>304</fpage> <lpage>309</lpage> <seqno>1</seqno> <price></price><tocsec>Articles</tocsec> <arttype type="article"></arttype><doi>10.1103/PhysRevSeriesI.9.304</doi> <title>An Investigation of the Magnetic Qualities of Building Brick</title> <authgrp> <author><givenname>O.</givenname><middlename>A.</middlename><surname>Gage</surname></author> <author><givenname>H.</givenname><middlename>E.</middlename><surname>Lawrence</surname></author> </authgrp> <cpyrt> <cpyrtdate date="1899"></cpyrtdate><cpyrtholder>The American Physical Society</cpyrtholder> </cpyrt> </article>HASH(0x19f9b58) ... HASH strings are not wanted, please advise.

    Read the article

  • Undefined reference to cmph functions even after installing cpmh library

    - by user1242145
    I am using gcc 4.4.3 on ubuntu. I installed cmph library tools 0.9-1 using command sudo apt-get install libcmph-tools Now, when I tried to compile example program vector_adapter_ex1.c , gcc is able to detect cmph.h library in its include file but is showing multiple errors like vector_adapter_ex1.c:(.text+0x93): undefined reference to cmph_io_vector_adapter' vector_adapter_ex1.c:(.text+0xa3): undefined reference tocmph_config_new' vector_adapter_ex1.c:(.text+0xbb): undefined reference to cmph_config_set_algo' vector_adapter_ex1.c:(.text+0xcf): undefined reference tocmph_config_set_mphf_fd' even though, these are all defined in the source code of the cmph library. Could anyone tell the error that might have occurred or suggest an alternate method to go about building minimal perfect hash functions.

    Read the article

  • passing hashes to a subroutine

    - by Vishalrix
    In one of my main( or primary) routines,I have two or more hashes. I want the subroutine foo() to recieve these possibly-multiple hashes as distinct hashes. Right now I have no preference if they go by value, or as references. I am struggling with this for the last many hours and would appreciate help, so that I dont have to leave perl for php! ( I am using mod_perl, or will be) Right now I have got some answer to my requirement, shown here From http://forums.gentoo.org/viewtopic-t-803720-start-0.html # sub: dump the hash values with the keys '1' and '3' sub dumpvals { foreach $h (@_) { print "1: $h->{1} 3: $h->{3}\n"; } } # initialize an array of anonymous hash references @arr = ({1,2,3,4}, {1,7,3,8}); # create a new hash and add the reference to the array $t{1} = 5; $t{3} = 6; push @arr, \%t; # call the sub dumpvals(@arr); I only want to extend it so that in dumpvals I could do something like this: foreach my %k ( keys @_[0]) { # use $k and @_[0], and others } The syntax is wrong, but I suppose you can tell that I am trying to get the keys of the first hash ( hash1 or h1), and iterate over them. How to do it in the latter code snippet above?

    Read the article

  • comparing salt and hashed passwords during login doesn't seem work right....

    - by Pandiya Chendur
    I stored salt and hash values of password during user registration... But during their login i then salt and hash the password given by the user, what happens is a new salt and a new hash is generated.... string password = collection["Password"]; reg.PasswordSalt = CreateSalt(6); reg.PasswordHash = CreatePasswordHash(password, reg.PasswordSalt); These statements are in both registration and login.... salt and hash during registration was eVSJE84W and 18DE22FED8C378DB7716B0E4B6C0BA54167315A2 During login it was 4YDIeARH and 12E3C1F4F4CFE04EA973D7C65A09A78E2D80AAC7..... Any suggestion.... public static string CreateSalt(int size) { //Generate a cryptographic random number. RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); byte[] buff = new byte[size]; rng.GetBytes(buff); // Return a Base64 string representation of the random number. return Convert.ToBase64String(buff); } public static string CreatePasswordHash(string pwd, string salt) { string saltAndPwd = String.Concat(pwd, salt); string hashedPwd = FormsAuthentication.HashPasswordForStoringInConfigFile( saltAndPwd, "sha1"); return hashedPwd; }

    Read the article

  • Comparing lists of field-hashes with equivalent AR-objects.

    - by Tim Snowhite
    I have a list of hashes, as such: incoming_links = [ {:title => 'blah1', :url => "http://blah.com/post/1"}, {:title => 'blah2', :url => "http://blah.com/post/2"}, {:title => 'blah3', :url => "http://blah.com/post/3"}] And an ActiveRecord model which has fields in the database with some matching rows, say: Link.all => [<Link#2 @title='blah2' @url='...post/2'>, <Link#3 @title='blah3' @url='...post/3'>, <Link#4 @title='blah4' @url='...post/4'>] I'd like to do set operations on Link.all with incoming_links so that I can figure out that <Link#4 ...> is not in the set of incoming_links, and {:title => 'blah1', :url =>'http://blah.com/post/1'} is not in the Link.all set, like so: #pseudocode #incoming_links = as above links = Link.all expired_links = links - incoming_links missing_links = incoming_links - links expired_links.destroy missing_links.each{|link| Link.create(link)} One route I've tried: I'd rather not rewrite Array#- and such, and I'm okay with converting incoming_links to a set of unsaved Link objects; so I've tried overwriting hash eql? and so on in Link so that it ignored the id equality that AR::Base provides by default. But this is the only place this sort of equality should be considered in the application - in other places the Link#id default identity is required. Is there some way I could subclass Link and apply the hash, eql?, etc overwriting there? The other route I've tried is to pull out the attributes hash for each Link and doing a .slice('id',...etc) to prune the hashes down. But this requires writing seperate methods for keeping track of the Link objects while doing set operations on the hashes, or writing seperate Collection classes to wrap the incoming_links hash-list and Link-list which seems a bit overkill. What is the best way to design this interaction? Extra credit for cleanliness.

    Read the article

  • Is there a perfect algorithm for chess?

    - by Overflown
    Dear Stack Overflow community, I was recently in a discussion with a non-coder person on the possibilities of chess computers. I'm not well versed in theory, but think I know enough. I argued that there could not exist a deterministic Turing machine that always won or stalemated at chess. I think that, even if you search the entire space of all combinations of player1/2 moves, the single move that the computer decides upon at each step is based on a heuristic. Being based on a heuristic, it does not necessarily beat ALL of the moves that the opponent could do. My friend thought, to the contrary, that a computer would always win or tie if it never made a "mistake" move (however do you define that?). However, being a programmer who has taken CS, I know that even your good choices - given a wise opponent - can force you to make "mistake" moves in the end. Even if you know everything, your next move is greedy in matching a heuristic. Most chess computers try to match a possible end game to the game in progress, which is essentially a dynamic programming traceback. Again, the endgame in question is avoidable though. -- thanks, Allan Edit: Hmm... looks like I ruffled some feathers here. That's good. Thinking about it again, it seems like there is no theoretical problem with solving a finite game like chess. I would argue that chess is a bit more complicated than checkers in that a win is not necessarily by numerical exhaustion of pieces, but by a mate. My original assertion is probably wrong, but then again I think I've pointed out something that is not yet satisfactorily proven (formally). I guess my thought experiment was that whenever a branch in the tree is taken, then the algorithm (or memorized paths) must find a path to a mate (without getting mated) for any possible branch on the opponent moves. After the discussion, I will buy that given more memory than we can possibly dream of, all these paths could be found.

    Read the article

  • Pixel Perfect Collision Detection in HTML5 Canvas

    - by Armin Ronacher
    Hi, I want to check a collision between two Sprites in HTML5 canvas. So for the sake of the discussion, let's assume that both sprites are IMG objects and a collision means that the alpha channel is not 0. Now both of these sprites can have a rotation around the object's center but no other transformation in case this makes this any easier. Now the obvious solution I came up with would be this: calculate the transformation matrix for both figure out a rough estimation of the area where the code should test (like offset of both + calculated extra space for the rotation) for all the pixels in the intersecting rectangle, transform the coordinate and test the image at the calculated position (rounded to nearest neighbor) for the alpha channel. Then abort on first hit. The problem I see with that is that a) there are no matrix classes in JavaScript which means I have to do that in JavaScript which could be quite slow, I have to test for collisions every frame which makes this pretty expensive. Furthermore I have to replicate something I already have to do on drawing (or what canvas does for me, setting up the matrices). I wonder if I'm missing anything here and if there is an easier solution for collision detection.

    Read the article

  • Use of double pointer in linux kernel Hash list implementation

    - by bala1486
    Hi, I am trying to understand Linux Kernel implementation of linked list and hash table. A link to the implementation is here. I understood the linked list implementation. But i am little confused of why double pointers is being used in hlist (**pprev). Link for hlist is here. I understand that hlist is used in implementation of hash table since head of the list requires only one pointer and it saves space. Why cant it be done using single pointer (just *prev like the linked list)? Please help me.

    Read the article

  • location.hash in an iframe scrolls the parent window

    - by Ben Clayton
    Hi all. I have a page with an iframe. Inside the iframe is code (that I can't change) that sets location.hash to the id of an element in the iframe window. This has the unwanted effect of scrolling my outermost browser window so that the top of the window touches the top of the iframe. This is quite annoying as I have a toolbar above the iframe that is vital to my app. Is there any way of preventing the setting of location.hash affecting the scroll position of the main window? Will preventDefault help me out here? Thanks!

    Read the article

  • php selecting hash using wildcards

    - by tipu
    Say I have a hashmap, $hash = array('fox' => 'some value', 'fort' => 'some value 2', 'fork' => 'some value again); I am trying to accomplish an autocomplete feature. When the user types 'fo', I would like to retrieve, via ajax, the 3 keys from $hash. When the user types 'for', I would like to only retrieve the keys fort and fork. Is this possible? What I was thinking was using binary search to isolate the keys with 'f', instead of brute-force searching. Then continue eliminating the indexes as the user types out their query. Is there a more efficient solution to this?

    Read the article

  • Hashes vs Numeric id's

    - by Karan Bhangui
    When creating a web application that some how displays the display of a unique identifier for a recurring entity (videos on YouTube, or book section on a site like mine), would it be better to use a uniform length identifier like a hash or the unique key of the item in the database (1, 2, 3, etc). Besides revealing a little, what I think is immaterial, information about the internals of your app, why would using a hash be better than just using the unique id? In short: Which is better to use as a publicly displayed unique identifier - a hash value, or a unique key from the database? Edit: I'm opening up this question again because Dmitriy brought up the good point of not tying down the naming to db specific property. Will this sort of tie down prevent me from optimizing/normalizing the database in the future? The platform uses php/python with ISAM /w MySQL.

    Read the article

  • Sorting nested hash in ruby

    - by Rabbott
    Provided the following ruby hash: { cat: { 1: 2, 2: 10, 3: 11, 4: 1 }, wings: { 1: 3, 2: 5, 3: 7, 4: 7 }, grimace: { 1: 4, 2: 5, 3: 5, 4: 1 }, stubborn: { 1: 5, 2: 3, 3: 7, 4: 5 } } How can I sort the hash by the sum of 'leaf' excluding "4", for instance the value to compare for "cat" would be (2 + 10 + 11) = 23, the value for "wings" would be (3 + 5 + 7) = 15 so if I was comparing just those two they would be in the correct order, highest sum on top. It is safe to assume that it will ALWAYS be {1: value, 2: value, 3: value, 4: value} as those are keys for constants I have defined. It is also safe to assume that I will only ever want to exclude the key "4", and always use the keys "1", "2", and "3"

    Read the article

  • SimpleXML adding html into Hash tree

    - by Miriam Raphael Roberts
    Question: I have an xml file that I am pulling from the web and parsing. One of the items in the xml is a 'content' value that has HTML. I am using SimpleXML/XMLin to parse the file like so: $xml= eval { $data-XMLin($xmldata, forcearray = 1, suppressempty= +'') }; When I use Dumper to dump the hash, I dsicovered that SimpleXML is parsing the HTML into the hash tree. 'content' => { 'div' => [ { 'xmlns' => 'http://www.w3.org/1999/xhtml', 'p' => [ { 'a' => [ { 'href' => 'http://miamiherald.typepad.com/.a/6a00d83451b26169e20133ec6f4491970b-pi', 'style' => 'FLOAT: left', 'img' => [ etc..... This is not what I want. I want to just grab content inside of this entry. How do I do this?

    Read the article

  • Hashing a python method to regenerate output when method is modified

    - by Seth Johnson
    I have a python method that has a deterministic result. It takes a long time to run and generates a large output: def time_consuming_method(): # lots_of_computing_time to come up with the_result return the_result I modify time_consuming_method from time to time, but I would like to avoid having it run again while it's unchanged. [Time_consuming_method only depends on functions that are immutable for the purposes considered here; i.e. it might have functions from Python libraries but not from other pieces of my code that I'd change.] The solution that suggests itself to me is to cache the output and also cache some "hash" of the function. If the hash changes, the function will have been modified, and we have to re-generate the output. Is this possible or a ridiculous idea? If this isn't a terrible idea, is the best implementation to write f = """ def ridiculous_method(): a = # # lots_of_computing_time return a """ , use the hashlib module to compute a hash for f, and use compile or eval to run it as code?

    Read the article

  • GWT in its web-mode throws StatusCodeException but in its hosted-mode , it's working perfect

    - by broshni
    Hi to all, I am new to this forum. Actually I have an issue here regarding my application which is hibernate+struts based application. Recently we have decided to integrate GWT into our application. We are using gwt 1.5.3 build. We have set up everything exactly as we find in documentation and various blogs. Yeah I am now in a very nervy state as gwt in its web- mode is treating me in a very embarassing manner. But it is compiling and working perfectly fine in its hosted-mode and everything works fine as we expected and designed. When I try to integrate GWT with our application i.e. running in tomcat (http://localhost:8080/myapps/example.do? reqCode=takeMeToGWT&userId=12&templateId=10). The gwt page is loaded partially and in the midst it throws an exception i.e. StatusCodeException. This doesn't happen when I run the gwt application in hosted-mode ( http://localhost:8888/com.myapp.gwt.MyApp/Home.html ) . I am using Intellij Idea 8, struts 1.3 ,hibernate 3 and tomcat 5.5 . Expecting your responses at the earliest possible time. Thanking you B Roshnikanta Sharma [email protected]

    Read the article

  • Using a password to generate two distinct hashes without reducing password security

    - by Nevins
    Hi there, I'm in the process of designing a web application that will require the storage of GPG keys in an encrypted format in a database. I'm planning on storing the user's password in a bCrypt hash in the database. What I would like to be able to do is to use that bCrypt to authenticate the user then use the combination of the stored bCrypt hash and another hash of the password to encrypt and decrypt the GPG keys. My question is whether I can do this without reducing the security of the password? I was thinking I may be able to use something like an HMAC-SHA256 of a static string using the password and a salt as the secret key. Is there a better way to do this that I haven't thought of? Thanks

    Read the article

  • class method as hash value

    - by demas
    I have this working code: class Server def handle(&block) @block = block end def do @block.call end end class Client def initialize @server = Server.new @server.handle { action } end def action puts "some" end def call_server @server.do end end client = Client.new client.call_server My Server will handle more then one action so I want to change code such way: class Server def handle(options) @block = options[:on_filter] end def do @block.call end end class Client def initialize @server = Server.new my_hash = { :on_filter => action } @server.handle(my_hash) end def action puts "some" end def call_server @server.do end end client = Client.new client.call_server It is incorrect code because action() method calls on create my_hash, but if I try to modify code to: my_hash = { :on_filter => { action } } i get error message. Is it possible to create hash with methods as hash values ?

    Read the article

  • python-nth perfect square

    - by kasyap
    Write a program that computes the sum of the logarithms of all the primes from 2 to some number n, and print out the sum of the logs of the primes, the number n, and the ratio of these two quantities. Test this for different values of n.

    Read the article

  • Are MongoDB and CouchDB perfect substitutes?

    - by raoulsson
    I haven't got my hands dirty yet with neither CouchDB nor MongoDB but I would like to do so soon... I also have read a bit about both systems and it looks to me like they cover the same cases... Or am I missing a key distinguishing feature? I would like to use a document based storage instead of a traditional RDBMS in my next project. I also need the datastore to handle large binary objects (images and videos) automatically replicate itself to physically separate nodes rendering the need of an additional RDBMS superfluous Are both equally well suited for these requirements? Thanks!

    Read the article

  • What c# equivalent encoding does Python's hash.digest() use ?

    - by The_AlienCoder
    I am trying to port a python program to c#. Here is the line that's supposed to be a walkthrough but is currently tormenting me: hash = hashlib.md5(inputstring).digest() After generating a similar MD5 hash in c# It is absolutely vital that I create a similar hash string as the original python program or my whole application will fail. My confusion lies in which encoding to use when converting to string in c# i.e ?Encoding enc = new ?Encoding(); string Hash =enc.GetString(HashBytes); //HashBytes is my generated hash Because I am unable to create two similar hashes when using Encoding.Default i.e string Hash = Encoding.Default.GetString(HashBytes); So I'm thinking knowing the deafult hash.digest() encoding for python would help

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >