# All Questions

68,997 questions
Filter by
Sorted by
Tagged with
892 views

### Inheritance and forcing methods to be called inside another method [closed]

I've written a text parser that extracts useful information from a given text. Texts are formatted different, so there are different specialized parsers. I've designed them so that they all must ...
3k views

### Can this be improved by working directly with the MemoryStream? [closed]

I have a piece of code that has a bit of a problem. Not that it doesn't work, though. The problem I am having is figuring out the optimal way of working with the MemoryStream, which I find quite ...
2k views

### jQuery toggle sort order and save to variable

This works fine but I find it quite big and had hoped there was a cleaner/smaller "toggle" function or alike which I could use but it seems to be related to visibility only - and I want to set a ...
30k views

### Simple address book in Java

I've answered the following question as best as I could, but I need some help with my design and am wondering if I've taken the correct approach. I would appreciate it if anyone could please point ...
3k views

### Improving on John Resig's Simple JavaScript Inheritance: avoiding new

I've recently read this article, and I agree that the new keyword is not good practice. Thus, I've made an improvement on John Resig's Simple JavaScript ...
3k views

### Parsing a HTTP request

I'm currently writing a pure ruby webserver, and one of the things that I have to do is parse a HTTP request. The method I've pasted below takes a HTTP request, and puts it in a map keyed by the ...
393 views

### Ping and write the status of a timer on a GUI thread

I am running a timer for updating some of my operations, such as buffers. But I also want ping to be added. It is added, but I think it can be improved. This is because I think it's running on the ...
2k views

### Putting array name in variable and shortening code

I'm a beginner in C# and am doing a simple programming exercise. I would like to put the Item.price and Item.Name into ...
307 views

I have written a plugin loader in Ruby, and I would like to know if it uses the best technique to handle classes, or if anyone has any recommendations on how to improve my code. I have written a ...
2k views

### Database connection query

I'm a beginner PHP developer and it's my first time using MySQLi. I'm not sure if this is a correct implementation of the connection and query because some people defend this method and some others ...
287 views

### GregorianCalendar

I have to create a class Data with dates and there should be some methods and constructor. Maybe some method can be done in another way, especially the method ...
434 views

### jQuery carousel plugin

I have recently written my first jQuery plugin. It is a responsive jQuery carousel plugin. It seems to be functioning well apart from on window re-size. Sometimes if the window is re-sized too fast I ...
427 views

### Inky pinky ponky game / Josephus problem

I have written below code for the famous Josephus problem, or inky pinky ponky game, or many other names. Does this looks good or is there any loophole if anyone can highlight. I shall be looking ...
1k views

### Quiz form with random questions

How could I make this code more efficient? Instead of using many if-statements, should I make a function, array, or switch? ...
104 views

### Display Twitter timelines and lists on a website

I've built a Twitter plugin recently and was wondering if I could get some feedback on it. There is also a PHP side that grabs the actual tweets and I can post that code if it's needed. http://...
59k views

### Designing classes and methods for hospital management system

I am working on hospital management system project. I have implemented it using the following design. Is it a good design? I have created four classes: Patient, <...
788 views

### Searching through a huge set with threads

I wrote a class that finds values in a huge search volume. I have a pretty strong feeling that my code is not good and would like to get your opinion on it. My experience with C++11 threading is very ...
856 views

### Pagination of repeater

I have some problems in my View.ascx.cs file because I'm reusing my code and modified it based on the situation. For example, when I apply pagination I have different code in all places. I just want ...
144 views

### Creating a Ruby gem that talks to another gem

