I want the website to be able to offer a gift card or something when someone sends something in. How do I offer gift cards from other stores without the customer having to buy something?
I have the below schema for user profile management,
CREATE TABLE IF NOT EXISTS users
(
userid TEXT NOT NULL,
name TEXT NULL,
lmessage INTEGER NULL,
statusid INTEGER NULL, /* statusid should refer to last status of the user in status table*/
locati...
@SimonAndréForsberg South Africa, Swaziland, Lesotho, Botswana, Zimbabwe, Namibia, Mozambique, Ethiopia, England (Wales,Scotland, etc.), France, Spain, Monaco, Italy, Vatican, Greece, Germany, Austria, Switzerland, Netherlands, Lichtenstein, Luxenbourg, Belgium, Denmark, Norway, Czech Republic, Canada, USA, Costa Rica - 28, 30 if you count Wales and Scotland, which, technically, are different countries in the UK.
I need to get out more.... but, apart from Russia, new countries are quite far away from me right now....
Iceland, Swededn, and FInland would be nice, but, I really want to get out east.... from India through to Japan, and China.
Related to this question, I wrote the (+++) function to join 2 JoinList's:
(+++) :: Monoid m => JoinList m a -> JoinList m a -> JoinList m a
(+++) Empty y = y
(+++) x Empty = x
(+++) left@(Single _ _) right@(Single _ _) = Appe...
For the Join List algebraic data type:
data JoinList m a = Empty
| Single m a
| Append m (JoinList m a) (JoinList m a)
deriving (Eq, Show)
I implemented indexJ, which searches for a matching index within a JList.
indexJ :: (Sized b, Monoid b) => Int -> ...
I am extremely new to Javascript and was assigned to make a Tic Tac Toe game using only the canvas tag. I have the canvas done, got the Xs and Os working, and now I am trying to write a code to check the winners. After finishing, however, I did not recieve any alerts I've coded so I'm wondering i...
I am computing factorials as part of teaching my self C++. I am looking for feedback on both the efficiency of the code as well as style and any bad practices I may be using.
There must be a better way to do this.
Here is the relevant section of my program:
#include <iostream>
#include <climits>...
I don't use C# very often so would be good to get some feedback on this helper class
using SharpDX.DirectInput;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SprintTimer
{
class JoystickH...
I require feedback on the plethora of bad practices that are definitely existing in the following code:
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<string.h>
#include<iomanip.h>
//***************************************************************
// ...
I'm trying to get my code to work, and i've been working with a friend on this, however, I keep getting a failure to read from my text file. I seems like the array isn't being passed the correct data from the file, unless i'm not understanding the error... Well, here is the code, hopefully someon...
I have solved one programming problem where we have to find all the permutations of given numbers.
For example,
[1,2,3] have the following permutations:
[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1].
I have written the code for it and my code successfully cleared all the tests. But, ...
My code does the job for the most part, but I don't think the two functions that look for the highest and lowest score are the best approach. In the instructions tells me to use the int as the return instead of double, but I can't tell how to take this approach.
A particular talent competition...
Usually, C++ standard library algorithms have two versions, e.g.:
template< class RandomIt >
void sort( RandomIt first, RandomIt last );
template< class RandomIt, class Compare >
void sort( RandomIt first, RandomIt last, Compare comp );
Where one version is default in some sense and the secon...
Please let me know if you think I can improve the structure of his table code.
<table>
<tbody>
<tr>
<th rowspan="2">Date</th>
<th rowspan="2">Tournament</th>
<th c...
I am new to python language. I want to give pagination for tabs as shown in figure.
how can i give pagination for tabs as shown below Image. Now i have written static code in xml i need to hard code dynamic pagination in python script.
abc.xml
<page string="History">
<...
I am trying to write a script to securely delete a file. What I am intending to do is to pad the file with /dev/zero once, and then with /dev/urandom three times and then delete the file.
For now the user only accepts one file at a time and the functionality is limited, if I am on the right trac...
I am trying to get data of events out of my database and show it on my homepage.
My database table:
TABLE `events` (
`event_id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
`event_title` VARCHAR(255) NOT NULL,
`event_desc` TEXT,
`event_location` VARCHAR(255) NOT NULL,
`event_req...
i'am trying to parse a collada document "Cube.dae" file, i created a parser for it in c++, (which i think i dont need to put it here). The parser gets file position (from-to) in integer values (i.e. from '' to '') then another fuction is executed which will use those integer values to split the s...
It's like being very annoying, but not bad enough to have a real urgent feeling of visiting a doctor... Feeling a bit weak and the doctor rooms are full of sick patients
i need help converting strings to floating point numbers, i used atof() from stdlib but it removes extra digits like this -561.0825 to -561.082. Should i ignore this or not because some floating point numbers are changed from 204.3199 to 204.32, i think every .0000000001 matters in programming, i...
Can the below code be improved? Are there any major issues with it?
Thanks
Writer w = client.sendMessageData();
for (File file : myAttachments) {
w.append("\r\n").append("--").append(bound).append("\r\n");
w.append("Content-Type: application/octet-stream\r\n");
w.append("Content-Tran...
I am desperately trying to rewrite code which reads files line by line, so to make it working with URLs and in swift.
import Foundation
import Cocoa
class StreamReader {
let encoding : UInt
let lineDelimiter : String?
let chunkSize : Int
var atEof : Bool = false
var streamData : NSData!
var f...
Funny how assembly is assembly, until you actually have to do it, and then you realize that you need the actual instruction set and errata for your actual hardware, and that each system is slightly different (or very different).
I needed to add existings models to a has_many relation using nested attributes so I overwrote thumbnails_attributes= :
class Gallery < ActiveRecord::Base
has_many :thumbnails, dependent: :nullify
accepts_nested_attributes_for :thumbnails
def thumbnails_attributes=(thumbnails_attributes)...
I have produced a working menu component for a project I'm working on, but would like to reduce the amount of code used and improve the methods - especially in the Paint implementation - still further, I feel like the function I've used and the way I've passed the variables to it is a bit 'hacky'...
Meme: Zombies
Originator: retailcoder (lol.upvote or Mat'sMug)
Cultural Height: During The Mission
Background: In a (successful) attempt to motivate the community in reducing the number of unanswered questions, a Call of Duty was made in which every unanswered question is to be regarded as a Z...
@rolfl I think that is exactly the point the code review. I had no idea about the overwriting the same blocks assumption, this was my try on overwriting a file. The answer could have been, no this is not right because you assume this with overwriting like that. Just closing the question because the script is wrong is kind of ...rough. — Erfan2 mins ago
Possibly has a point, but I am not sure........ there were other thoughts going on too.
I think that I won't define operator& between uint and gray<uint> since it will be ambiguous. I will let the user do what they want.
I still define gray<T>::operator&=(T) though. In this case, it's obvious that the return type is gray<T>& and not T. I will add a layer of documentation to cover the design choices.
Starting about 40 minutes ago (~13:45 GMT 3 November), SO, SE, and MSE at least all seem to be really slow. I'm not seeing issues with non-SE sites (not that that's scientific). Is there some network issue or similar?
Guys quick question: I've been commenting every line with a simple explanation of what's happening, step by step. This makes it easier for me to read through my code any time and understand quickly what I mean to do, find mistakes, and I imagine it'll help others understand my code easily in group projects. Is this an acceptable practice?
It's difficult to enforce those "standards" of keeping comments up to date as the code is modified. I agree with @rolfl, I would document the parts of the code that are difficult to follow or are complex, and use self-documenting features like verbose naming, and strong unit testing (a good unit test is better than documentation any day of the week).
There's a fine line between when comments are helpful, and a PITA. I prefer large comment blocks at the top of a function that says: "this function needs to do X, Y, and Z, and these are the constraints and assumptions you need to accomodate...."
Then, the only comments in the rest of the method are pointint back to that 'specification' saying "Do this because of constraint C".
The actual code should be easy to correlate back to the the spec. If it is hard, then either the spec is broken, or the code is not self-documentng enough.
I still have some doxygen comments in my code though.
But documenting overloads and template specializations in C++ for example is always a mess, whatever the tool you use and full code coverage is sometimes useless.
There are many examples of code where traditional documentation tools are useless and where a hand-written human-comprehensible documentation is better.
I have seen UInt's everywhere in other languages, but there isn't a single thing in PHP.
So, I decided to create my own!
I'm not sure in which other ways I can improve this class.
Here is the code:
final class UintArray implements Countable,ArrayAccess,IteratorAggregate
{
private $arr=a...
I'm writing a simple front controller, index.php is the main file.
In my index.php, first thing loaded is bootstrap.php via require_once().
I'm deliberating over two ways to load bootstrap.php:
A)
require_once 'bootstrap.php';
B)
if ( is_readable('bootstrap.php') )
{
require_onc...
So I am going through one of my class library projects, and while nothing is wrong with it, I am finding myself being a bit anal, and wanting to organize things a bit differently.
The project in particular that I am looking at reorganizing, is a class library to hook into a multitude of database...
First, I'll go on about how the code looks, since it displays the most obvious issues.
You have redundant comments all over the place.
// Rectangle drawing function
Function DrawRect
The name DrawRect makes it clear enough that you're drawing a rectangle in there. No need for the comment.
Si...
anyone want to comment on this Question now that it has been edited? codereview.stackexchange.com/q/67145/18427 it's the highest downvoted thing right now, should it be upvoted now?
I am trying to print the path of the current directory using this execl ("/bin/pwd", "pwd", NULL); output: /home/user/Ubuntu and want to print a desired text before the current path. for example: my name /home/user/ubntu
how this will be done?
#include <stdio.h>
#include <iostream>
#include <st...
The user inputs a number n which determines the number of groups of 6 dice to be
rolled.
The program should output x, which is the number of times 6n dice are rolled
before they show an equal number of all values. For example, if n is 1, then x will
be the number of times you need to roll 6 d...
I wanted to know if this is a best approach for the Single Responsibility Principle.
The responsibility of this class is Remind users who's accounts are about to expire due to inactivity.
On the 30 Day of inactivity the user gets an email.
On the 45 Day of inactivity the user does not get an ema...
So , I have created the classic guess the random number game.
Below is the code.
1.Generator Interface
package ishan.guessingGame.randomNumberGenerators;
public interface RandomNumber {
public int generate();
}
2.A Generator Implementation
package ishan.guessingGame.randomNumberGenerat...
@rolfl do you have a SEDE query that aggregates the average amount of time between when a question is posted and when first answer is posted, for a particular site?
@Malachi / @Vogel612 - in general I don't fuss much with deleted posts. Certainly, editing your own deleted post is not vandalism, but editing it to something offensive or spammy is a problem. Since neither of those happened here, I see no problem.
Based on chrisco's suggestion to debug the selected view (which I had already done, but went to try again for good measure), I noticed a couple of other options at the bottom of the Editor menu.
Automatically Refresh Views
Refresh All Views
I clicked "Refresh All Views" and after Xcode had a ...
Either I turned that setting off at work for some reason and completely forgot about it even existing... or some how it default to a different setting at work and at home.