All Questions

Filter by
Sorted by
Tagged with
27 votes
4 answers

PHP Autoloader Library

Basically, I had written this class a little while ago to ease autoloading of our local libraries. The premise is that everything is split by packages into multiple layers of sub-packages. Classes ...
  • 714
57 votes
9 answers

Project Euler problem 1 in Python - Multiples of 3 and 5

I'd like suggestions for optimizing this brute force solution to problem 1. The algorithm currently checks every integer between 3 and 1000. I'd like to cut as many unnecessary calls to ...
39 votes
5 answers

Database connection in constructor and destructor

I am playing with different ways to do database interaction in PHP, and one of the ideas I have been playing with is connecting to the DB in the constructor and disconnecting in the destructor. This ...
13 votes
2 answers

PHP mcrypt AES encryption wrapper

There are two keys: the main is aes128 and the second is XTEA, used just for randomization of data inside the AES. Randomization is done with secret random key that is not know even if someone knows ...
user avatar
6 votes
1 answer

AES encryption wrapper

After taking into account answers for my questions here and here I created (well may-be) improved version of my wrapper. The key issue was what if an attacker is knowing what is encoded - he might ...
  • 379
21 votes
3 answers

Encryption functions based on mcrypt

I learned here that it is unsafe to design encryption algorithms from scratch. Given that advice, I made a pair of encryption functions based on mcrypt: ...
  • 379
30 votes
1 answer

Managing network address information

I'm a developer at a networking company that really has no peers that work above me that I can use for any sort of sounding board for my code, so it's just me. I was wondering if anyone would be ...
  • 539
8 votes
1 answer

Bad code to handle image upload

I'm using this form to submit articles into the database: ...
user avatar
153 votes
20 answers

Searching an element in a sorted array

I was applying for a position, and they asked me to complete a coding problem for them. I did so and submitted it, but I later found out I was rejected from the position. Anyways, I have an eclectic ...
user avatar
12 votes
3 answers

More elegant way to show | hide in jQuery

What is the best way to optimize this jQuery code? ...
user avatar
13 votes
4 answers

Draw random 1's and 0's

I was wondering if anyone would be so kind as to look at this code I've written for practice. Tell me what am I doing wrong, where can I optimize, anything. What this code does is (in terminal) draw ...
user avatar
32 votes
5 answers

Tiny Encryption Algorithm (TEA) for arbitrary sized data

The TEA is a very simple encryption algorithm requiring little time and space - perfect for embedded systems. There are extensions to it, and every version has its flaws (WEP was based on it), but ...

15 30 50 per page
1524 1525 1526 1527