instruction stringlengths 71 95.1k |
|---|
I wrote a C++ program for review and got feedback that I had not used any kind of extensibility of object orientation.
I am wondering if this is a clearly defined concept or one that is more in the eye of the beholder? How would you define using extensibility of object orientation?
My sample program took text and parse... |
Simple static class that will write out a message that is passed in. The SpriteSheet is 256x256 and the A-Z starts at line 240 and the 0-9 starts at 248. Each character is 8x8. I hate the if (ix >= 32) and wondered if there is a tidier way of doing this? I'm pleased it's only one Draw call, but it looks ugly.
publi... |
I wrote this class today, but I am trying to figure out how to make it more accurate. I pass in seconds and multiply by 1000 to make it milliseconds, and the time does not line up. I need the ability to have multiple timers, so using timer_gettime(), which limits one clock per process, is not an option. Also note I bor... |
This is a basic program I wrote that lets you select a band, and give a description about the band and publish what you wrote.
Are there ways I can apply concepts of OOP to improve this code? Any help and tips would be greatly appreciated!
(I tried to put this on JSFiddle, but it was rendering differently.)
<html>
... |
I've implemented Jon Bentley's bitmap sorting algorithm from Column 1 of his Programming Pearls book. This code supports user-defined integer range (works from Integer.MIN_VALUE to Integer.MAX_VALUE), but for now only works on a distinct set of integers.
In order to avoid overflow in the integer arithmetic, I use type-... |
I am making an app that allows the user to type chemical equations (H2O + NaCl) to the screen. The user taps, inside a tableviewcell, a custom textfield and types on a custom keyboard (both subclasses of uiviews). The vc doesn't have an actual instance of the keyboard, and the keyboard instead appears because it is the... |
I'm a C# programmer and I would like to start getting better at coding in C. I wrote a function which reads a space delimiters settings file (supports comments / and #).
The code works fine. But from the point of view of C coding style, I'd like to know if this code is well written.
example settings file:
//Destination... |
I have taken a stab at creating my first jQuery script from scratch. I use this to post an update to a Django application that allows a user to "follow" another user. I am sure that there are better ways to do this and I appreciate any help that anyone can give.
<script type="text/javascript">
jQuery(function() {
j... |
I have a properties file I'm using for GIS software. You have a feature like a road, then properties under it, like so:
{
"road": {
"colour": "rgb(0,0,0)"
},
"railway": {
"colour": "rgb(100,100,100)"
}
}
Now I need to group these into categories, for example, transportation. The firs... |
I've just started working with Workflow (WF4) and have been playing with an idea of using it in MVC3.0 controller actions to see if it improves the maintainability of complex actions; also potentially giving the ability to make multiple DB calls in parallel to populate the output model. Along with this I've been look... |
I have been building my own carousel over the past few days. I am not a jQuery guru, just an enthusiast, and I think my code is a little sloppy, hence the post.
Basically what happens is:
If someone hits the page with a # values in the URL it will show the appropriate slide and example would be www.hello.com#two, this... |
I wrote a framework and I want to hear the thoughts of other on the design patterns it uses. Every method contains three design patterns - adapters(strategy), intercepting filters, and observers.
A normal class/method in a class looks like this:
class Run extends PVStaticObject{
public static function goForARun($m... |
Under sage from another CR post I'm crafting an OOP MySQL connection/query class. Nothing new, but a place to start plying OOP PHP. Here is the current design,what would aid speed and portability?
conf/config.php
<?php
//Inlcude the Data Access Layer: Db
require_once (dirname(dirname(__FILE__)) . '/inc/class/dbc.php')... |
The factory should only have the responsibility of creating instances and knowing what types of instances to create, without having the added overhead of knowing about configurations.
With that in mind, here is how I would approach the problem:
/// <summary>
/// Each class that can generate a problem should accept a ... |
Please critique my word frequency generator. I am a beginner programmer so any criticism are welcome.
Original Code: http://pastebin.com/rSRfbnCt
Here is my revised code after the feedback:
import string, time, webbrowser, collections, urllib2
def timefunc(function):
def wrapped(*args):
start = time.time()... |
I've created a website that displays weather and currency rates for London and New York. The following is an abstract from my cityConfig.php script. Is this a good approach for adding variables from each city into an array?
// Define arrays //
$cities = array();
$currencyRateHeadings = array();
$currencySource = ... |
I am trying to create a stamp order / preview form for a site and have gotten fairly far on my own, with a little help from Google and of course you all. If you can suggest any other method of going about this, please guide me in the right direction. Also, I need to figure out how to put a border, the same colour as ha... |
I create python dictionary based on the parsed data:
user_details['city'] = None
if api_result.get('response')[1] and api_result.get('response')[1][0]:
api_result_response = api_result.get('response')[1][0] # city details
if api_result_response:
user_details['city'] = int(api_result_response.get('cid'))... |
Bulls and cows is a variation of the popular game called 'Mastermind', On a sheet of paper, the players each write a 4-digit secret number. The digits must be all different. Then, in turn, the players try to guess their opponent's number who gives the number of matches. If the matching digits are on their right positio... |
I have a function which is supposed to replace all instances of variables (represented as NSStrings) from an NSDictionary with their corresponding values before calling another procedure. I ended up doing this with a simple for loop, though I suspect that there is a better way. Do you have a suggestion how to do this ... |
I am trying to fetch information out of SHOUTcast for mutiple users at the same time. Here is my current code:
<?php
header("Access-Control-Allow-Origin:*");
function failOut($http, $text) {
header('HTTP/1.x ' . $http);
die(htmlspecialchars($text));
}
$params = $_GET;
$user = 'root... |
Here's my C++ code:
bool isPrime(double value) {
if (value == 2) // ensure 2 returns true
return true;
else if (value <= 1) // eliminate 1 and all negative numbers
return false;
else if (fmod(value, 2) == 0) // eliminate all even numbers
return fal... |
I've got a simple thing that I inherited from another developer and think it could be replaced with something a bit more elegant. What this is doing is comparing the length of a string to a set value, and setting the font size accordingly:
if(maxLen<50){$('.fc-cards').css('font-size',40);}
if(maxLen<100){$('.fc-cards')... |
Any suggestions on better way to remove the last word from a string?
$words = str_word_count($text, 1);
$lastWord = array_pop($words);
$textWithoutLastWord = implode(" ", $words);
or
$lastSpacePosition = strrpos($text," ");
$textWithoutLastWord =substr($text,0,$lastSpacePosition);
|
I'm trying to make my function more versatile by removing hard coded data.
function get_currency_rate($currencySource) {
if (isset($currencySource)) {
$feed = $currencySource;
} else {
echo 'Feed not found. Check URL';
}
if (!$feed) {
echo('Feed not found');
}
$xml = new... |
It's often useful to strip carriage returns out of a plain text document, for example when copying and pasting into a field that automatically wraps lines. However, it's usually a good idea to leave some of the carriage returns in — most obviously at paragraph breaks, but also around bullet lists, section headings, et... |
I have an NSArray called program and I need to scan it and then produce an NSSet of objects that fit the test isOperation:. If none are found I should return nil. I wrote the following code. How would you make this better? (FYI - the fact the program is of type (id) comes directly from the assignment so I can't chan... |
This function takes an array of strings and numbers and recursively processes it as a kind of "calculating program". The structure is based on Reverse Polish Notation, so the top object in the stack (last in the array) determines what to do with the next one (or two) items in the program. For example, if the array wa... |
This is a method which takes an input of a "page" object, which includes SortOrder. It then fetches the existing page items from a database and attempts to re-index.
I don't think this is at all efficient and reads horribly and wondered if anybody could make some recommendations?
public Boolean ReIndexOutputTempla... |
I have posted such question at StackOverflow but the single answer I got there was to ask here.
My task is to get elements fading in while the user is scrolling. Here is my link - http://layot.prestatrend.com/ I have made it with the help of such jQuery code I've gathered from two sources:
<script type="text/javascript... |
I've reusing this code for multiple areas and will like to make it more short and/or portable. What suggestions or changes could I make to simplify shorten it's callback processes?
$("#add_question_member").submit(function(){
$.ajax({
type:'post',
url: '/posts... |
I wrote a bash script to print contents of files in a given directory in a loop.
How can I improve command line parameters handling to the script? I feel the parameter processing as of now uses too much code and it is quite clumsy. I think I had to write too much code to validate the the option arguments are numeric.
... |
I have data that I want to insert in a database. Sometime a piece of data is already in the database, so I just want to update the fields that changed.
For example, if I insert these rows one after the other:
id | field1 | field2 | field3
1 | foo | NULL | bar
1 | baz | hello | NULL
I want to end up with:... |
I'm fairly new to Ruby, and I've been refactoring this code (it's a silly app, but it's helping me learn) as I learn more and more best practices and features new to Ruby 1.9 (e.g., hashrocket alternative). I figure having more experienced Rubyists give feedback on the short program will help me learn faster. So, with ... |
I'm a JavaScript coder trying to teach myself Java using online tutorials and ebooks. I have now created my very first applet but feel it only really goes to show the depth of my unappreciation for Java's capabilities. Please, give me some advice as to how to use Java better so that my future projects can be less effor... |
I'm getting started with my first official jQuery plugin, and I'm just turning now looking for input. I want to know what I'm doing wrong or right so far and if everything is being developed in a manner that won't cause issue down the road. With no further adieu:
$.fn.heftyBox = function(args) {
if ($(this).length)... |
After learning that std::map containers are not inherently atomic and therefore not thread-safe (check out this related Stack Overflow question and usage example), I decided to create code that would allow concurrent access to the container.
#ifndef MAP_GUARD_H_
#define MAP_GUARD_H_
/*
This class was designed to make ... |
After scouring the interweb, I am having trouble finding an efficient solution to the following issue (the biggest problem was knowing what to ask):
I'm trying to find a way to write a more efficient version of the jQuery script found on the example site (also listed below). The biggest hurdle I'm facing is figuring ou... |
I recently started working on a project that had been dropped by the previous dev. When looking through the existing code, I came across this singleton Database Class.
class Database{
private static $instance;
private $PDOInstance;
// Customize when ready
private function __construct(){
try{
$this->PDOInst... |
I have 2 validation groups, VG1 and VG2. I have a button BtnInsert that saves data into Datasource. Its Validation Group is VG2. Now, I want to validate both VG1 and VG2 when a user clicks the BtnInsert.
protected void BtnInsert_click(object sender,EventArgs e)
{
// validate VG1
Page.Validate("VG1");
// Pa... |
I debated long and hard before posting this question, and I did a lot of experimenting. I just can't seem to work out an 'elegant', concise way to get done what I want done in the manner I want it done. I found it very hard to research because of the difficulty in not knowing exactly what to search for.
Again, I am w... |
Recently I had the idea to write a module for the transformation of the dictionary into valid CSS code. And I would like to hear your comments on my code.
License MIT, BSD etc.
The code is very simple:
#pss.py
class PSS:
def __init__(self, obj):
self.obj = obj
self.__data = {}
self.__parse... |
I have a category table (brands) and 2 other tables (Pens and Pencils) that have parent-child relation with this table through a field CatID. Now I want to get a list of Brandsand number of records in child tables.
I use this query:
Select
B.* ,COUNT(P.ID) as PensCount, COUNT(Pc.ID) as PencilsCount
from
Brands ... |
I've been trying to learn how to develop jQuery plugins but have little guidance on the matter. I see lots of code on the web, of course, but am not sure what exactly constitutes best practices due to the level of variability in style.
$.notify - Displays a simple notification bar similar to that of WP7's notification... |
Does anyone have suggestions on how to refactor this?
$(document).ready(function () {
$("td,select,th").css("min-width", "150px");
$("#cancel").button({
disabled: true
});
$(".group-32 input").datepicker();
$(".group-6 input").datepicker();
$("#0LevelId").c... |
My code has to download the source code of a page and parse it for URLs. I want it to ask for number which is increased inside the critical section. My problem happens on thread termination.
Main form code:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
D... |
I'm new to Ruby and trying to do a bit of metaprogramming. I want to declare some "properties" on a class, describing some field names and their access privileges:
class Resource
# my_property(name, privilege => level)
my_property :id, :read => :admin # :write => :none
my_property :name, :read => :all, :write => ... |
I have reviewed the FAQ and I believed it was yes to all 5 q's of "What questions are on-topic for this site?"
Basically, the code below is used to perform the operation shown in the picture. I'm wondering what I can improve in the attached code to clean it up for future reference. Thanks in advance!
Sub Button1_Click... |
This is my first go at implementing the DAO pattern - let alone implementing it for MongoDB with Morphia - I was hoping someone could point out smells and answer questions from my below implementation.
public interface GenericDAO<T, K extends Serializable>
{
public void insert(T entity);
public T queryByKey(Cla... |
The background is my question is SO How to create a list of totals for durations?
where I found a recursive solution that I want to review. I could not test it for higher levels than 1 but to the best of my knowledge it should work.
What I'm trying to do is calculate a kind of "highscore", i.e. a level based on sales d... |
The code for the LevelParser is shown below. It is also documented using Java-doc; the docs are in the project directory.
Now by improving this piece of code, I do not mean optimizing it to incomprehension, or improving its performance. What I want is to make it a bit more readable and easier to maintain. Right now, i... |
This is my first OOP coding project and I would appreciate any constructive criticism as to how I could have used the benefits of Java and OOP to better effect. How would you have implemented this differently? I have been learning Java for less than a week but I hope to go on to make Android apps. See here for this app... |
The following piece of code is used to re-position controls on a form considering different options.
Once you have multiple controls this becomes quite messy. I would appreciate your improvement suggestions.
private void dlgOptionsForm_Load(object sender, System.EventArgs e)
{
if (_hideAccountingOption)
... |
This is one of my first OOP programs in normal PHP, without any framework. This combines all .css files into one and all .js files into one, and it works. Are there any suggestion on what I can make better in terms of OOP or anything else?
This is how it works:
I run this: http://localhost/folderName/css/styleindex.css... |
Summary: Please let me know, what weaknesses do you see in the described workaround for event handlers preventing garbage collection of registered listener objects...
I'm in the development of and API for a set of devices communicating with each other, and optionally with a PC trough a socket based gateway. The API des... |
I'm relatively familiar to Ruby, but I'm brand-new to testing code. I've decided to use RSpec because as it seems like a popular option.
The game works perfectly, but the spec has a lot of repetition and I have a feeling it can be improved.
The Spec
require 'rock_paper_scissors'
# game = RockPaperScissors.new('rock')
... |
I've written a JavaScript table class to make it easy to display tabular data and allow the user to sort the data by clicking on the table headers.
However, when there are hundreds of rows, performance on the sorting is a bit sluggish. I would like to know what kind of improvements I can make. I suspect that my strin... |
What my script does is:
Append data to a file on a continuous basis.
If an error pattern is observed, then do something.
I need feedback on the way I am grepping for patterns in the continuously appended file. For grep, I am creating a pattern file first and then using it with -f option to grep. Can I do this better?... |
So in my current application, I was thinking to make a extended class for all the datatypes. For int, it will be something like ExtendedInt, for bool it will be something like ExtendedBool.
These individual extended classes will expose some special functonality bound to that type. For example, this is how i think my Ex... |
I've implemented two different versions of the Fisher-Yates shuffle in javascript, and I'd like to know if I've made any mistakes.
I'm creating a deck of playing cards. I'm interested in these shuffle algorithms.
The object passed to the rng parameters below is a wrapper for Johannes Baagøe's Alea, a seedable PRNG tha... |
This is not homework. I am trying to learn OOD principles and design patterns myself.
Suppose I have a problem like this:
A book-shop buys and sells two types of books:
Non-technical {Title, Author, Price}
Technical {Title, Author, Price, CD}
Also, customer gets a CD when he buys a Technical book. A CD object is
d... |
I'm trying to build a JavaScript library that does basic financial calculations, such as NPV, IRR, PV, FV, etc. So far I've added the NPV functionality only, and it's passed my test cases. But I want to know if the code overall can be written better.
(function () {
/*
This library depends on underscore.js
*/
'u... |
For this project, I'm using a small piece of Python code to return an error 418 to any request. I'm interested in knowing if there is a much smaller piece of code that does the same thing.
#Modfied from code provided by Copyright Jon Berg , turtlemeat.com import string,cgi,time from os import curdir, sep from BaseHTTP... |
I want to get a map of all the fields in a class (aka value object) in a generic way. The following works fine for me:
class Baz {
String foo = "foo2"
int bar = 2
public Map asMap() {
def map = [:] as HashMap
this.class.getDeclaredFields().each {
if (it.modifiers == java.lang.reflect.Modifier.PRIV... |
I have a collection of radio buttons, and when I click on one, the label and text stay on the table.
HTML - radio
<div id="par01WraperAbsolute">
<div class="close"></div>
<div id="par01">
<form id="form01">
<fieldset>
... |
Here's my first attempt at creating a WeakAction using Expressions and Delegates. I would like it to be clear that this code was written after reading serveral blogs and taking snippets from various sources.
The Program class at the bottom shows a few examples of how to use it.
Does anyone have any performance improvem... |
I wrote a simple program that takes the enable1.txt word list of scrabble/words with friends and searches it for an input. In order to search the massive list of 172,820 words I figured sorting it then using a binary search would be a good idea.
The sorting algorithm I used was std::stable_sort as I wanted similar word... |
I'm starting to reuse this pattern, and was wondering if there was a more succinct/clear way to write it.
Given a function foo taking a callback argument:
function foo(..., cb) { ... }
And function bar which calls foo with several different arguments taking a callback function of its own to be called when all the 'dep... |
I've written a php function and some helper functions that checks for cookies when somebody lands on a page but it's not so fast. I want to know is there any way to make it faster or improve it i know it's possible to check for cookies client side using javascript but what if it is disabled also so i need a pure server... |
I'm trying to create a Bindable FlowLayoutPanel that can take a DataSource and map it the specified generic parameter <T> controls. Only minimal requirements are to have a selectable index and to be able to change the background color of the selected and deselected controls. I've tried to leave out the implementation... |
I need this kind of ORDER BY to list my curriculum vitae data: when ep.data_termino is null it means that the job is your current job (you can have multiple current jobs), then I must list them first. Then, I need to list all the others ordered by the ep.data_termino ASC.
The IF was my only choice. I know that it is ne... |
I wanted to parse lines of text as tab-delimited items, and I had just been using a StringReader for something else and I came up with this:
class TabDelimitedFieldReader : StringReader
{
private string _nextLine;
public TabDelimitedFieldReader(string s)
: base(s)
{
}
... |
This is really simple but I would like to improve the efficiency as it's run frequently on the client:
function resizeSidebar() {
var h_tmp = 0;
if ($("#internal-holder").length > 0)
{ h_tmp = 250; }
else
{ h_tmp = 181; }
var h_var = $(window).height() - h_tmp;
var h_fixed = $(window).hei... |
I am learning some OOP on PHP and I have developed some sample code to practise.
Ignoring the functionality, I just want to learn the "best" or "better" way to write OOP codes in PHP.
The following is my code and I hope anyone who has been doing PHP can help to review or comment for any improvements or weaknesses on ... |
Does this snippet take too much memory? How can I let the connection opened with the function connectTo outside the forever loop?
import Control.Concurrent
import Network
import System.IO
import Control.Monad
import System.Environment
main = do
[host,port]<-getArgs
let pn1 = fromIntegral ( read port::Int)
... |
I'm wanting to create a Reusable class to work on Enumerations so that I can decorate various Enums with different attributes and I can use this class to get a particular attribute property to display.
An UnitTest example of how I would use the class is:
internal enum TestEnum
{
[System.ComponentModel.D... |
This is a C++ wrapper for the National Instruments ANSI C library for interfacing with NA-DAQmx devices such as the USB-6008. I wrote it for use in real-time data processing to test algorithms developed in my dissertation research.
I'm sure there's lots of room for improvement. Suggestions on style are welcome, in ad... |
I like this. Anyone want to rain on my parade here?
public void LoadDatabasesTest()
{
string[] args = new[] { "LoadDatabases" };
ReportsService.Program_Accessor.Main(args);
With(GetModel(), m => m.Databases.ToList().ForEach(c => Console.WriteLine(c.Name)));
}
void With<T>(T target, Action<T> action) where... |
I am writing some library code that is mostly templates and so is all contained in header files. I know that placing a using declaration in a header will pollute all the files that include it, but I'm also starting to be really annoyed by having to spell out all the namespaces..
After a bit of tinkering I came up with... |
I'm currently in the process of clearing out the final parts of this question here.
Am I going about this the wrong way / could it be done smarter (interface perhaps) - or am I just plain silly, trying to keep my polymorphism hierarchy alive at "all means"?
I have a TBaseObject class - with a TBaseList<T:TBaseObject> c... |
My JS looks like this:
preLoadImages("/media/img/elements/frontpage/1.jpg","/media/img/elements/frontpage/2.jpg","/media/img/elements/frontpage/3.jpg","/media/img/elements/frontpage/4.jpg","/media/img/elements/frontpage/5.jpg","/media/img/elements/frontpage/6.jpg","/media/img/elements/frontpage/7.jpg","/media/img/eleme... |
I have a text file that uses the convention #\d+ to mean ASCII character number \d+. I want to replace any such representations with the actual character. This is what I've come up with. It works but it feels kludgy. Suggestions to improve efficiency?
<?php
$line= 'stuff #65 more #66 and #67; other';
preg_match_all(... |
This code is for a problem in which I'm to find the total number of numbers that exist between A and B, of which sum of digits and sum of square of digits are prime.
How can I make this optimal?
import java.util.Scanner;
public class LuckyNumbers {
static int T,ans[];
static long A,B;
public static void mai... |
The code below has been a pet project of mine for some time. It allows simplified browsing of websites that have a predictable URL structure, namely TGP websites.
It has been greatly modified from it's original version to be effective on Android, and there is probably alot of room to improve on it. I'm not asking anyo... |
I want to put some text next to its label (both of which are text blocks - which are faster than labels as I understand it). The best way I've found for doing this is a stack panel.
I have (repeated 3 times in a control) code like:
<StackPanel Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2" Orientation="Horizonta... |
I just posted this code in SO and one person said my code sucked, and that I should post it here. So here it is (with fix I asked for included, so you don't have to worry about that).
The main concerns that I have with it myself is how I iterate through a sequence of objects that the object itself is in. Apparently id ... |
How could this be improved style-wise (if this isn't good enough) when the need is just to have a console replacement for PrintWriter.format() with backwards compatibility?
class CCConsole // not to be confused with any Java class with a similar name
{
static PrintWriter pw = new PrintWriter(System.out, true);
... |
I would love some thoughts on this class that a wrote to extract user information from a logfile line.
I'm concerned about design patterns and the complexity of the code. The extract_user method feels especially awkward.
The class should be used as a public interface ala:
parser = UserExtraction(s)
data = parser.extrac... |
I want to return the title of a record if one exists or the word 'invalid' if not:
@ID int ,
@Title nvarchar(50) output
...
if exists(select * from MyTable where ID=@ID)
select @Title = (select Title from MyTable where ID=@ID);
else select @Title = 'invalid';
but I don't have a good feeling with this q... |
I'm looking to speed up this method. Ideally, I would like to cut the time in 1/2 or more. At the moment I have to draw the screen line-by-line as the font is 16 pixels high, but it is being drawn with an extra blank pixel on the bottom. If I could figure out how to set the line-height to 16 pixels I would imagine that... |
I'm a rather novice programmer who recently came up with a solution that works for my project, however I'm always looking for ways to improve my code.
So essentially, I have a settings form that pop's up and I was looking for a way to put it next to my main form but not covering it nor appearing partially off of the s... |
Interested to hear any suggestions on object orientation and style for this simple spreadsheet implementation. The spreadsheet contains cells with equations in reverse polish notation and has a solver method to either determine the cell values or throw an exception if a circular reference exists.
/**
* This class enca... |
This function is to return the size of the largest clique in a graph. When I run this code, I am running out of space at runtime. Also, it is insanely slow, so any speed tips would be appreciated.
int cliqueSize(graph &g, std::vector<VertexID> nodes, std::vector<EdgeID> edges)
{
std::vector<std::vector<VertexID> > ... |
BFS and DFS in Java. Please give suggestions!!
Class Main {
public void bfs()
{
// BFS uses Queue data structure
Queue queue = new LinkedList();
queue.add(this.rootNode);
printNode(this.rootNode);
rootNode.visited = true;
while(!queue.isEmpty()) {
Node... |
int X = 1;
int Y = 0;
while (X != 99 - 1 || Y != 99 - 1)
{
Y++;
if (Y > 99 - 1)
{
X += 1;
Y = 1;
}
Layer1ID[X, Y].Update(X, Y);
Layer2ID[X, Y].Update(X, Y);
}
This must update a total of 19602 objects each tick. Is there any way to speed this up? Threading maybe?
Objects(Ground ... |
Here's my first significant Haskell program - it presents a count of each word seen on stdin. Any comments are welcome.
import Data.Map
emptyMap = empty :: Map String Integer
countWord m s = alter (\x -> case x of
Nothing -> Just 1
Just n -> Just (n+1)) s ... |
This little script makes list items selectable and draggable. I'm pretty new to programming in general, and even more so to Javascript. Most of my background is in PHP and some C++. On the large, I don't think this is the proper way to be writing code in JavaScript. I know global variables are bad, but I'm not used to ... |
blah - not even sure if that is the correct way to say it. Basically I have this
public class XmlAccess
{
public XmlAccess() { }
public string ApplicationPath = "";
public string DBServer = ConfigurationManager.AppSettings["DB2_Server"];
public string DBName = ConfigurationManager.AppSettings["DB2_Dat... |
I have the following block of code which adds pins including descriptions and links onto a Google map. How can I refactor it so that I can add pins easier and without so much redundant code?
var map;
function initializeMap() {
var myOptions = {
zoom: 9,
center: new google.maps.LatLng(42.2340464046899, -71.0956... |
I'm new to Fortran, and this is pretty much my first escapade. Below is a function that I wrote which relies on calls to LAPACK. The function is sat in a module with some other functions and works perfectly, but seeing as this is really the workhorse of the program I'm building I want to squeeze it hard for performance... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.