Search Results

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

Page 99/134 | < Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >

  • How come ftp protocol produces transmission errors sometimes if the data is using TCP, which is checksummed?

    - by Cray
    Every once in a while, downloading (especially large) files through ftp will produce errors. I am guessing that's also partly the reason why all major sites are publishing external checksums along with their downloads. How is this possible if ftp goes through TCP, which has checksum inbuilt and resends data if it is transmitted corruptly? One could argue that this is due to the short length of the CRC in the TCP protocol (which is 16bit I think, or something like that), and the collisions are simply happening too often. but 1) for this to be true, not only must there be a CRC collision, but also the random network error must modify both the CRC in the packet, and the packet itself so that the CRC will be valid for the new packet... Even with 16 bitCRC, is that so likely? 2) There are seemingly not many errors in, say, browsing the web which also goes through TCPIP.

    Read the article

  • How can I implement the Gale-Shapley stable marriage algorithm in Perl?

    - by srk
    Problem : We have equal number of men and women.each men has a preference score toward each woman. So do the woman for each man. each of the men and women have certain interests. Based on the interest we calculate the preference scores. So initially we have an input in a file having x columns. First column is the person(men/woman) id. id are nothing but 0.. n numbers.(first half are men and next half woman) the remaining x-1 columns will have the interests. these are integers too. now using this n by x-1 matrix... we have come up with a n by n/2 matrix. the new matrix has all men and woman as their rows and scores for opposite sex in columns. We have to sort the scores in descending order, also we need to know the id of person related to the scores after sorting. So here i wanted to use hash table. once we get the scores we need to make up pairs.. for which we need to follow some rules. My trouble is with the second matrix of n by n/2 that needs to give information of which man/woman has how much preference on a woman/man. I need these scores sorted so that i know who is the first preferred woman/man, 2nd preferred and so on for a man/woman. I hope to get good suggestions on the data structures i use.. I prefer php or perl. Thank you in advance Hey guys this is not an home work. This a little modified version of stable marriage algorithm. I have working solution. I am only working on optimizing my code. more info: It is very similar to stable marriage problem but here we need to calculate the scores based on the interests they share. So i have implemented it as the way you see in the wiki page http://en.wikipedia.org/wiki/Stable_marriage_problem. my problem is not solving the problem. i solved it and can run it. I am just trying to have a better solution. so i am asking suggestions on the type of data structure to use. Conceptually I tried using an array of hashes. where the array index give the person id and the hash in it gives the id's <= score's in sorted manner. I initially start with an array of hashes. now i sort the hashes on values, but i could not store the sorted hashes back in an array.So just stored the keys after sorting and used these to get the values from my initial unsorted hashes. Can we store the hashes after sorting ? Can you suggest a better structure ?

    Read the article

  • Making my XNA sprite jump properly

    - by Matthew Morgan
    I have been having great trouble getting my sprite to jump. So far I have a section of code which with a single tap of "W" will send the sprite in a constant velocity upwards. I need to be able to make my sprite come back down to the ground a certain time or height after begining the jump. There is also a constant pull of velocity 2 on the sprite to simulate some kind of gravity. // Walking = true when there is collision detected between the sprite and ground if (Walking == true) if (keystate.IsKeyDown(Keys.W)) { Jumping = true; } if (Jumping == true) { spritePosition.Y -= 10; } Any ideas and help would be appreciated but I'd prefer a modified version of my code posted if at all possible.

    Read the article

  • Did I find a bug in PHP's `crypt()`?

    - by Nathan Long
    I think I may have found a bug in PHP's crypt() function under Windows. However: I recognize that it's probably my fault. PHP is used by millions and worked on by thousands; my code is used by tens and worked on by me. (This argument is best explained on Coding Horror.) So I'm asking for help: show me my fault. I've been trying to find it for a few days now, with no luck. The setup I'm using a Windows server installation with Apache 2.2.14 (Win32) and PHP 5.3.2. My development box runs Windows XP Professional; the 'production' server (this is an intranet setup) runs Windows Storage Server 2003. The problem happens on both. I don't see anything in php.ini related to crypt(), but will happily answer questions about my config. The problem Several scripts in my PHP app occasionally hang: the page sits there on 'waiting for localhost' and never finishes. Each of these scripts uses crypt to hash a user's password before storing it in the database, or, in the case of the login page, to hash the entered password before comparing it to the version stored in the database. Since the login page is the simplest, I focused on it for testing. I repeatedly logged in, and found that it would hang maybe 4 out of 10 times. As an experiment, I changed the login page to use the plain text password and changed my password in the database to its plain text version. The page stopped hanging. I saw that PHP's latest version lists this bugfix: Fixed bug #51059 (crypt crashes when invalid salt are [sic] given). So I created a very simple test script, as follows, using the same salt given in an official example: $foo = crypt('rasmuslerdorf','r1'); echo $foo; This page, too, will hang, if I reload it like crazy. I only see it hanging in Chrome, but regardless of browser, the effect on Apache is the same. Effect on Apache When these pages hang, Apache's server-status page (which I explained here, regarding a different problem) increments the number of requests being processed and decrements the number of idle workers. The requests being processed almost all have a status of 'Sending Reply,' though sometimes for a moment they will show either 'Reading request' or 'keepalive (read).' Eventually, Apache may crash. When it does, the Windows crash report looks like this: szAppName: httpd.exe szAppVer: 2.2.14.0 szModName: php5ts.dll szModVer: 5.3.1.0 // OK, this report was before I upgraded to PHP 5.3.2, // but that didn't fix it offset: 00a2615 Is it my fault? I'm tempted to file a bug report to PHP on this. The argument against it is, as stated above, that bugs are nearly always my fault. However, my argument in favor of 'it's PHP's fault' is: I'm using Windows, whereas most servers use Linux (I don't get to choose this), so the chances are greater that I've found an edge case There was recently a bug with crypt(), so maybe it still has issues I have made the simplest test case I can, and I still have the problem Can anyone duplicate this? Can you suggest where I've gone wrong? Should I file the bug after all? Thanks in advance for any help you may give.

    Read the article

  • Cygwin bash syntax error - but script run perfectly well in Ubuntu

    - by Michael Mao
    #!/bin/bash if test "$#" == "4"; then echo "$*"; else echo "args-error" >&2; fi; This little code snippet troubles me a lot when I tried to run it on both Ubuntu and Cygwin. Ubuntu runs bash version 4.0+ whereas Cygwin runs 3.2.49; But I reckon version collision shall not be the cause of this, this code runs well under fedora 10 which is also using bash version 3.+ So basically I am wondering if there is a way to code my script once and for all so there are not to have this awful issue later on. Many thanks in advance.

    Read the article

  • g++ symbol versioning. Set it to GCC_3.0 using version 4 of g++

    - by Ismael
    Hi all I need to implemente a Java class which uses JNI to control a fiscal printer in XUbuntu 8.10 with sun-java6-jdk installed. The structure is the following: EpsonDriver.java loads libEpson.so libEpson is linked dynamically with EpsonFiscalProtocol.so ( provided by Epson, no source available ) and pthread I use javah to generate the header file, and the code compiles. Then I put the libEpson.so in $JAVA_HOME/jre/lib/i386, and EpsonDriver.java uses an static initializar System.loadLibrary("libEpson") That part works, however, when I try to use any of the methods I get an unsatisfiedLinkError exception. Some time ago, a coworker did a version that works, and using objdump -Dslx I got the following: Program Header: LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12 filesz 0x0000ccc4 memsz 0x0000ccc4 flags r-x LOAD off 0x0000d000 vaddr 0x0000d000 paddr 0x0000d000 align 2**12 filesz 0x00000250 memsz 0x00044a5c flags rw- DYNAMIC off 0x0000d014 vaddr 0x0000d014 paddr 0x0000d014 align 2**2 filesz 0x000000f0 memsz 0x000000f0 flags rw- NOTE off 0x000000d4 vaddr 0x000000d4 paddr 0x000000d4 align 2**2 filesz 0x00000024 memsz 0x00000024 flags r-- STACK off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2 filesz 0x00000000 memsz 0x00000000 flags rw- Dynamic Section: NEEDED EpsonFiscalProtocol.so NEEDED libpthread.so.0 NEEDED libstdc++.so.6 NEEDED libm.so.6 NEEDED libc.so.6 SONAME libcom_tichile_jpos_EpsonSerialDriver.so INIT 0x00007254 FINI 0x0000ba08 GNU_HASH 0x000000f8 STRTAB 0x00001f50 SYMTAB 0x00000ae0 STRSZ 0x00002384 SYMENT 0x00000010 PLTGOT 0x0000d108 PLTRELSZ 0x00000008 PLTREL 0x00000011 JMPREL 0x0000724c REL 0x000045c4 RELSZ 0x00002c88 RELENT 0x00000008 TEXTREL 0x00000000 VERNEED 0x00004564 VERNEEDNUM 0x00000002 VERSYM 0x000042d4 RELCOUNT 0x000000ac Version References: required from libstdc++.so.6: 0x056bafd3 0x00 05 CXXABI_1.3 0x08922974 0x00 04 GLIBCXX_3.4 required from libc.so.6: 0x0b792650 0x00 03 GCC_3.0 0x0d696910 0x00 02 GLIBC_2.0 In the recently compiled file I get: Program Header: LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12 filesz 0x00005300 memsz 0x00005300 flags r-x LOAD off 0x00005300 vaddr 0x00006300 paddr 0x00006300 align 2**12 filesz 0x00000274 memsz 0x00010314 flags rw- DYNAMIC off 0x00005314 vaddr 0x00006314 paddr 0x00006314 align 2**2 filesz 0x000000e0 memsz 0x000000e0 flags rw- EH_FRAME off 0x00004a00 vaddr 0x00004a00 paddr 0x00004a00 align 2**2 filesz 0x00000154 memsz 0x00000154 flags r-- Dynamic Section: NEEDED libstdc++.so.5 NEEDED libm.so.6 NEEDED libgcc_s.so.1 NEEDED libc.so.6 SONAME EpsonFiscalProtocol.so INIT 0x00001cb4 FINI 0x00004994 HASH 0x000000b4 STRTAB 0x00000da4 SYMTAB 0x000004f4 STRSZ 0x00000acf SYMENT 0x00000010 PLTGOT 0x0000640c PLTRELSZ 0x00000270 PLTREL 0x00000011 JMPREL 0x00001a44 REL 0x000019dc RELSZ 0x00000068 RELENT 0x00000008 VERNEED 0x0000198c VERNEEDNUM 0x00000002 VERSYM 0x00001874 RELCOUNT 0x00000004 Version References: required from libstdc++.so.5: 0x056bafd2 0x00 04 CXXABI_1.2 required from libc.so.6: 0x09691f73 0x00 03 GLIBC_2.1.3 0x0d696910 0x00 02 GLIBC_2.0 So I suspect the main diference is the GCC_3.0 symbol I compile libcom_tichile_EpsonSerialDriver.so with the following command ( from memory as I not at work right now ) g++ -Wl,-soname=.... -shared -I/*jni libraries*/ -o libcom_tichile_jpos_EpsonSerialDriver -lEpsonFiscalProtocol -lpthread Is there any way to tell g++ to use that symbol version? Or any idea in how to make it work? EDIT: I have another non-working version with the followin dump: Program Header: LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12 filesz 0x0000bf68 memsz 0x0000bf68 flags r-x LOAD off 0x0000cc0c vaddr 0x0000cc0c paddr 0x0000cc0c align 2**12 filesz 0x000005e8 memsz 0x00044df0 flags rw- DYNAMIC off 0x0000cc20 vaddr 0x0000cc20 paddr 0x0000cc20 align 2**2 filesz 0x000000f8 memsz 0x000000f8 flags rw- EH_FRAME off 0x0000b310 vaddr 0x0000b310 paddr 0x0000b310 align 2**2 filesz 0x000002bc memsz 0x000002bc flags r-- STACK off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2 filesz 0x00000000 memsz 0x00000000 flags rw- RELRO off 0x0000cc0c vaddr 0x0000cc0c paddr 0x0000cc0c align 2**0 filesz 0x000003f4 memsz 0x000003f4 flags r-- Dynamic Section: NEEDED EpsonFiscalProtocol.so NEEDED libpthread.so.0 NEEDED libstdc++.so.6 NEEDED libm.so.6 NEEDED libgcc_s.so.1 NEEDED libc.so.6 SONAME libcom_tichile_jpos_EpsonSerialDriver.so INIT 0x000055d8 FINI 0x0000a968 HASH 0x000000f4 GNU_HASH 0x00000a30 STRTAB 0x00002870 SYMTAB 0x00001410 STRSZ 0x00002339 SYMENT 0x00000010 PLTGOT 0x0000cff4 PLTRELSZ 0x00000168 PLTREL 0x00000011 JMPREL 0x00005470 REL 0x00004ea8 RELSZ 0x000005c8 RELENT 0x00000008 VERNEED 0x00004e38 VERNEEDNUM 0x00000002 VERSYM 0x00004baa RELCOUNT 0x00000001 Version References: required from libstdc++.so.6: 0x056bafd3 0x00 05 CXXABI_1.3 0x08922974 0x00 03 GLIBCXX_3.4 required from libc.so.6: 0x09691f73 0x00 06 GLIBC_2.1.3 0x0d696914 0x00 04 GLIBC_2.4 0x0d696910 0x00 02 GLIBC_2.0 Now I think the main difference is in the GCC_3.0 symbol/ABI EDIT: Luckily, a coworker found a way to talk to the printer using Java

    Read the article

  • When are you truly forced to use UUID as part of the design?

    - by Pyrolistical
    I don't really see the point of UUID. I know the probability of a collision is effectively nil, but effectively nil is not even close to impossible. Can somebody give an example where you have no choice but to use UUID? From all the uses I've seen, I can see an alternative design without UUID. Sure the design might be slightly more complicated, but at least it doesn't have a non-zero probability of failure. UUID smells like global variables to me. There are many ways global variables make for simpler design, but its just lazy design.

    Read the article

  • PHP and Enums

    - by Henrik Paul
    I know that PHP doesn't have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto completion features could understand. Constants do the trick, but there's the namespace collision problem and (or actually because) they're global. Arrays don't have the namespace problem, but they're too vague, they can be overwritten at runtime and IDEs rarely (never?) know how to autofill their keys. Are there any solutions/workarounds you commonly use? Does anyone recall whether the PHP guys have had any thoughts or decisions around enums?

    Read the article

  • Amazon S3 collisions with heroku and paperclip

    - by poseid
    I have an app on my localhost for development and an app for testing on heroku. Image upload with localhost and paperclip always works. However, doing the same experiment with image upload on my heroku app, the app hangs... and the upload seems to be going on forever. I suspect that there is a collision going on. What is needed to get but uploads working? Or do I need to use different buckets for each environment?

    Read the article

  • Choosing a type for search results in C#

    - by Chris M
    I have a result set that will never exceed 500; the results that come back from the web-service are assigned to a search results object. The data from the webservice is about 2mb; the bit I want to use is about a third of each record, so this allows me to cache and quickly manipulate it. I want to be able to sort and filter the results with the least amount of overhead and as fast as possible so I used the VCSKICKS timing class to measure their performance Average Total (10,000) Type Create Sort Create Sort HashSet 0.1579 0.0003 1579 3 IList 0.0633 0.0002 633 2 IQueryable 0.0072 0.0432 72 432 Measured in Seconds using http://www.vcskicks.com/algorithm-performance.php I created the hashset through a for loop over the web-service response (adding to the hashset). The List & IQueryable were created using LINQ. Question I can understand why HashSet takes longer to create (the foreach loop vs linq); but why would IQueryable take longer to sort than the other two; and finally is there a better way to assign the HashSet. Thanks Actual Program public class Program { private static AuthenticationHeader _authHeader; private static OPSoapClient _opSession; private static AccommodationSearchResponse _searchResults; private static HashSet<SearchResults> _myHash; private static IList<SearchResults> _myList; private static IQueryable<SearchResults> _myIQuery; static void Main(string[] args) { #region Setup WebService _authHeader = new AuthenticationHeader { UserName = "xx", Password = "xx" }; _opSession = new OPSoapClient(); #region Setup Search Results _searchResults = _opgSession.SearchCR(_authHeader, "ENG", "GBP", "GBR"); #endregion Setup Search Results #endregion Setup WebService // HASHSET SpeedTester hashTest = new SpeedTester(TestHashSet); hashTest.RunTest(); Console.WriteLine("- Hash Test \nAverage Running Time: {0}; Total Time: {1}", hashTest.AverageRunningTime, hashTest.TotalRunningTime); SpeedTester hashSortTest = new SpeedTester(TestSortingHashSet); hashSortTest.RunTest(); Console.WriteLine("- Hash Sort Test \nAverage Running Time: {0}; Total Time: {1}", hashSortTest.AverageRunningTime, hashSortTest.TotalRunningTime); // ILIST SpeedTester listTest = new SpeedTester(TestList); listTest.RunTest(); Console.WriteLine("- List Test \nAverage Running Time: {0}; Total Time: {1}", listTest.AverageRunningTime, listTest.TotalRunningTime); SpeedTester listSortTest = new SpeedTester(TestSortingList); listSortTest.RunTest(); Console.WriteLine("- List Sort Test \nAverage Running Time: {0}; Total Time: {1}", listSortTest.AverageRunningTime, listSortTest.TotalRunningTime); // IQUERIABLE SpeedTester iqueryTest = new SpeedTester(TestIQueriable); iqueryTest.RunTest(); Console.WriteLine("- iquery Test \nAverage Running Time: {0}; Total Time: {1}", iqueryTest.AverageRunningTime, iqueryTest.TotalRunningTime); SpeedTester iquerySortTest = new SpeedTester(TestSortableIQueriable); iquerySortTest.RunTest(); Console.WriteLine("- iquery Sort Test \nAverage Running Time: {0}; Total Time: {1}", iquerySortTest.AverageRunningTime, iquerySortTest.TotalRunningTime); } static void TestHashSet() { var test = _searchResults.Items; _myHash = new HashSet<SearchResults>(); foreach(var x in test) { _myHash.Add(new SearchResults { Ref = x.Ref, Price = x.StandardPrice }); } } static void TestSortingHashSet() { var sorted = _myHash.OrderBy(s => s.Price); } static void TestList() { var test = _searchResults.Items; _myList = (from x in test select new SearchResults { Ref = x.Ref, Price = x.StandardPrice }).ToList(); } static void TestSortingList() { var sorted = _myList.OrderBy(s => s.Price); } static void TestIQueriable() { var test = _searchResults.Items; _myIQuery = (from x in test select new SearchResults { Ref = x.Ref, Price = x.StandardPrice }).AsQueryable(); } static void TestSortableIQueriable() { var sorted = _myIQuery.OrderBy(s => s.Price); } }

    Read the article

  • Opinions on Dual-Salt authentication for low sensitivity user accounts?

    - by Heleon
    EDIT - Might be useful for someone in the future... Looking around the bcrypt class in php a little more, I think I understand what's going on, and why bcrypt is secure. In essence, I create a random blowfish salt, which contains the number of crypt rounds to perform during the encryption step, which is then hashed using the crypt() function in php. There is no need for me to store the salt I used in the database, because it's not directly needed to decrypt, and the only way to gain a password match to an email address (without knowing the salt values or number of rounds) would be to brute force plain text passwords against the hash stored in the database using the crypt() function to verify, which, if you've got a strong password, would just be more effort than it's worth for the user information i'm storing... I am currently working on a web project requiring user accounts. The application is CodeIgniter on the server side, so I am using Ion Auth as the authentication library. I have written an authentication system before, where I used 2 salts to secure the passwords. One was a server-wide salt which sat as an environment variable in the .htaccess file, and the other was a randomly generated salt which was created at user signup. This was the method I used in that authentication system for hashing the password: $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; //create a random string to be used as the random salt for the password hash $size = strlen($chars); for($i = 0; $i < 22; $i++) { $str .= $chars[rand(0, $size - 1)]; } //create the random salt to be used for the crypt $r_blowfish_salt = "$2a$12$" . $str . "$"; //grab the website salt $salt = getenv('WEBSITE_SALT'); //combine the website salt, and the password $password_to_hash = $pwd . $salt; //crypt the password string using blowfish $password = crypt($password_to_hash, $r_blowfish_salt); I have no idea whether this has holes in it or not, but regardless, I moved over to Ion Auth for a more complete set of functions to use with CI. I noticed that Ion only uses a single salt as part of its hashing mechanism (although does recommend that encryption_key is set in order to secure the database session.) The information that will be stored in my database is things like name, email address, location by country, some notes (which will be recommended that they do not contain sensitive information), and a link to a Facebook, Twitter or Flickr account. Based on this, i'm not convinced it's necessary for me to have an SSL connection on the secure pages of my site. My question is, is there a particular reason why only 1 salt is being used as part as the Ion Auth library? Is it implied that I write my own additional salting in front of the functionality it provides, or am I missing something? Furthermore, is it even worth using 2 salts, or once an attacker has the random salt and the hashed password, are all bets off anyway? (I assume not, but worth checking if i'm worrying about nothing...)

    Read the article

  • Scale an image every time it collide with another

    - by jean mayot
    here is my code : -(void)collision{ if(CGRectIntersectsRect(imageView.frame,centre.frame)){ imageView.alpha=0; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:1.0f]; centre.transform=CGAffineTransformMakeScale(1.3, 1.3); [UIView commitAnimations]; } } When imageView collide with centre centre become bigger. my problem is that when "imageView" collide with "centre" a second time the animation doesn't work. I want to make centre bigger and bigger and bigger every time imageView collide with center, but it become bigger just one time . Sorry for my english I'm french :/ How can I solve this please ?

    Read the article

  • Dynamic dispatch and inheritance in python

    - by Bill Zimmerman
    Hi, I'm trying to modify Guido's multimethod (dynamic dispatch code): http://www.artima.com/weblogs/viewpost.jsp?thread=101605 to handle inheritance and possibly out of order arguments. e.g. (inheritance problem) class A(object): pass class B(A): pass @multimethod(A,A) def foo(arg1,arg2): print 'works' foo(A(),A()) #works foo(A(),B()) #fails Is there a better way than iteratively checking for the super() of each item until one is found? e.g. (argument ordering problem) I was thinking of this from a collision detection standpoint. e.g. foo(Car(),Truck()) and foo(Truck(), Car()) and should both trigger foo(Car,Truck) # Note: @multimethod(Truck,Car) will throw an exception if @multimethod(Car,Truck) was registered first? I'm looking specifically for an 'elegant' solution. I know that I could just brute force my way through all the possibilities, but I'm trying to avoid that. I just wanted to get some input/ideas before sitting down and pounding out a solution. Thanks

    Read the article

  • MySQL and INT auto_increment fields

    - by PHPguy
    Hello folks, I'm developing in LAMP (Linux+Apache+MySQL+PHP) since I remember myself. But one question was bugging me for years now. I hope you can help me to find an answer and point me into the right direction. Here is my challenge: Say, we are creating a community website, where we allow our users to register. The MySQL table where we store all users would look then like this: CREATE TABLE `users` ( `uid` int(2) unsigned NOT NULL auto_increment COMMENT 'User ID', `name` varchar(20) NOT NULL, `password` varchar(32) NOT NULL COMMENT 'Password is saved as a 32-bytes hash, never in plain text', `email` varchar(64) NOT NULL, `created` int(11) unsigned NOT NULL default '0' COMMENT 'Timestamp of registration', `updated` int(11) unsigned NOT NULL default '0' COMMENT 'Timestamp of profile update, e.g. change of email', PRIMARY KEY (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; So, from this snippet you can see that we have a unique and automatically incrementing for every new user 'uid' field. As on every good and loyal community website we need to provide users with possibility to completely delete their profile if they want to cancel their participation in our community. Here comes my problem. Let's say we have 3 registered users: Alice (uid = 1), Bob (uid = 2) and Chris (uid = 3). Now Bob want to delete his profile and stop using our community. If we delete Bob's profile from the 'users' table then his missing 'uid' will create a gap which will be never filled again. In my opinion it's a huge waste of uid's. I see 3 possible solutions here: 1) Increase the capacity of the 'uid' field in our table from SMALLINT (int(2)) to, for example, BIGINT (int(8)) and ignore the fact that some of the uid's will be wasted. 2) introduce the new field 'is_deleted', which will be used to mark deleted profiles (but keep them in the table, instead of deleting them) to re-utilize their uid's for newly registered users. The table will look then like this: CREATE TABLE `users` ( `uid` int(2) unsigned NOT NULL auto_increment COMMENT 'User ID', `name` varchar(20) NOT NULL, `password` varchar(32) NOT NULL COMMENT 'Password is saved as a 32-bytes hash, never in plain text', `email` varchar(64) NOT NULL, `is_deleted` int(1) unsigned NOT NULL default '0' COMMENT 'If equal to "1" then the profile has been deleted and will be re-used for new registrations', `created` int(11) unsigned NOT NULL default '0' COMMENT 'Timestamp of registration', `updated` int(11) unsigned NOT NULL default '0' COMMENT 'Timestamp of profile update, e.g. change of email', PRIMARY KEY (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 3) Write a script to shift all following user records once a previous record has been deleted. E.g. in our case when Bob (uid = 2) decides to remove his profile, we would replace his record with the record of Chris (uid = 3), so that uid of Chris becomes qual to 2 and mark (is_deleted = '1') the old record of Chris as vacant for the new users. In this case we keep the chronological order of uid's according to the registration time, so that the older users have lower uid's. Please, advice me now which way is the right way to handle the gaps in the auto_increment fields. This is just one example with users, but such cases occur very often in my programming experience. Thanks in advance!

    Read the article

  • How secure are GUIDs in terms of predictability?

    - by ssg
    We're using .NET's Guid.NewGuid() to generate activation codes and API keys currently. I wonder if that poses a security problem since their algorithm is open. .NET Guid uses Win32 CoCreateGuid and I don't know it's internals (possibly MAC address + timestamp?). Can someone derive a second GUID out of the first one, or can he hit it with some smart guesses or is the randomness good enough so search space becomes too big? Generating random keys have the problem of collision, they need a double check before adding to a database. That's why we stuck with GUIDs but I'm unsure about their security for these purposes. Here are the 4 consecutive UUIDGEN outputs: c44dc549-5d92-4330-b451-b29a87848993 d56d4c8d-bfba-4b95-8332-e86d7f204c1c 63cdf958-9d5a-4b63-ae65-74e4237888ea 6fd09369-0fbd-456d-9c06-27fef4c8eca5 Here are 4 of them by Guid.NewGuid(): 0652b193-64c6-4c5e-ad06-9990e1ee3791 374b6313-34a0-4c28-b336-bb2ecd879d0f 3c5a345f-3865-4420-a62c-1cdfd2defed9 5b09d7dc-8546-4ccf-9c85-de0bf4f43bf0

    Read the article

  • Calculating terrain height in 3d-space

    - by Jonas B
    Hi I'm diving into 3d programming a bit and am currently learning by writing a procedural terrain generator that generates terrain based on a heightmap. I would also want to implement some physics and my first attempt at terrain collision was by simply checking the current position vs the heightmap. This however wont work well against small objects as you'd have to calculate the height by taking the heightdifference of the nearest vertices of the object and doing this every colision check is pretty slow. Beleive me I tried googling for it but there's simply so much crap and millions of blogs posting ripped-of newbie tutorials everywhere with basically no real information on the subject, I can't find anything that explains it or even names any generally used techniques. I'm not asking for code or a complete solution, but if anyone knows a particular technique good for calculating a high-res heightmap out of the already generated and smoothed terrain I would be very happy as I could look into it further when I know what I'm looking for. Thanks

    Read the article

  • jquery ui position fails with margin

    - by oliwel
    Hi, I am trying to use jQuery to position an inpage div (Context-Menu) relative to a clicked tablerow on a webpage. This works fine until I add an offset with either "left" or "margin-left" to the outer container. Using padding-left works.... The relevant code is: $('#supermenu').position({ my: "left top", at: "left top", of: $(event.target).closest('tr'), collision: "fit" }); The caller looks like: <tr onclick="getMenu(event)"><td>.... What happens: The left margin is added "twice" to the X Offset, so the Menu is not aligned to the left border of the table but somewhere right of it. The offset from the border is exactly the offset from the outer container. Anybody can shed some light? Oliver

    Read the article

  • How can I call python module inside versioned package folder?

    - by Yanhua
    I need write python codes which run inside a host application. The python codes should be deployed under a specific folder of the host application. I must put my entry python module under the root of the specific folder. And I want put all my other python codes and c/c++ dll under a sub folder, I prefer to name the sub folder like XXX-1.0, the number is the version of my python codes. The entry python module is just simple call a python module under the sub-folder. By this way different version python codes can be deployed together without collision. May I know it is possible or not? Thanks.

    Read the article

  • How can I get `find` to ignore .svn directories?

    - by John Kugelman
    I often use the find command to search through source code, delete files, whatever. Annoyingly, because Subversion stores duplicates of each file in its .svn/text-base/ directories my simple searches end up getting lots of duplicate results. For example, I want to recursively search for uint in multiple messages.h and messages.cpp files: # find -name 'messages.*' -exec grep -Iw uint {} + ./messages.cpp: Log::verbose << "Discarding out of date message: id " << uint(olderMessage.id) ./messages.cpp: Log::verbose << "Added to send queue: " << *message << ": id " << uint(preparedMessage->id) ./messages.cpp: Log::error << "Received message with invalid SHA-1 hash: id " << uint(incomingMessage.id) ./messages.cpp: Log::verbose << "Received " << *message << ": id " << uint(incomingMessage.id) ./messages.cpp: Log::verbose << "Sent message: id " << uint(preparedMessage->id) ./messages.cpp: Log::verbose << "Discarding unsent message: id " << uint(preparedMessage->id) ./messages.cpp: for (uint i = 0; i < 10 && !_stopThreads; ++i) { ./.svn/text-base/messages.cpp.svn-base: Log::verbose << "Discarding out of date message: id " << uint(olderMessage.id) ./.svn/text-base/messages.cpp.svn-base: Log::verbose << "Added to send queue: " << *message << ": id " << uint(preparedMessage->id) ./.svn/text-base/messages.cpp.svn-base: Log::error << "Received message with invalid SHA-1 hash: id " << uint(incomingMessage.id) ./.svn/text-base/messages.cpp.svn-base: Log::verbose << "Received " << *message << ": id " << uint(incomingMessage.id) ./.svn/text-base/messages.cpp.svn-base: Log::verbose << "Sent message: id " << uint(preparedMessage->id) ./.svn/text-base/messages.cpp.svn-base: Log::verbose << "Discarding unsent message: id " << uint(preparedMessage->id) ./.svn/text-base/messages.cpp.svn-base: for (uint i = 0; i < 10 && !_stopThreads; ++i) { ./virus/messages.cpp:void VsMessageProcessor::_progress(const string &fileName, uint scanCount) ./virus/messages.cpp:ProgressMessage::ProgressMessage(const string &fileName, uint scanCount) ./virus/messages.h: void _progress(const std::string &fileName, uint scanCount); ./virus/messages.h: ProgressMessage(const std::string &fileName, uint scanCount); ./virus/messages.h: uint _scanCount; ./virus/.svn/text-base/messages.cpp.svn-base:void VsMessageProcessor::_progress(const string &fileName, uint scanCount) ./virus/.svn/text-base/messages.cpp.svn-base:ProgressMessage::ProgressMessage(const string &fileName, uint scanCount) ./virus/.svn/text-base/messages.h.svn-base: void _progress(const std::string &fileName, uint scanCount); ./virus/.svn/text-base/messages.h.svn-base: ProgressMessage(const std::string &fileName, uint scanCount); ./virus/.svn/text-base/messages.h.svn-base: uint _scanCount; How can I tell find to ignore the .svn directories?

    Read the article

  • XNA - Pong Clone - Reflecting ball when it hits a wall?

    - by toleero
    Hi guys, I'm trying to make the ball bounce off of the top and bottom 'Walls' of my UI when creating a 2D Pong Clone. This is my Game.cs public void CheckBallPosition() { if (ball.Position.Y == 0 || ball.Position.Y >= graphics.PreferredBackBufferHeight) ball.Move(true); else ball.Move(false); if (ball.Position.X < 0 || ball.Position.X >= graphics.PreferredBackBufferWidth) ball.Reset(); } At the moment I'm using this in my Ball.cs public void Move(bool IsCollidingWithWall) { if (IsCollidingWithWall) { Vector2 normal = new Vector2(0, 1); Direction = Vector2.Reflect(Direction,normal); this.Position += Direction; Console.WriteLine("WALL COLLISION"); } else this.Position += Direction; } It works, but I'm using a manually typed Normal and I want to know how to calculate the normal of the top and bottom parts of the screen?

    Read the article

  • Eval IronPython Scripts during ASP.NET Web Request; Static Engine or Not

    - by Josh Pearce
    I would like to create an ASP.NET MVC web application which has extensible logic that does not require a re-build. I was thinking of creating a filter which had an instance of the IronPython engine. What I would like to know is: how much overhead is there in creating a new engine during each web request, and would it be a better idea to keep a static engine around? However, if I were to keep a single static engine around, what are the issues I might run into as far as locking and script scope? Is it possible to have multiple scopes in the same IropPython engine so I don't get variable collision and security issues between web requests?

    Read the article

  • Simple network gaming, client-server architecture planning.

    - by michal
    Hi, I'm coding simple game which I plan to make multiplayer (over the network) as my university project. I'm considering two scenarios for client-server communication: The physics (they're trivial! I should call it "collision tests" in fact :) ) are processed on server machine only. Therefore the communication looks like Client1->Server: Pressed "UP" Server->Clients: here you go, Client1 position is now [X,Y] Client2->Server: Pressed "fire" Server->Clients: Client1 hit Client2, make Client2 disappear! server receives the event and broadcasts it to all the other clients. Client1->Server: Pressed "UP" Server->Clients: Client1 pressed "UP", recalculate his position!! [Client1 receives this one as well!] Which one is better? Or maybe none of them? :)

    Read the article

  • Parallel Processing Simulation in Javascript

    - by le_havre
    Hello, I'm new to JavaScript so forgive me for being a n00b. When there's intensive calculation required, it more than likely involves loops that are recursive or otherwise. Sometimes this may mean having am recursive loop that runs four functions and maybe each of those functions walks the entire DOM tree, read positions and do some math for collision detection or whatever. While the first function is walking the DOM tree, the next one will have to wait its for the first one to finish, and so forth. Instead of doing this, why not launch those loops-within-loops separately, outside the programs, and act on their calculations in another loop that runs slower because it isn't doing those calculations itself? Retarded or clever? Thanks in advance!

    Read the article

  • namespacing large javascript like jquery

    - by frenchie
    I have a very large javascript file: it's over 9,000 lines. The code looks like this: var GlobalVar1 = ""; var GlobalVar2 = null; function A() {...} function B(SomeParameter) {...} I'm using the google compiler and the global variables and functions get renamed a,b,c... and there's a good change that there might be some collision later with some outside code. What I want to do is have my code organized like the jquery library where everything is accessible with $. Is there a way to namespace my code so that everything is behind a # character for example. I'd like to have this to call my code: #.GlobalVar #.functionA(SomeParameter) How can I do this? Thanks.

    Read the article

  • How do you resolve the common collsision between type name and object name?

    - by Catskul
    Since the convention is to capitalize the first letter of public properties, the old c++ convention of initial capital for type names, and initial lowercase for non-type names does not prevent the classic name collision class FooManager { public BarManager BarManager { get; set; } // Feels very wrong. // Recommended naming convention? public int DoIt() { return Foo.Blarb + Foo.StaticBlarb; // 1st and 2nd Foo are two // different symbols } } class BarManager { public int Blarb { get; set; } public static int StaticBlarb { get; set; } } It seems to compile, but feels so wrong. Is there a recommend naming convention to avoid this?

    Read the article

< Previous Page | 95 96 97 98 99 100 101 102 103 104 105 106  | Next Page >