Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
66 views

Refactoring this state machine (upvoting/downvoting)

I have a list of resources which can be voted on. There are 3 voting states: upvoted, downvoted and no vote. In a fashion identical to stackexchange voting, it follows these rules: If you upvote a ...
4
votes
3answers
122 views

Javascript function and global variables

I have a getValue function which just grabs some numbers from an HTML page – How can I access those variables in later functions without passing them down the entire chain of functions? As they sit ...
2
votes
1answer
73 views

Do I need to create more functions? And also, is this code difficult to unit test?

I'm new to production code. And also I'm learning how to test code, I'll use the unittest module that comes with python to do that. One more question, how can I make this code more safe? """ Sync ...
2
votes
1answer
103 views

Refactoring Javascript into pure functions to make code more readable and maintainable

Note: I am very new to Javascript. The code I provided is long but not complicated. The code below works and runs fine. But I would like to seperate it out into logical 'pure' functions to make ...
3
votes
1answer
159 views

How can I shorten my jQuery for Show/Hide Function with Multiple Div IDs?

I've created a sliding panel menu that works (JSFiddle: http://jsfiddle.net/stephmoreland/3BT7t/), but I can't wrap my head around shortening the jQuery for it. Right now, when you click one of the ...
1
vote
4answers
141 views

Reading tokenized numbers from a file

int *getUserInput(FILE *fpin, int *elementCount) { int *userInput; // Load file into buffer int length = fileLength(fpin); char *buffer = (char *) malloc(length * sizeof(char)); int written ...
1
vote
2answers
466 views

calling functions over and over?! improvements needed

Not some much a problem, I am curious to know if my code can be cleaned up here a little. One annoyance is im calling a function three ( 3 ) times. I would like to know how this could be improved, ie: ...
4
votes
1answer
158 views

Is this code efficient?

I was wondering if this was a decent way of handling this function. Please take a look. // Use Less Mixins from Theme Options to adjust Stylesheets before Parsing Less to CSS add_filter( 'less_vars', ...
3
votes
2answers
76 views

Please review my function code for adherence to C standards and whatever else could be improved to it

I am relatively new to C and would like some feedback on a function that I have written, if it adheres to C standards or if there are some other things which I could have done better/differently. The ...
3
votes
2answers
108 views

Cross-post from SO- Palindrome finding function

I didn't know this site existed before now... awesome! I just made a thread here: http://stackoverflow.com/questions/8511620/c-palindrome-finder-optimization #include <iostream> #include ...
0
votes
1answer
191 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 script. I found this large script can be ...
4
votes
3answers
787 views

Min / Max function of 1D array in C / C++

Due to software constraints, I cannot use the standard libraries, math.h,algorithm, templates, inline, or boost. I am also using standard C (ISO C99) such that array is not a reserved keyword like it ...
8
votes
3answers
240 views

Fastest Parameter Passing in delphi 7?

I have a function that accepts a big amount of data as a parameter (sometimes 1 megabyte) I was thinking which would be the fastest way to pass that data, dunno if I got this right, but here is what I ...
2
votes
1answer
133 views

Passing anonymous functions and getting variables from an outer scope in php

I'm doing something quite strange. I'm trying to create a tiny system for creating templates inline in php, so that I can refactor by creating multiple templates in the original script, and ...
4
votes
1answer
157 views

Python, WeakBoundMethod

I've written this small class in Pyhon that wraps bound methods but does not prevent the deletion of self. Do you have any though on my code? Do you think I handle errors appropriately? Is it missing ...

1 2
15 30 50 per page