Tagged Questions
1
vote
1answer
90 views
Optimizing method and removing useless code
I have such function which is parsing beautiful soup elements:
...
1
vote
2answers
3k views
Setting variables inside if / else-if statment blocks
I have written the code below and I am trying to work out if there is a more efficient way of doing it: i.e. less lines of code and quicker etc.
I am also wondering whether it is OK to declare ...
9
votes
2answers
72 views
Scalability of running commands from user input
Here is some code I have that has been extracted and shrunk down from a project of mine.
...
2
votes
1answer
73 views
How can I optimize my insert function for the cuckoo hash table?
I'm working on class for a hash table where collisions are corrected using cuckoo hashing, I had difficulty writing the insert function, the function is supposed to insert the key if the ...
1
vote
2answers
44 views
How can I optimize this string function so that it could work on very large strings?
I want to build a function which finds the longest substring that is common between two large strings, I want to do this using the first two functions.
I'm running it on very large strings (containing ...
3
votes
2answers
68 views
Secure row insertion using a position-based prepared statement
I have the following function to insert a new row into a table:
...
4
votes
2answers
56 views
Page loader function
This is the function which I wrote and am currently using in my project. I want to know if there is a better way to write it:
...
8
votes
1answer
184 views
PDO sign up function inserting data into multiple tables
This is a sign up function called on form submission. It firstly inserts key user data into the users table. If successful, secondary data is then inputted into ...
1
vote
1answer
47 views
Optimising and consolidating multiple PHPMailer functions
So the two functions below both send emails via PHPMailer but both hold different messages (which use different data from the db). I was just wondering (as I plan to use PHPMailer more) a way to ...
3
votes
1answer
117 views
Python Code Cleanup/Optimization
I am trying to clean up and make the following code more efficient -
https://gist.github.com/eWizardII/6757364
...
2
votes
1answer
201 views
Iterative Collatz with memoization
I'm trying to write efficient code for calculating the chain-length of each number.
For example, ...
1
vote
1answer
189 views
How can I improve this C style va_args replacement?
I inherited a lot of C code with many ellipsis (variadic) function.
So I have a lots of API with the following signature.
...
1
vote
1answer
86 views
How to improve a file access permission/deny function?
I've quickly made a function to deny or allow access to files that are only used thru Ajax Calls.
Key Generator
...
3
votes
1answer
318 views
How to improve function to detect the mime type using an agnostic method?
This function is used to get the mime type of any given file. The intended purpose was to have it working within any of our servers that vary from the latest PHP version down to PHP 4.
...
2
votes
1answer
132 views
How can this function to get a remote file improve?
I've prepared a function using cURL to get a remote file to the local storage:
...
2
votes
1answer
96 views
How to optimize function that checks if a directory is empty when having over a million files inside?
I have the following function to confirm if a directory contains files:
...
1
vote
2answers
106 views
How to improve this PHP function to confirm the presence/create directories?
While preparing an automated process to manipulate files, I've made the following function to check for the base directory and sub-directories presence, as to allow or deny the remaining code to be ...
4
votes
1answer
187 views
Is this code efficient?
I was wondering if this was a decent way of handling this function. Please take a look.
...
0
votes
1answer
263 views
Is my login function secure ? how to improve it?
Using cakePHP, I would love to have your point of view about this large source code, i am not sure if its enought secure. sha1() will be removed with another ...