I am working on creating an interface gem that works with the Jira-Ruby gem. I have several questions and would like a general review for both my code and my attempt at creating a gem (I've never ...
862 views

### Create CSV file of domain groups and their users

I'm fairly new to scripting in Python. I'm looking for suggestions on improving any of the following in the below script: my coding style, performance, readability, commenting, or anything else. <...
1k views

### Small Ruby Bingo Game

The code creates a Ruby bingo game for the console and works properly. I believe the code I wrote needs some work, though, as I am new to Ruby. Any help would be appreciated. ...
6k views

### Interface programming with Data Access Layer

I have several controls that are bound from database tables. Putting my OOP thinking cap on I figured since all of the controls will have a SqlCommand name and an ...
2k views

### Java app for getting metadata of millions of files in a directory

I am writing a Java app that gets the metadata of files in a directory and exports it to a .csv file. The app works fine if the number of files is fewer than a million. But if I feed in a path that ...
1k views

### Modeling a decision tree-like form

A picture says more than a thousand words, so here's a mock-up. The actual choices are different, this is just a sample. A user first has to choose between Red, Blue and Green. Upon selecting an ...
332 views

### Adding two values in a map, if they exist

My code looks like imperative style code. I want to make my code more functional. How I can rewrite my program so it become functional style code? ...
91 views

### Improving the flexibility of my library/what can be improved? [closed]

How can I make my library more flexible towards programmers? Here is my library. It's a basic library that provides a simple interface to organise your game (with scenes, and engine/game connection). ...
2k views

### Get Image From Stream, TCP Stream without converting to MemoryStream first [closed]

IS it possible to read directly from the TCPStream to get an image if I know the size and all that, without first saving it to a memorystream? My code currently works with putting the first 4 byte in ...
943 views

### How to implement a dynamic temperature conversion method based on given enums? [closed]

I am making some basic temperature conversion methods, and I want the end result to look something like this: ...
8k views

### A small printf-like function using variadic templates

I'm looking to get some feedback on a small printf-like function I wrote that provides simplified behavior similar to ...
1k views

### Remake of factoring/prime factorization calculator

Background info on factoring and prime factorization. I've remade this program from my first attempt, and I'm sure it can still be improved. My questions: These calculations should only be done ...
3k views

### Recursive Windows Directory listing

I wrote a PowerShell script for a superuser question: list of all files and directories under a path recursively, without recursing into junction points or links I have a strong feeling that my ...
1k views

### Drawing faster than SlimDX?

Here is the SlimDX version: ...
361 views

### Converting from ClientSession to String and back

I have a data structure called ClientSession which I convert to a String separated by | for ...
1k views

### Digraph Code in Java

This is used to create a directed graph of type T. The directed graph has edges and vertices with values but is directional such that nodes can loop unto ...
326 views

### Streamlining repetitive class definitions in python with a class_factory() function

I forked this repo to be more concise. The code is here. I'll paste it below since that seems to be the style. I removed the class definitions at the bottom that I didn't change -- the edit I'm ...
134 views

### Displaying images based on column colors

This code displays a lot of images based on color in columns. I'm thinking it can probably be optimized a lot better. But I'm wondering if anyone has a more fundamental solution on how this could be ...
2k views

### Implementing a Scheduler(something that implements a given schedule)

I am trying to implement a class that implements a given schedule. I am trying to design this Scheduler class so it can be paused and everything. I have just written some example code so I can better ...
120 views

### Differences in execution time for problems manager

I found Project Euler some time ago and I thought I'd enjoy trying those problems. I'm using C++11 (Visual Studio 2012). I thought I'd program a Manager to test each problem and the time it takes my ...
70 views

### More simplified way of creating page links dynamically?

A little birdie suggested I bring this question here, so here it goes. Well I have a working script (see below) but it seems quite clunky and redundant; in my defense I wrote this code many moons ago,...
184 views

### URL percent encoding function

I wrote a custom URL encoding function and I'd like to run it past a few other experienced C developers. I have tested it on a few strings, and it has worked on all of them. This is to be run on ...
727 views

### Volatile boolean to prevent deadlock

I wrote this code to overcome the deadlock condition described in this Oracle tutorial. Summary of Problem: Alphonse and Gary are friends, and great believers in courtesy. A strict rule of ...
8k views

### Inline conversion/cast from Expression<Func<T, int>> to LambdaExpression

I have the following code (I need the LambdaExpression as not all Func<>'s are T, int):...
884 views

### Review of my CSS for aligning the navigation icons and text in a footer menu

The navigation in my footer menu looks like this It works, but I get a feeling that using spans the way I did was a bit of a hack. So I would also like to know how to maximize compatibility as used ...
984 views

### Review of object-oriented skills with War game

Here are my code samples: https://github.com/arthaeus/war This particular sample is the card game 'War'. The interviewer off-handedly asked me: "what if I wanted to play War with an Uno deck of ...
187 views

### Speed up position check for embedded length on stream

I received help with adding the length of a stream in the first 4 bytes, meaning it's there as an int. I am adding it at the start and sending it, while the ...
291 views

### How do I clean up these Python decorators?

I wrote some type checking decorators for Python. One checks the type that a function returns, the other checks the type that a function accepts. ...
14k views

### Change one column data from List<>

I have this code: for (int i = 0; i < lst.Count(); i++) { lst[i].ColumnOrder = (short)i; } But I was trying to find a way to do it via LINQ or something ...
182 views

### WordPress Post Type template

I have created this class for my WP theme. It allows you to create templates for a meta box which relates directly to a custom frontend template to have better control of the content displayed on the ...