All Questions

Filter by
Sorted by
Tagged with
10
votes
1answer
484 views

Emulator for representing hardware and operating systems

This is an emulator I am currently re-writing for my Operating Systems course. It is a simple emulator that is supposed to represent hardware, OS, etc. It is strictly for learning purposes and I want ...
9
votes
4answers
2k views

Is catching 'expected' exceptions that bad?

I had to find the corresponding process for a windows service the other day, and I kept on getting this one exception. I've spent some time researching the exception only to find that this exception ...
4
votes
4answers
479 views

Comment formatter

...
4
votes
2answers
2k views

How can I improve this PHP MySql Rank generation function?

How can I improve this PHP MySql Rank generation function? (Mostly looking to improve speed, but any feedback is very welcome) Right now I keep stats and ranks in 2 separate tables. The only ...
6
votes
1answer
3k views

Iterator over row and columns

I am writing a simple raytracer just for fun. I want to iterate over rows, and each row must be an iterator over columns. A strategy I produced is the following: ...
4
votes
1answer
2k views

Traversing a BST in iterative inorder

Traverse a binary search tree in iterative inorder. Note that the iterative methods below contain the meat of the code; the remaining code is included for completeness. ...
5
votes
1answer
314 views

Collapsing Folder Trees with Ruby

This is a quick script I whipped up to collapse some folder trees down to individual folders. The specific situation that arose was my formerly-itunes collection (it's currently organized ...
3
votes
1answer
155 views

How can i make my Get_Numb_of_Digits_in_a_number() function more accurate?

Here's my function but it sometimes has unpredicted results with entering different numbers but with the same number of digits getting different results. I figure it has something to do with a ...
4
votes
1answer
336 views

Set of linear equations

I have \$ N^2 \$ matrices. Each one is a \$ 3 \times 3 \$ matrix. I want to concatenation them to a \$ 3N \times 3N \$ matrix. I know that the big matrix is symmetric. Evaluation of whole \$ 3 \times ...
5
votes
1answer
197 views

all the ways to fit some pegs into given holes

Suppose you have a list of the diameters of some circular holes, and a list of the diameters of some cylindrical pegs. Now the problem is finding all the ways you can fit the pegs in the holes, where ...
14
votes
2answers
5k views

Parsing strings with escaped characters using Parsec

I have been working through the exercises in a Write Yourself a Scheme in 48 Hours/Parsing and hacked together something to get parseString to comprehend escaped characters. Also had some inspiration ...
4
votes
1answer
15k views

Handling click events to open and close menus depending on the click target

I'm building a navigation that has a breadcrumb with drop down menus. I want the menus to open up when I click the open link, then there are many instances when the menu should close: The link is ...
7
votes
2answers
1k views

Homemade Stopwatch class

Here's some explanation for accuracy and neg_accuracy: It's meant to keep all the values in terms of what the user specified he ...
5
votes
3answers
26k views

Learning OOP PHP, simple MySQL connection class.

I have posted an earlier version of this and here is the improved version from the feedback I recieved. Some of the feedback I received was; Don't chain method (tried my best to limit this) Do not ...
6
votes
2answers
1k views

Is this a good way to store error messages to display back to the user?

I use the following code to put all of my error messages for the application in one javascript variable. Is this efficient way to store my error messages? ...
14
votes
2answers
1k views

“Pluggable” routes in ASP.NET MVC

How do I handle multi-tenancy with routes in ASP.NET MVC? The application is a multitenant ASP.NET MVC 3 application. Tenants are identified based on hostname so this does not interfere with routing. ...
7
votes
1answer
481 views

Directed graph similarity calculation — optimizing Mathematica code

I am looking to optimize the following computation. First, some explanations: Explanation I have a directed graph whose adjacency matrix may only contain 1s and 0s. The similarity of nodes i and j ...
6
votes
1answer
145 views

JavaScript navigation UI

I think that the slice() is a bit hacky, and prone to breaking if I change my mind about the id names, but I wanted this to be ...
7
votes
2answers
571 views

Find number of divisors for integer and sum of integers

This function computes and returns the number of divisors an integer has. But it is very slow and I believe it can be optimized for speed. ...
6
votes
2answers
427 views

Working with databases in PHP

I am 100% self-taught, and so I try to read as much as I can about best practices, conventions, etc. However I freelance, and have been in a long-term contract position for the past little while with ...
8
votes
3answers
10k views

SQL: Search for a keyword in several columns of a table

I want to perform a search in several columns of a table. I use the following query: ...
7
votes
2answers
2k views

Anti-Bot comment system

With some advice from SO, I developed this system, which I think is quite strong for bots to automatically post comments. index.php ...
5
votes
1answer
247 views

Critique some Ruby + RSpec Code for a SERP checker

I found a SERP checker written in PHP and I decided, in order to better learn to program, I would re-write it in Ruby. All I have written so far takes a list of keywords that a user inputs and cleans ...
4
votes
1answer
749 views

IMapDocument in a 10.1 SOE

I am wondering if this code will work in 10.1. This video at 1:02 says not to create mxd based services. I think that just means not using IMapServerObjects3, but seems like IMapDocument should be OK....
7
votes
3answers
832 views

Pig Latin Translator - follow-up

About a week ago, I put up this code and got some really good help. I've modified it a bit and was seeking if someone would review my second iteration. Original can be found here. Here's the new ...
10
votes
2answers
3k views

Async Task implementation

Beeing on .NET 3.5 i don't have access to the TPL. Yet i have become fed up of having to manage manually the logic behind delegate.BeginInvoke type of scenarios each time and i set up to implement my ...
13
votes
4answers
55k views

Simplify splitting a String into alpha and numeric parts

Requirement: Parse a String into chunks of numeric characters and alpha characters. Alpha characters should be separated from the numeric, other characters should be ignored. Example Data: Input ...
4
votes
3answers
2k views

Improve this function that compares jQuery versions

Please help me improve this function that compares the jQuery version currently available (or not) with the one required. ...
13
votes
5answers
1k views

To make a calculator from scratch

As a personal challenge, I am trying to make a very basic calculator without using any CLR's integer and arithmetic operations, but to only use memory. The idea was to do what CLR/OS does. i came up ...
-8
votes
1answer
464 views

waitForIt Plugin

Anyone want to comment on this plugin I'm making? (improvements, etc) ...
3
votes
1answer
206 views

service build with perl - is it correct

I tried putting a script i saw together, plus used an existing script to make something run as a service. Now I have the following pl script and the init.d / start/stop scripts. They work, but I am ...
4
votes
1answer
244 views

On demand JS loader review

At my work, I need to create a script that third-party webmasters could include in their pages without need to include something else. But this script had dependencies on jQuery and some amount of ...
9
votes
2answers
1k views

Find the no of pairs whose sum divides the product from 0 - 1000000000

I have designed the code but the problem is it timeouts as the range is 1000000000 but works fine with 1000. Any idea to optimize this or a mathematic logic for it? I just need to find the no of ...
2
votes
2answers
2k views

Event Registration

I am new to the world of coding, PHP as well as XHTML. As my first stab at object oriented coding, I put together a basic registration form that is meant to serve as a means to collect user details. ...
4
votes
1answer
2k views

File-serving Twisted resource

I've just written this Twisted resource base class for serving files. It's part of a larger application, this is just for serving its images, JavaScript files, etc. Is it okay? I wonder if checking ...
10
votes
3answers
34k views

Caesar Cipher program in C

I'm a beginner-intermediate C++ programmer, and I never used or understood C input & validation. I just always used C++ streams. Anyway, I just want code critique, as I have never used the C ...
3
votes
3answers
556 views

MySQL connection class

I am trying to learn OOP using PHP5 and I wrote a simple MySQL connection class. Please take a look and give me some feedback on better practices, critical errors, and any other feedback you can ...
3
votes
2answers
518 views

Session in database

I'm posting my PHP code for sessions using MySQL. Please tell me if there are any errors, if it can be optimized, or if security can be enhanced. Host: localhost User: root Password: "" Database: pro ...
1
vote
0answers
165 views

Coercion of arguments using successive raising

From SICP: Exercise 2.84 Using the raise operation of exercise 2.83, modify the apply-generic procedure so that it coerces its arguments to have the same type by the method of ...
4
votes
2answers
1k views

TextWriterTraceListener class

I need to extend the default TextWriterTraceListener class to include timestamps with each message on same line and file rotation. I can't seem to find any way of ...
10
votes
1answer
4k views

Python implementation of a wrapped Conway's Game Of Life board

...
3
votes
3answers
213 views

Checking user mouse movement

I am trying to update my server to let it know that the user had some activity in the past 15 minutes. In order to do that, I made this implementation: ...
7
votes
1answer
2k views

Pig Latin Translator

Could someone review the following code? ...
2
votes
1answer
1k views

Javascript filter class to hide and show content on data-attributes

I'm a hacker, not a trained engineer. I ask/answer specific questions on StackOverflow and am pretty confident in my ability to get the browser to do what I want, I thought I could benefit a great ...
4
votes
2answers
124 views

Keys in mode maps

I noticed a pattern in some elisp modes I was putting together: (let ((map (make-sparse-keymap))) (define-key map KEY 'FN) ... (setq FOO map)) so I wrote ...
2
votes
1answer
249 views

List of integer factorization into n terms

I want the fastest way in Mathematica 7 to generate a list of the factors (not prime factors) of an integer into a specified number of terms, with each factor greater than one. For example, 240 into ...
4
votes
1answer
1k views

Activating items in some randomized arrays

I've got a list with about 120 items in IE and I have some items I want to activate. I compare, build and randomize some Arrays on the fly. The for loop in the run()...
9
votes
1answer
5k views

Binary tree in Python

As a Python newbie, I have coded this binary tree as best as I could to follow Python idioms. However, I know it is still very verbose and not up to standard. I would like Python experts to tear this ...
6
votes
2answers
2k views

Simple web-scraper in Common Lisp (SBCL)

I have written a simple web-scraper in Common Lisp, & would greatly appreciate any feedback: ...
7
votes
2answers
2k views

Slow-running File parser

I've got a method that parses a file. I take all the words and add them to a SortedSet. Every word contains a list of Lines ...

15 30 50 per page