instruction stringlengths 71 71.9k |
|---|
Working on an exercise from Functional Programming in Scala, I implemented a Traverse instance for Option:
override def traverse[G[_],A,B](oa: Option[A])(f: A => G[B])(implicit G: Applicative[G]):
G[Option[B]] =
oa match {
case None => G.unit(None)
case _ => {
val a: A = oa.get
... |
Working on an example from Functional Programming in Scala, I'm working on Option#map2:
override def map2[A, B, C](fa: Option[A],fb: Option[B])(f: (A, B) => C): Option[C] = {
(fa, fb) match {
case (None, _) => None
case (_, None) => None
case (_, _) => Some(f(fa.get, fb.get)) // runtime-safe get calls
}... |
Given the following piece of code, can it be done better:
public object DistanceFrom(
IEnumerable<Coordinate> coordinates) {
IEnumerable<DbGeography> addresses = coordinates.Select(
c =>
DbGeography.FromText(String.Format("POINT ({0} {1})", c.Longitude, c.Latitude)));
IEnumerable<Vehicle... |
I have the following questions for the below code:
Is there a simpler implementation of an on-screen counter?
I made CountTimer inner class since it's tightly coupled with the GUI part anyway. What would be the best way to uncouple them?
package count_timer;
import java.awt.*;
import java.awt.event.*;
import javax.... |
My program is a fraction calculator that is supposed to calculate the basic operations (+, -, *, /) and is supposed to exit when I enter % as my sentinel value. This is what I have so far; any feedback is highly appreciated.
#include <iostream>
#include <cstdlib>
using namespace std;
enum MenuSelection{
NONE ... |
While trying to learn more about arrays in C, I tried to write some code that did the following:
Read a stream of numbers from the stdin and store them in an array
Print the array in the order the numbers have been stored (i.e. print the original array)
Print the array in reversed order
Sort and print the array
Given ... |
Currently building my personal site using Jekyll, inuitcss and GitHub Pages. I'd like to hear your thoughts on the markup of my blog page and its post pages.
What do you think about handling logo's like this? Also I'm not sure about the headings. The page-title probably should be part of the main section.
blog markup:
... |
I just started trying out SVG the other day. Eventually I hope to be able to know how to do what SE does with their reputation graphs.
For now, I've just been trying to set up an easier way to make lines. I think my below code is decent, but please let me know what I can improve on or what I'm doing poorly.
Would like ... |
I have this stored procedure that I'd like improved. I have changed the DB name and the procedure name. I am working on SQL Server 2000.
USE [DBName]
ALTER PROCEDURE [dbo].[Table_GetSomething]
@name nvarchar(50),
@Cooltree nvarchar(10),
@aID int,
@bID int = 0
AS
BEGIN
-- SET NOCOUNT ON added t... |
First attempt was done here:
My second attempt (now using jslint to make sure the spacing is correct and have incorporate the majority of the feedback from previous attempt).
/*
* Export single function that creates the passportControl object
* The function has two parameters:
* app: The nodejs/expre... |
My app module bootstraps a Backbone.js application.
I need app to be available in every other view for easy access to router, triggering navigation, etc.
I never ported an app to RequireJS before, and I got stuck on circular dependency problem, and this answer isn't quite clear to me, so I'm not sure if I applied the s... |
In Java they're not really known as GOTO statements and are rather referred to as Branching Statements, but I find that the former term is a bit more indicative of what they actually do.
Regardless, I've been designing some code recently which has me in a bind. On the one hand, I've been taught to avoid avid use of su... |
Provides 3 types of normal ajax - get, post, and post for form data.
Also provides serialized ajax (get style) using a queue.
Please review the correctness of this code.
/**************************************************************************************************
AJAX
*/
// ... snip
Pub.ajax = function (conf... |
Please provide feedback on the correctness of this code. It should handle older versions of IE but how far back it goes I have not determined yet.
/**************************************************************************************************
EVENTS
*/
// ... snip
Priv.functionNull = function () {
... |
I can't quite figure out the best way to approach this. I have two jQuery objects that both are used to set cookies. I then parse the JSON and set a cookie that is either the users height or the users weight.
This works fine, but I feel like there is an extreme amount of redundant code here that could be cleaned up but... |
I've noticed some discrepancies in timings in our system, and I'm trying to narrow down what could be causing them.
I'm reviewing out time abstraction, and as far as I can determine it's fine.
Am I missing anything, and is it portable (besides being constrained to POSIX)?
typedef struct timespec Time;
static inline Tim... |
I just want to make sure that my Rolling (Moving) Average class is understandable and reasonably thread safe.
My main questions are:
Is having totalCounts as a long just for a potential edge case overkill?
Is checking to see if the number of observed counts is 1 (and thus, just return the observed total), also edge c... |
I have below code in one function:
public void func()
{
if (!string.IsNullOrEmpty(customerpay) && !string.IsNullOrEmpty(warrantypay) && !string.IsNullOrEmpty(maintanceplan))
{
if (customerpay == "Include" && warrantypay == "Include" && maintanceplan == "Include")
{
transactiontype = ... |
Define a macro swap(t, x, y) that interchanges two arguments of type t.(Block structure will help.)
The ideea is that a variable defined in a block structure exists only inside the block structure. So, I can create a temporary variable without affecting the code.
Here is my solution:
#include <stdio.h>
#define swap(... |
Today I started to tackle the 99 Haskell problems (http://www.haskell.org/haskellwiki/99_questions). I had to struggle with problem 9 which requires to Pack consecutive duplicates of list elements into sublists. If a list contains repeated elements they should be placed in separate sublists..
For example the input:
pac... |
PigLatin Kata
PigLatin Kata
Create a PigLatin class that is initialized with a string
- detail: The string is a list of words seperated by spaces: 'hello world'
- detail: The string is accessed by a method named phrase
- detail: The string can be reset at any time without re-initializing
- ex... |
I am learning about object oriented programming in Python using classes. I have attached an image of what I had in mind when structuring my classes. This is supposed script model cars. I want to know if the way that I set up my code it the ideal way of modeling cars.
A few things:
There are no syntax errors. I can cre... |
I've developed a simple CSS transition solution for a slide out menu with a single toggle, and would love some feedback on if anything could be simplified or improved.
Markup
<!DOCTYPE html>
<html>
<head>
<title>Slide out menu</title>
<link rel="stylesheet" href="css/main.css">
<meta name="v... |
I wrote a CppUnit test suite to unit-test the code that I posted here which is a single routine that proposes how a Lua expression could be auto-completed.
What do you think? I appreciate all the comments.
#include <boost/format.hpp>
#include <cppunit/extensions/HelperMacros.h>
class Tests : public CppUnit::TestFixtur... |
I feel like using this many partial views where a view renders a partial that renders a partial is just digging a hole of poor design, so I'm looking for any suggestions or guidance as to if this is best/worst practice. One of the reasons I don't like it is because it seems too easy to duplicate code across the differ... |
Here is an attempt to code a specific kind of Singleton - the one geared for our configuration needs. It needs to be initialized with a configuration location, do not allow copies or other instances, and provide feedback or fail in case of problems. Prefer graceful feedback from violated workflows. While not performanc... |
This function converts a list to an array when list has quotes and embedded comma:
array function convertRow(required string lstRow) {
var arResult = [];
var arTemp = ListToArray(arguments.lstRow, ',', true);
var quoteMode = false;
var startQuote = false;
for (var i in arTemp) {
if (i CO... |
Here is the original C++ class I converted to Lisp at the very bottom of this post.
class TrainingData
{
public:
TrainingData(const string filename);
bool isEof(void) { return m_trainingDataFile.eof(); }
void getTopology(vector<unsigned> &topology);
// Returns the number of input values read from the f... |
I am kind of new to object orientation in PHP and I need some experts feedback.
This class fetches the weather from this URL.
It grabs the weather, temperature and an icon from the current hour.
Is this proper OOP?
Or what can I do to improve this class?
Do I need to make it more abstract?
What can I do to make the _p... |
I am creating an app in Unity3D and it is my first time coding in C#.
I use the following code to parse a JSON file hosted on my server and use the information to render prefabs within my scene:
// Parses the json Object
JSONParser parser = new JSONParser();
AssetData assetData = parser.ParseString(mJsonAssetInfo.... |
A puzzle I was given:
Description:
Write a method that returns the "pivot" index of a list of integers.
We define the pivot index as the index where the sum of the numbers on
the left is equal to the sum of the numbers on the right. Given [1, 4,
6, 3, 2], the method should return 2, since the sum of the numbers ... |
I have two functions to count the number of set '1' bits in the first offset bits of either a 64 bit number, or a bitmap struct.
After some profiling, particularly the latter is quite a bottleneck in our system.
What can we do to make it faster?
#define POPCOUNT16(x) __builtin_popcount(x)
#define POPCOUNT64(x) __builti... |
Is there any better way of printing it?
public class PercentPrinter {
/**
* @param args
*/
public static void main(String[] args) {
for (int i = 0; i < 100; i++) {
if (i == 0)
System.out.print("percent completed: " + i + " %");
try {
Thread.sleep(500);
} catch (Ex... |
I have a model object class like this
public class EventInterestsResponse
{
public string id { get; set; }
public int sortOrder { get; set; }
public string name { get; set; }
public string categoryName { get; set; }
public string categoryId { get; set; }
}
And I am using it to hold some data like this
public... |
I'm looking for a code review, clever optimizations, and good coding practices. Unit testing has been a visual inspection and concluded expectations match. Also, is the space complexity of the extra variable used to swap \$O(1)\$? Typically, is \$O(1)\$ an acceptable space to use when code requires no extra memory?
pub... |
I have an entity RegistrationForm which has a OneToMany-relationship with SurveyAnswer.
An answer can either have a collection of FormOptions (when the answer is of type MULTIPLE_CHOICE) or a content represented by a string (type TEXT-FIELD, TEXTAREA etc.).
Below is a function inside the RegistrationForm-entity that... |
I wrote the following program to calculate n digits of Pi (where n could be anything, like 10M) in order to benchmark the CPU and it works perfectly (without OpenMP):
/*
*
* Simple PI Benchmarking tool
* Author: Suyash Srijan
* Email: suyashsrijan@outlook.com
*
* This program calculates how much time your CPU takes to ... |
Have a look to the following example. Clearly it's very hard to understand the meaning of each parameter passed to the string.Format to be replaced to the numeric sequence of {0}, {1}, ...
I want to improve the software quality: Maintainability\Code readability
http://en.wikipedia.org/wiki/Software_quality
The problem ... |
I'm creating a small online multiplayer game in NodeJS and I'm wondering if I'm "doing it right".
Here is a bit of my code:
// app.js
// if I give an id as argument we assume it's an existing player.
var Player = new player();
Player.on('playerLoaded', function (err, result) {
if (result) {
Player.se... |
I've written a small library for reading and writing PGM/PPM images. The format is described here. I attach the library itself and a small utility to convert binary encoded images to ASCII encoding. Any type of comment will be appriciated. However, these points are most important to me:
Abusing of the type system - I ... |
I like to reuse code as much as possible and keeps things DRY. But I'm afraid that sometimes it creates too many layers of indirection. It then becomes a chore to find where code exists that is relevant to the problem at hand. I'll give a couple of examples.
In the first example, I'm using inheritance on classes that a... |
Is it possible to improve this bit?
def append_nones(length, list_):
"""
Appends Nones to list to get length of list equal to `length`.
If list is too long raise AttributeError
"""
if len(list_) < length:
nones = length - len(list_)
return list_ + [None] * nones
elif len(list_) >... |
The app I'm working on should allows it's users to create tables. I have a view in which users are able to create a table. They should be able to define here the table's columns. The columns that the user adds will be part from some predefined types of columns: BusinessFields, SourceKeys, SourceAttrs,...; At the same t... |
I have the following method which encrypts a english text, given the plain text and the desired key:
/// <summary>
/// Encrypts english plain text using user defined key. Range for the key is from -25 to 25.
/// </summary>
/// <param name="plainText"></param>
/// <param name="keyValue"></param>
/// <returns></returns>
... |
How should I optimize my code for better performance? When I execute the code outside of MySQL stored proc, it is 500% faster.
MySQL stored procedure
SELECT bs.business_id, adr.street, bs.`name`, bs.description, adr.latitude, adr.longitude FROM businesses bs INNER JOIN address adr ON bs.address_id = adr.address_id WHE... |
I am new to c#, and rather new to design-patterns. I want to create a simple and a most elegant solution for loading and validating a xml file and later on extracting its fields.
I've started with a generic IData interface, that gets implemented by a XmlFileData class, but I feel that there is much more to be improved ... |
I'm working with Codeigniter and I have a jQuery file to add some functionalities. But I think I'm doing it in a wrong way.
$(function() {
var list = '../indoamericana/intranet/employeesList/';
var home = '../indoamericana/administrar/callHome/';
var profile = '../indoamericana/user/';
var addUser = '..... |
Here is a method I have in my ApplicationController, but it's "ugly" and needs some cleanup.
def user_root_path
return root_url unless user_signed_in?
return admin_root_url if current_user.admin?
return contributor_dashboard_url if current_user.athlete_contributor? && !current_user.class.name.eql?("Athle... |
def getProxiesLstFromDB():
global g_proxies
# insert to status page links table
proxies_list = g_db["proxies_list"]
proxies_list_records = proxies_list.find()
print_to_log("get proxies list from db")
for proxies_list_record in proxies_list_records:
if proxies_list_record is not None:
... |
Here is a method that takes two lists (l1 and l2) and pairs up elements that "match". As you can see at the end of the code block these lists consist of matching elements but in different indexes. The method pairUp outputs matching elements paired up, and discards those without a pair.
I spent way too much time writing... |
When the user visits the web page and hovers over an album artwork, the title of the piece and the artist name appears. It leaves when the mouse leaves.
I have achieved this with the following code:
HTML:
<img id="pic1" src=" ">
<div class="info1">
<div class="name">artist</div>
<div class="songname">song t... |
I am new to Java and wrote one small program. It works fine, but it looks like it doesn't meet OOP concepts. Could someone look and give me advice so that I can fine tune?
public class App {
public static void main(String[] arg) {
String str = new String(
"]d010036195815011121123456789]d... |
I've got a conditional that sets a cookie based on whether a selector exists. There are other places in the code where I do something similar if the selector exists. If the selector exists I either add "nfl" or "nfl-" (notice the dash) to various attributes on the page. I'm trying to remove as much code as I can as the... |
I am new to studying data structures although I have been programming in Java/Android since October. I feel it's time to advance, so I am starting data structures / algorithms this month. Since linked lists are a big topic in interviews and I knew nothing about them (I spent the past 3 days learning about it), hopefull... |
My Import method takes some data and writes it to a stream. If the CompressedStore property is true, the contents of that stream should be compressed.
This code works, however I just don't like it. For one, I call serializer.Serialize() twice. I feel this code can be made more concise. Any ideas?
public void Import... |
This is a Python script I made to create a HTML page listing the source files in the current directory. The script creates a syntax highlighted preview of the files and lists some basic attributes.
I would like to know if this is the best method to generate the HTML code? Is there a web development library that would ... |
This function is for multiplying two matrices together. It's kind of messed up because the result is actually supposed to overwrite the object that called it, or since it's static, it's supposed to overwrite the left object. Is there any way to make it faster or more readable?
public static Matrix multiply(Matrix left... |
I have created this piece of js purely for learning purposes and I was hoping you could code review to see any mistakes / improvements I can make.
Basically I have a tree structure and I will use the depth variable to work out what level of the menu I will display.
Here is the code example: http://jsfiddle.net/nqGbw/5/... |
I was trying to write a Java program to compare previous records while traversing. It returns true if element exists previously, else false.
e.g.
if elements are {"Raj","Jas","Kam","Jas"} then return true (since Jas element available previously)
if elements are {"Raj","Jas","Kam","Tas"} then return false
I have writt... |
What is more readable? value / 60 / 60, value / 3600, or Hours{static_cast<Minutes>(*this).value / 60}? Should I use constants, i.e. SECONDS_IN_HOURS.
Should I use the explicit keyword? Would it actually prevent stupid mistakes/silent bugs? Or would it become annoying to have to cast everything?
It is easy to "glaze" ... |
I have a nested JSON of multiple levels. The last level has the "series data" that is to be added to the highcharts options to render the chart data of interest.
I am sniffing the JSON and populating the options in each level which is set as a watched model in the controller and modifying the chart data, which is watch... |
Here is the link to fiddle. This is my first app using Dojo. Any comments/feedback is highly appreciated.
dojoConfig = {parseOnLoad: true};
resetStopwatch();
require(["dijit/form/ToggleButton", "dijit/form/Button", "dojo/dom", "dojo/dom-attr", "dojo/domReady!"], function(ToggleButton, Button, dom, domAttr){
var ... |
Here is an API for using a warehouse:
public static class WarehouseClient
{
event Action<IWarehouse> WarehouseCreated;
}
public interface IWarehouse
{
event Action<IWarehouseSession> NextSession;
IWarehouseSession Session { get; }
WarehouseInfo Info { get; }
}
public interface IWarehouseSession
{
... |
I want to get the source of these files, but I don't know if I'm efficient.
I get the source of the file, put the source in a list, so I put this in a hashmap with the key is the version of file and the values are the list.
private Map<String, List<String>> loadXmlNodes() {
Map<String, List<String>> mapNodes = new... |
Here is a JSFiddle of an accordion menu that i've done. I have used :before to add the icons.
My question is, is there a better way to Add different icon to each li item?
My code is as follows:
HTML Structure:
<ul id="accordion">
<li><div id="profile">Profile</div></li>
<li><div id="messages">Messages</div>
... |
I'm using the rolling curl library to fire HTTP requests for content-length headers of images (we need to know their size to weed out placeholders and low res images). The image URLs are stored in a database so I need to loop over the data in our products table (approx 1 million rows but will grow bigger, potentially m... |
Obviously, you have to test mapping code somehow, even (or especially) if you use AutoMapper. Is there any way to make it less verbose?
[Test]
public void Map_Always_SetsSimpleProperties()
{
var auctionPlace = fixture.Create<string>();
var submissionCloseDateTime = fixture.Create<DateTime>();
var quotationForm = ... |
If have the following code that via an SQL query retrieves data from a database in the form:
Id subschemaName locusName
MLST MLST LMO0558
MLST MLST LMO0563
MLVST MLVST LMO1305
MLVST MLVST LMO1089
And I want to turn this into an XML like:
<ResponseSubschemas>
<o... |
We have a table with calculated data that groups sales by product, year and month, to provide fast querying for statistics.
My colleague argues that the year and month should be two separate fields, because a day is meaningless.
I want it as a date field, because using two separate fields leads to awkward code like thi... |
In my program(C++), I'm going to use callback functions to process input from the keyboard and mouse and constantly draw a scene. How these functions process information will change depending on the state of the program; like I would have certain functionality assigned to several keys, say the arrow keys move the highl... |
I have learned the question of solving Angular app optimization for search engines, and was frustrated that the most recommended option is prerendering HTML.
After some time spent, I suggested to create a directive that will load the bot after rendering templates or update scope.
Directive:
angular.module('test', []).... |
I wanted to write a small but non-trivial function in OCaml to test my understanding. I have only a basic understanding of the libraries, and no idea at all of what is considered good style. The function computes all combinations of size k from a list, where 0 <= k <= length lst.
Would someone mind commenting on
Wheth... |
The intent of this script is to hunt down all "*/testResults/*.xml" files and touch them, so that our build system doesn't issue errors that the files are too old (it's entirely intentional that tests are only re-run when the libraries they change have been modified)
import fnmatch
import os
import time
matches = []
... |
I'm relatively new to unit testing and having gone through quite a bit of pain I was starting to feel pretty good about my tests. The problem is, now I have a nice set of green ticks I'm also suffering from the nagging doubt that it's just giving me a false sense of security and is in fact just a waste of time.
I have... |
As written, getint treats a + or - not followed by a digit as a valid representation of zero. Fix it to push such a charachter back on the input.
Before the for I check if the charachter after the + or - is a number. If it is, the function will store the representation of that number in *pn. If it is not, it will pus... |
I have the following method in Ruby that appears to be just one line too long according to Ruby style guides. (Specifically: Rubocop tells me that my method has too many lines.)
Granted, I'm only one over the apparent allowed "limit" but in the interests of seeing if the style guides are realistic, I'm trying to adhere... |
I have various types of EF entities, all of them have a navigation property called "Employee". When generating reports the user will have the option to filter the report according to the different employee properties (Cost Center, gender, etc.).
Something like this:
var courses = context.Courses
.Where(c... |
Write getfloat, the floating-point analog of getint. What types does getfloat return as its function value?
gefloat would also return an integer value.
Here is my solution:
int getfloat(double *pf) {
int c, sign;
double power;
while(isspace(c = getch()))
;
if(!isdigit(c) && c != EOF && c != '... |
Is the following good design for doing entity framework code first? What am I missing for a production system? I haven't included all my code, just a snapshot...
My application, doesn't update the database; it just reads it.
public class Document
{
[Key, ScaffoldColumn(false)]
public Int32 DocumentID { get; se... |
I'm designing a table cell based map design for a little game I'm building, and I was hoping I could get some cleanup pointers or design tips to "perfect" my engine's design. Basically, in the end result, you'll walk around the map one tile at a time. On any visible tile you can walk to it, but only the tile you're on ... |
I wanted a hash which lets me reference Japanese syllables by their romanized names. In hindsight I could have searched for an existing one column table, but I wanted to improve my ruby by writing a function which serializes these multi-column tables I found on wikipedia:
katakana:
v_eng: a i u e o
v_jap: ア イ ウ ... |
I've implemented CTR mode by myself (only decryption for now), using only AES built-in functions from pycrypto. It means that I'm not supposed to use mode=AES.MODE_CTR. However, I know that using AES.MODE_CTR would be more simple, but I'm doing this as a learning experience.
Is it a safe AES CTR??
(non-parallel version... |
It's possible to work out the number of moves required to move from (0, 0) to (A, B) for a knight on an infinite chess board in O(1) time.
This is an attempt at a solution to do it in O(n) time, where n is the number of moves required.
#define ABS(a) ({ typeof (a) _a = (a); _a > 0 ? _a : -_a; })
int movesRequired(int ... |
This is my solution for the 5th problem of Project Euler, which asks for the least common multiples of the numbers from 1 to 20 (inclusive). Is there any way to improve the while loop conditional instead of using the sum?
table = range(1, 21)
result = 1
pf = 2
while sum(table) > len(table):
flag = False
for x, y ... |
I'm curious to see what any of the more experienced programmers would do instead of methods I took as a learning tool. Any tips/tricks/fixes and reasoning is appreciated!!
http://www.jacobweyer.com
This is the result of the code so far:
<!DOCTYPE html>
<html>
<head>
<title>Alpha Tau Omega | Theta Omega</title>
<link r... |
I'm building an installer package for our software using Inno Setup. As a part of this, I'm also building a few different DLL's in Delphi XE2 to accommodate for some of the common tasks required by the installer. One of those is querying and manipulating settings on these instances. I intend to support SQL versions 200... |
I need help cleaning up this piece of code.
if is_complete == true
#If there are time stamps get between time stamps
if start_date && end_date
tasks = Task.find(:all, :include => [:task_observer, :job, :contact], :conditions => ["contact_id = ? and completed_date IS NOT NULL and DATE(completed_date) between ? a... |
I'm writing a small guessing game. I'm writing a points calculation algorithm.
I wrote the following, and it works. But I feel like I'm bringing over procedural background into Ruby, or not leveraging Ruby properly.
How would an experienced Ruby programmer approach the problem? You can test the code on TryRuby.com (cop... |
This takes a width specified by user and prints a diamond of that width. It uses only three for loops, but could I reduce that further? Is there a more elegant solution?
public class Diamond {
static boolean cont = true;
public static void main (String[] args) {
Scanner input = new Scanner(System.in)... |
I need a review on this. This code will read a 2D matrix bar code, which I hard-coded as a string str. It has "]d" starting string, which is a GS1 International body Bar Code spec. after that. It has information about Item Number, Serial Number, Locator Information. This code will read the entire string, split and ... |
This is my tentative solution to:
How can I prepare my code so that I can paste it formatted?
If you need to copy and paste code into the question or answer textarea when solving someone's problem, describing your own, or fixing someone else's formatting, this tool will correct the indentation of the code and prepare i... |
Below is the method that I have written for reading from a text file. While reading, I need to match a line string to a given regex, and if it matches, I need to add the line string to a collection.
private static void GetOrigionalRGBColours(string txtFile)
{
string tempLineValue;
Regex regex = new Regex(@"^\d... |
Is this a correct method of Fibonacci with recursion?
function fibb($limit,$first_numer=0,$second_number=1){
echo $first_numer."\n";
echo $second_number."\n";
if($limit > 0){
fibb($limit-2,$first_numer+$second_number,($first_numer+$second_number+$second_number));
}
}
|
This code will accept user input from the command line.
The first user can enter the limit of series.
e.g: user may enter 5
After that, the user will be prompted for 5 numbers of a series.
e.g:
2
4
8
10
12
Here in this series, 6 is missing, so I am going to find the missing series from common difference series.
I got t... |
My code snippet is like this:
public static string EventId
{
get { return HttpContext.Current.Request["eventId"]; }
}
And I will call this property EventId whenever I need it. Is it a good practice?
|
The configuration file of my app is similar to,
<?xml version="1.0" encoding="utf-8" ?>
<Items>
<Item Name="Coffee"
Cost="10"
Image="itemCoffee.png" />
<Item Name="Tea"
Cost="10"
Image="itemTea.png" />
<Item Name="Vada"
Cost="10"
... |
I'm writing an application that will be managed by my team, it uses Mustache.php as template engine.
I have a PHP file that makes an array of variables and functions that is passed to the Mustache parser to populate the template.
I even provide a system to override partials of my template to edit the aspect of the appl... |
The full question description is found http://www.geeksforgeeks.org/a-linked-list-with-next-and-arbit-pointer/.
Looking for code review, optimization, clean code etc.
public class CopyArbit<T> {
private Node<T> first;
private Node<T> last;
private int size;
public CopyArbit() {}
private static cl... |
Is it right? any improvements? different approach...?
import java.util.Properties;
import javax.ejb.EJBException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jm... |
I would like to connect this "JS" to Bugzilla (example: bugzilla.mozilla.org or landfill.bugzilla.org).
I started to learn JS language today and I would like to ask you:
How can I not do bad things in global scope?
How should I use functions (in var or not)?
quicksearch = document.getElementById('quicksearch_top')... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.