Jump to content

random314

Member
  • Posts

    24
  • Joined

  • Last visited

Awards

This user doesn't have any awards

1 Follower

Profile Information

  • Gender
    Not Telling
  • Member title
    Junior Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

random314's Achievements

  1. It's not entirely clear what you're trying to do. It looks like you are trying to edit timestamps within a file, if this is the case how about using a regular expressions to change the date and time values. You can do this using a text editor like notepad++, assuming you're on Windows. Using the find and replace function in a text editor the regular expressions would look something like this: For the time: Find: (\d\d)\d\d)\d\d),(\d\d) Replace with:\1-\2-\3-\4 For the date: Find: (\d\d)/(\d\d)/(\d\d\d\d) Replace with: \1-\2-\3
  2. Replace your print statement with import osprint [item.replace(os.sep, '/') for item in list]
  3. If you're looking for a C reference then you can't go far wrong with The C Programming Language (aka K&R), which is the original C reference by the authors of the language (it has been updateed since the original version. If you're looking for something a bit more gentle then I would recommend Programming in C. It is clearer and more concise than K&R and is written more like a tutorial. Remember that C is just a subset of C++, so if you already know some C++ it should make the basics relatively straightforward.
  4. I'm not really sure how far you're going to get looking for weaknesses in RSA. Bearing in mind that I don't know how much cryptography stuff you've done and I'm not really sure if you had in mind any particular weakness you wanted to go after. I think probably the best you can do for a university project would be to make your own plain RSA implementation and demonstrate some of the weaknesses that have already been shown (something like Coppersmith's attack). You could also go after weaknesses in the various padding schemes used for RSA. As for Android, there is already support for all the major encryption standards through the javax.cryto and BouncyCastle libraries. You could build something like a secure messaging app or possibly a cydia substrate extension that allows transparent encryption of files (I'm sure these already exist)
  5. @MrSuperb is correct, but the first argument is stored in arg[0]
  6. You want to do something like this, assuming you want to print to a single line import timeimport sysfor currentChar in "I have been waiting for you": sys.stdout.write(currentChar) time.sleep(.05) sys.stdout.flush()
  7. So do you want something like this private void NextByte() { readQueue.pop(); ProcessQueue();}private void WaitOnQueue(int minimumBytes){ while(readQueue.Count < minimumBytes) { // Maybe sleep the thread here or something }}private void ProcessQueue(){ if (packetFound) { ParsePacket(); } if (!IsValidSource(readQueue.Peek()) { NextByte(); } // Minumum packet size is 5 WaitOnQueue(5); // Check if top byte is defined as a valid module if (Enum.IsDefined(typeof(CarModules), readQueue.Peek()) && Enum.IsDefined(typeof(CarModules), readQueue.ElementAt(2))) { byte length = readQueue.ElementAt(1); //Maximum allowed size is 32 if (length > 32) { NextByte(); } // If expecting more data than what there is then return if (length > readQueue.Count) { WaitOnQueue(readQueue.Count - length); } byte xorTest = 0; xorTest ^= readQueue.Peek(); xorTest ^= length; xorTest ^= readQueue.ElementAt(2); for (int i = 0; i < length - 2; i++) { xorTest ^= readQueue.ElementAt(3 + i); } byte xor = readQueue.ElementAt(length + 1); if (xor == xorTest) { packetFound = true; ParsePacket(); return; } else { NextByte(); } } readQueue.Dequeue(); } Essentially you should do two things If you encounter a condition where there aren't enough bytes in the queue you should wait until there are enough bytes (exactly how you do this I have no idea). If you encounter a condition where the packet appears to be malformed, pop the current byte off the queue and try to process the queue again It should be noted that if you do this, you have no way to detect packets that are actually malformed
  8. You are right, you should probably use id, even though name will work. I had a bit of a brain fart and just took what was written on the page I linked to as correct
  9. A better to do this is to convert both x and y into pennies individually before doing any arithmetic on them. Floating point values will lead to small errors
  10. Do you mean HTML anchors? They're used to link to a specific part of the page. You make them like this: <a name="whatever"></a><p>Some important piece of content</p> and make links that reference them like this: Click <a href="#whatever">here</a> to go to some important piece of content
  11. The problem is that fgets() doesn't strip the newline from the input, you need to do it yourself (for example using strok(string_with_newline, "\n")) then you should be OK. Also: I don't think the fflush()es are necessary (I haven't tested it though) You can use the sizeof() operator in your fgets() statements (eg: fgets(list[n].string, sizeof(list[n].string), stdin)
  12. You best bet for creating GUIs in java is to have a look at Swing, in your case you should look at buttons and layout managers (you'll probably want to use BorderLayout and FlowLayout)
  13. I'm not sure if this is what your looking for, but you can use a program like FileBot to automatically rename media files. You can use its automation features to watch directories and sort into different folders as well
  14. Did you say that you'd tried redownloading and reinstalling eclipse? This error looks like the result of a corrupted plugin or an incomplete update, so reinstalling eclipse and all your plugins should fix the problem
  15. That's right, the while makes an infinite loop which is broken out of using the return statement
×