/* create function stuff here */
TRUNCATE TABLE Fizz;
INSERT INTO Fizz SELECT n FROM Number WHERE n % prmFizz = 0;
ERROR: division by zero
SQL state: 22012
Context: SQL statement "INSERT INTO Fizz SELECT n from Number WHERE n % prmFizz = 0"
PL/pgSQL function fncpopulatefizzbuzz(integer,integer,integer,integer,integer,integer) line 11 at SQL statement
Why does SQL throw this error while the parameter is not even defined...
Do I need to assign a variable that equals this parameter or will this throw the same error...??
Practicing Prototypical Code
I am focusing on practicing a very prototypical structure with my code (non library oriented) to begin learning to reuse large portions of my application infrastructures where applicable in future projects. With this in mind, I do not have experience with prototypica...
Do I need ninject when implementing DAL with generic repository and unit of work?
That's not the question. Inversion of control, repository and unit of work are patterns. Ninject is an IoC container - a tool that resolves dependencies and controls instantiation and object lifetime.
You need...
A tag was recently created for autofac, which is an IoC container. The question that created this tag is also correctly tagged with dependency-injection.
A long, long time ago I wanted to create a tag for ninject (another IoC container) but I didn't have enough rep back then, and dependency-inje...
namespace Foo.App_Start
open System
open System.Web
open Microsoft.Web.Infrastructure.DynamicModuleHelper
open Ninject
open Ninject.Web.Common
type NinjectResolver(kernel:IKernel) =
let _kernel = kernel
interface System.Web.Http.Dependencies.IDependencyResolver with
member th...
I've translated this code from c#, would like it to be more idiomatic f#:
namespace Foo.App_Start
open System
open System.Web
open Microsoft.Web.Infrastructure.DynamicModuleHelper
open Ninject
open Ninject.Web.Common
type NinjectResolver(kernel:IKernel) =
let _kernel = kernel
interfa...
Name: Overly long acronyms
Originator: Simon André Forsberg
Cultural Height: The 2nd Monitor
Background: IWNPFETTOLAI (I will not provide further explantion than this overly long acronym itself)
I am trying to parse HTML using jsoup. This is my first time working with jsoup and I read some tutorial on it as well. Below is my HTML table which I am trying to parse -
If you see my below table, it has three tr as of now (I have shorten it down to have three table rows just for understanding...
I have declared a variable diameter which stores the diameter of a Binary Tree.Program is below :
public class DiameterOfTree {
public int diameter;
public static void main(String[] args) {
BinaryTree bt = new BinaryTree();
bt.createBT(); //create th...
I've been trying to figure out the best way to create a inventory system in Python. I like the way this one works but what I was wondering was if there was a better way to write it and what would be the best way to implement a search system.
inv = ['Sword','Armor']
item_values = {'Sword':['Sword...
I have a single interface called ITask, which several other interfaces inherit from. One being IGTask and another being IGtdTask. They inherit from ITask so that I can place instances of concrete types implementing these, into a single collection for databinding in Windows Phone.
The code
For b...
I have written a very simple web service with MVC and WebApi. Now I'm working the client code that will be an WPF application. What I have done works, but I'm not sure I'm doing it the "right" way. The purpose of the service is to check if there are any new software updates to the client.
My ser...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int x,color;
int opt;
Console.WriteLine(" input ");
Sys...
I have this one controller that serves up all the webpages and any dynamic content. Is this the most efficient way of doing this? Can it be improved?
package uk.co.morleys;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.RequestDispatcher;
im...
I have written a C++ program to convert an infix expression to postfix expression using recursion. I would like to know if it can be improved if possible. Can we improve it by not using stack? I am using a vector as a stack here.
The following is my code:
#include <iostream>
#include <vector>
s...
I just was raging here for 20 minutes why my JavaFX/FXML was not working, then I figured out I was expecting a Button in a method, whereas it was in reality an ActionEvent...
I had the code right in front of me, and it kept complaining, the method is not there!
The following method will add two strings of any length as binary numbers assuming the characters 1 and 0. I made this for fun in my spare time, improvements are not critical but I would like to hear them. I would also like to know if there is a more efficient algorithm to simulate a ALU.
static...
I am new to c++, i am learning c++ on my own. I have written this program to count the number of words in a string. I know it's not the best way to do this, but this was what i could think of. And please if you are going to criticize, don't comment. If you are going to help, then go ahead.
I am...
Sigh. SO user asks an unclear question. Receives comments indicating the question is unclear. Rather than responding to the comments or improving his question, he posts a different unclear question about something else. :/
@nhgrif: I meant another form of fast failing: Failing fast at finding the solution to a problem (instead of being more proficient and therefore taking longer to get stuck)
I think it's probably something that beginner programmers struggle with--this idea that you don't just type, type, type all day and then everything just works.
It's not like building a house where the carpenter knows at the beginning of the day where to put all the nails/boards so his task is to put all the nails/boards where they belong. And at the end of the day, you can look back and count all his nails and boards to see how efficient he is.
I am new to c++, i am learning c++ on my own. I have written this program to count the number of words in a string. I know it's not the best way to do this, but this was what i could think of. And please if you are going to criticize, don't comment. If you are going to help, then go ahead.
I am...
Why the following code does not assign any value to the 2D array elements? It reads the data from file; x, y, and z are all assigned with the correct values, but X, Y, and Z are zero which is the value when they initialized. The array allocated by malloc and I am using gcc (GNU). Here is part of ...
But it could be 10-20 lines of code just to set up a single view, depending on what you want it to do, how you want it to behave when the app rotates, etc. Or, you could just do all of that in interface builder. And now, not only is your codebase cleaner, but it's also easier to simply look at the interface builder and SEE what it's supposed to look like.
Which for someone who didn't write the code to set up that view, can be difficult to imagine just by looking at the code rather than compiling and seeing it.
Moreover, it can be hard to get a feel for how big 100px is on screen. Dragging edges in interface builder let you determine the size based on what looks right, rather than based on some calculation or guesstimation.
The question title suggested that this would be a Rot47 category on NSString, but it's not. It's an r47 category (which tells me nothing... what's "r47"?).
This is Objective-C, not C or C++ or any other language where cryptic terseness is favored. We prefer verboseness. The category should be...
I find it really interesting that that user abbreviated rot47 to r47...
I'd like this code to be improved
package com.array.demo;
import java.util.Arrays;
public class ArraysDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
// array initialization
int[] arr = { 5, 10, 12, 22, 4 };
int size = arr.length;
i...
Thanks, Santa! Only two more votes until my first Good Answer on here. http://codereview.stackexchange.com/questions/41596/is-this-a-proper-doubly-linked-list/41598#41598
I want to load JS files asynchronously to speed up page loading, but also need to execute JS code only once the scripts finish loading (so I need a way to implement callbacks).
I based this off of some example code on the Google Pagespeed website:
// Add script elements as a children of the bod...
Looking for input on the code itself and formatting/style please. This script parses the output of df -h on a Linux server and emails the user if the usage percentage is above the threshold (90% in this case).
#!/usr/bin/perl
use warnings;
use strict;
use Mail::Sendmail;
my $svr = `hostname`...
I am building a game based on PHP and MySQL. Basically there is a player-vs-player mode but I figured I should add a player-vs-computer mode as well, since players may not be online at all times, especially in the beginning.
Basically it is a combat type of game where players have up to 2 charac...
@kleinfreund So I've been working on this project website of mine offline, and everything worked out great, so I made a Github repo for the site and created a Github pages out of it.
I've just completed coding my template engine. I'm willing to have a review on how to increase the quality, efficiency, elegance and performance of the code, perhaps by shortening the code, etc. I'm also open for suggestions on other ways of doing this. It would be really appreciated if you point...
I've just completed coding my template engine. I'm willing to have a review on how to increase the quality, efficiency, elegance and performance of the code, perhaps by shortening the code, etc. I'm also open for suggestions on other ways of doing this. It would be really appreciated if you point...
Mi opinion:
Use the atom as a secondary asset only.
Your last sample, the website with the type alone, is great. The colors are interesting, the word and its shape as well. The straight lines work, especially if you try for example with the atom in the background -see image below-. I see it an...
@kleinfreund Unfortunately, the <sections> are making that a bit hard to do