Tagged Questions
2
votes
0answers
42 views
Practical advise for CMS
I'm working on a CMS system. The basis is pretty much done but before going any further I would like to know if there are things I really should change in the way I code things.
I am pretty sure ...
0
votes
1answer
71 views
I've finally found a satisfactory way to create classes on JavaScript. Are there any cons to it?
Depending on external OO libraries is really bad, using prototypes/new has some limitations, using only hashes has others. Dealing with classes was always a pain in JavaScript and it didn't help that ...
3
votes
1answer
280 views
Which is better: the short, clever way, or the long, ctrl+c way?
The code below is equivalent. I can see pros and cons for both versions. Which one is better?
Short version:
character.on("key",function(key){
var action = ({
...
0
votes
2answers
81 views
How to take the some elements of a list of random numbers and sort them?
I want to create a file consisting take rows of distinct numbers in ascending order. They are randomly taken from the first total integer. The file will be used to make an excerpt as discussed here.
...
2
votes
1answer
98 views
Simple and efficient code for finding factors and prime factorization?
I've modified this program many times, but I want to know if this is a good way to perform this task. My first algorithm for finding the factors of a number was pretty slow and horrible (started at ...
3
votes
1answer
175 views
Improve efficiency for finding word frequency in text
Premise: Write a program that counts the frequencies of each word in a text, and
output each word with its count and line numbers where it appears. We
define a word as a contiguous sequence of ...
3
votes
1answer
82 views
Challenge: solution for this deep-iteration JavaScript function dilemma?
Trying to implement a deep-iteration function with some constraints, I've noticed the faster solution is iterating it twice! Any attempt to avoid this resulted in slower code. So, the challenge: can ...
3
votes
3answers
162 views
Advice on program which calculates scores for predictions of Football scores
I am writing a program which calculates the scores for participants of a small "Football Score Prediction" game.
rules are:
if the match result(win/loss/draw) is predicted correctly: 1 point
if the ...
2
votes
1answer
105 views
Initialize a bunch of NSDateComponents objects at once (in a loop)?
I'm developing an iPhone app that is heavily Calendar-based, and it requires a good amount of (what I'm calling) "date boundaries."
I use these "date boundaries" to fetch EKEvents from specific ...
1
vote
2answers
76 views
Is this correct R? remove first duplicate dataframe
I have a dataframe with several columns. One of them is an user id column, in this column, I have several ids that can be repeated several times. What I want to do is remove the first id, for ...
0
votes
1answer
36 views
Simplifying and improving (namely DRY) for flight info fetcher
I've put together this simple fetcher for text data (which I just copy and pasted from a flight info website) - it takes in text data, and spits out an array of objects containing values for each ...
2
votes
3answers
169 views
Is there a faster way to clear the screen?
I'm currently clearing my console window with this piece of code:
void clrScr()
{
COORD cMap =
{
0, 3
};
if(!FillConsoleOutputAttribute(hCon, 0, 2030, cMap, &count))
{
...
1
vote
1answer
206 views
How to optimize loading of images? (especially cocos2d)
So i recently started game development (which is freaking awesome), but one of the things that i never put much thought to was the loading of images. i'm curious as to advice for improving my current ...
3
votes
1answer
68 views
Python Optimizing/Speeding up the retrieval of values in a large string
I have a string containing around 1 million sets of float/int coords, i.e.:
'5.06433685685, 0.32574574576, 2.3467345584, 1,,,'
They are all in one large string and only the first 3 values are ...
5
votes
2answers
146 views
Review for CSS layout code
I want to get my first CSS layout reviewed.
First of all, the related HTML code is as follows -
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
...
7
votes
2answers
217 views
How can I make this command line utility better?
I have been developing a capitalizer in Python. This is actually a script that an end user will type at their terminal/command prompt. I have made this script to:
Taking the first argument as a file ...
2
votes
2answers
171 views
What are the bad habits etc. in this code?
I know this code is pretty awful, but, by any chance, could someone point out all the flaws you can find and tell me them? I think it will help me become a better coder.
# Alien Assualt
# A bullet ...
2
votes
2answers
176 views
Query and data manipulation review
The below sections of code are part of a list administration project I am working on to teach myself C#. This is from a tab that is used for list administration. There is a drop down box that allows ...
5
votes
3answers
297 views
Printing braces
Question goes like this :
input: 1
output:
{}
input: 2
output:
{}{}
{{}}
input: 3
output:
{}{}{}
{{}}{}
{}{{}}
This is my program :
public class PrintBraces {
int n;
char []braces;
...
6
votes
2answers
141 views
Naive Bayes classifier
I just started learning Haskell, and I must say it is unlike anything else. As my first not-entirely-trivial piece of code I tried to write a simple Bayes Classifier. It is in two parts, a classifier ...
9
votes
4answers
2k views
Good method to check whether a string is a valid number?
I'm developing a Java Helper Library which has useful methods developers don't want to type out over and over. I'm trying to think of the best way of checking whether a string is a valid number.
I've ...
2
votes
2answers
238 views
What do you think? (jQuery)
I need some comments on the code that I "assembled". I want to know if it is efficient because I intend to use it on a live site . I'm not a programmer guy so I used the trial and error method to make ...
2
votes
1answer
122 views
Twitter scanner
How can I script this in a better way?
// Tweets
$twitter_username_string = "aasampat OR ashwinsampat OR somemore";
$twitter_number_of_tweets = 1;
$twitter_hashtags = ...
3
votes
1answer
168 views
Help optimize my HTML/JS Game Engine
So, recently, I've been working on a JS/HTML5 Game Engine. Right now I'm calling it DimSumJs, because like DimSum isn't a full meal, my framework still runs too slowly to make a full game (it can only ...
2
votes
1answer
144 views
Python RESTful image handler
Firstly, this is a great idea for a new StackExchange site.
This is a view as part of a RESTful image handler module, written for Flask, I am sure there is a better/more pythonic way of doing parts ...
3
votes
2answers
499 views
Help me improve and optimize a Tic-Tac-Toe game I wrote in Python 3
I've been teaching myself Python3 for about a week now and I decided to put my skills to the test by writing a simple Tic-Tac-Toe game. Here is what I came up with :
#!/usr/bin/env python3
import ...
10
votes
1answer
615 views
Optimizing Python Image Viewer and General Code Format Advise
I'm currently making a manga (read: comic) viewer in python. This project has been a code as you learn project, because I have been trying to code this as I learned about Tkinter. Python I have known ...
1
vote
0answers
630 views
integrating SFML and Box2D lib, and a Mass Production Shape Factory
i just wrote two new headers: one that integrates Box2D and SFML by a class called BodyRep which creates/ is a graphic representation of any body, and one that produces huge amounts of uniform shapes, ...
3
votes
1answer
842 views
Coding adjacency list representing graph
I want to write some basic code on graph like DFS, BFS but before that I am coding graph representation in adjacency list, and some basic functions like readgraphfrommatrix. (This will initialize ...
5
votes
2answers
569 views
Merge sort 2 sorted linked list
My coding skill is pretty rusty and moreover, I have never paid much attention to writing elegant code. I want to start on this. Problem is to merge 2 sorted linked list. Algorithmically this is ...
4
votes
2answers
337 views
Querying MYSQL from an external application (is my pascal code inefficient)?
I have a database that I need to query over and over as fast as possible. My queries execute pretty quickly, but there seems to be some additional lag.
I have a feeling that this lag is due to the ...
6
votes
3answers
816 views
Generating very large prime numbers and their generator modulo N in php
I recently came up with the idea to attempt generating ungodly large prime numbers and their generators modulo N in php. I don't know much about number theory and just wanted to get some comments to ...
2
votes
4answers
370 views
Optimising sample solution of task for firstyear students
I'm giving a lecture on basic programming to first-year mathematics students. The programming language is Java (defined by curriculum).
Last week I gave the following task:
Write a program, that ...


