@rolfl: I trust that he will either back up his answer or willingly ask for conversion. I didn't choose to convert myself this time. I'd rather wait for feedback.
I have done some Researching and implemented some additions from the Questions that I found here on StackOverFlow. but I am still having issues with the service not auto-starting
here are some of the Questions/Answers that I have read
How To Auto Start Windows Service
Automatically start a win...
I'm trying to determine a sensible method of finding matches of 3, 4, or 5, for each rows and column. The player looks for areas (rows or columns) in the game board where the same "gem" will, after swapping two adjacent pieces (one swap each turn), repeat for 3-5 consecutive spots.
Here's an ex...
@Malachi: Mine is not yet at 2500, and that may take a while. Thanks for the upvote, too! I've upvoted yours as well as it looks pretty good (and actually shows research).
Yeah, it goes to show the inverse success of CR.... the worst quality questions get the most upvotes, and the most down-voted questions get the most views.... Everyone is looking for the disasters ... ;-)
Today has been a good day, I actually got some work done, put up an XMas tree, watched a niece play basketball, and it's still 4 hours before bed time so I can get more work done.
@Jamal I wasn't doing important things with my application, like logging, and i found out that it was trying to connect to a network before connections were made, so it was timing out
I couldn't find one anywhere, so I made my own:
Public PADDING_CHAR As String
Public Function StringFormat(format_string As String, ParamArray values()) As String
'VB6 implementation of .net String.Format(), slightly customized.
'Tested with Office 2010 VBA (x64)
Dim return_value As St...
I maintain the JDOM project and I am trying to 'certify' it on Android. Most things work fine, but XML Schema validation is proving problematic...
My questions are: Is there a way to do XMLSchema validation on Android? If there is, how?
Questions like this have been asked before, but no conclus...
I did it in one place and it works but not in another place, I think I need to step into the application earlier and see why one of my variables isn't being set
I created a similar program in C++ first, and then I decided to try to write it in x86 assembly language (the type of assembly I was taught in college). I've already completed the C++ version, and my assembly version is almost complete.
I did some desk-checking on both versions, first using (24...
The users get permissions to do specific things for a specific group of employees. These employee groups have a self reference. So an employee group (C) can be a child of group (B), and group (B) is child of (A). The user is granted permission to employee group (A), so if I want to check if the p...
@retailcoder ok here is a better question because I did it like that. I need to read in a number from the console. do I use Read or ReadLine and then convert it to an int? i think I am going to go with the second options
@Malachi Console.Read reads a single character. I find Console.ReadLine is more user-friendly (user controls when/what they "submit") and easier to deal with (e.g. backspace?); I'd go with ReadLine and int.TryParse :)
I am just saying the mono compiler is different from the visual studio compiler, I know all that stuff is a framework thing, but the compilers are different and will allow or not allow different things, @retailcoder
well if it is a microsoft compiler it will compile the way that you assume, but when a third party creates the compiler to match microsoft, there are going to be some things that are different
This program is supposed to be a player VS player Tic-Tac-Toe game. The computer then checks whether you've won, lost, or tied. The code does work, but I don't want it to work through hacking; I want it to be done the right way.
Sub Main()
'Initialise variables
Dim StrCoordinate(3, 3) As Strin...
@retailcoder adding some things that I want in there and then I am going to post what I have, it's not going to be as pretty as any of the rest of them, it is going to look more like the python version that got this all started I think..... :(
@retailcoder - that tic-tac-toe looks like the first 'real program' I wrote ... back in the mid 80's on an IBM PC with a green/black screen using DOS and BASIC.... the only thing missing is GOTO's and line numbers.
Back then, syntax highlighting was not so advanced either.
In this program, I am trying to print a solution for the maze with '*' indicating a wall, ' ' indicating a corridor, and '#' indicating a solution path. I am using a recursive backtracking algorithm in this program. For instance, here is a small (8-by-12) maze:
8 12
**********
* * *
* ...
I went with what I know and can use well, not what I know and can't figure the syntax out to make it look good.
so please enjoy the code and prepare to school me (probably in the basics) in C#
public static void Main (string[] args)
{
/* Here are your rules:
"Scissors cuts paper,
...
I probably won't be available to work on this code at least until next week, I won't be able to take my laptop with me. I may have to try and create a Javascript version while I am in Texas, I should be able to figure out how to test that in a browser while I am down there. that would be fun
I went with what I know and can use well, not what I know and can't figure the syntax out to make it look good.
so please enjoy the code and prepare to school me (probably in the basics) in C#
public static void Main (string[] args)
{
/* Here are your rules:
"Scissors cuts paper,
...
The results are broken in the sense that the date column is not grouped by, so the 2013-11-08 values are merged in to the 2013-11-01 results.
As far as I can tell, this is a bug in MySQL... it should have done something different... specifically, I believe it should have produced multiple results for MDATE
I want to know if this is the proper way to share text with other android applications, and if I am properly determining if the text is selected, Is there a better way to share the text that is selected? I am somewhat new to Java, is my decision statement proper? The app works just fine.
packa...
Just a thought. I want to insert unique code to the database. So let's say, my code would be from 0 to 9; 2-digit code. (just an example) And set the code field to unique.
I have here a loop flow.
This approach:
loop
digit_code = generate_random_code()
bool = insert_to_database(digit_code)...
Say I have the following SQL:
SELECT
amount,
amount*.1,
(amount*1)+3,
((amount*1)+3)/2,
(((amount*1)+3)/2)+37
FROM table
Instead of repeating that identical code every time, I really want to be able to do something like this:
SELECT
amount,
amount*.1 AS A,
A+3...
I need some opinion if my code below is proper for an async process. This code only reformats text. Please let me know if this implementation is not proper or needs some improvement.
static void Main(string[] args)
{
Task.Factory.StartNew(() => ReadCharacter("File 1.txt"));
...
He created a Gesture class which is similar to what I had originally as a SelectionBase abstract class; he embedded the rules into that object by making it so that each Gesture knows what other gestures it defeats. I had that in my IComparable<T>-abusing solution.
The error made, is that each gesture is conceptually nothing but a selection made by a player - it's the game rules that determine which beats which, and he failed to make that abstraction - doing so involves turning the Gesture class into a mere enum, and factoring the rule-definition code into some GameRule class.
@rolfl kudos for making the right abstractions the first time around, with your "beautiful encapsulated enum", in your "beautiful Java code"... now all you need is a "beautiful UI" :p
Request - code review considering optimization, cleanup , best practices.
final class EdgePrims<T> {
private final T source, target;
private final int distance;
public EdgePrims(T node1, T node2, int distance) {
this.source = node1;
this.target = node2;
this....
This is for a homework assignment and I'm sure there is a better way to accomplish the same task. It works, but I would like to learn more efficient ways than what are available in my class from real world experts.
package address1;
import java.util.*;
public class Address1 {
public String a...
I keep hearing that if I'm using goto in my code (or, of course, Ruby's equivalent) then I'm doing something very wrong. The cleanest and most readable way I've found of implementing the below function is using throw and catch. The general idea is "Try this, if it fails, try this, if that fails, ...
@rolfl Yes it would be hard to get Fanatic on CR already, since I just have been a member for one month
@retailcoder Bejeweled? Oh, you mean Candy Crush Saga / Piyo Blocks 2 / Paradise Quest / Puzzle Quest / Dungeon Raid / Azkend / Devil Invasion / Crystal Soul / Some Other Lame Name / I hate all those Bejeweled clones why not just call it Bejeweled?
I got some code for review where at package level have a flag:
public static final boolean LOGS_VERBOSE = false;
And in worker classes (multi threaded Runnable jobs) have code like
if(XYConstants.LOGS_VERBOSE){
logger.debug("some state info var 1:" + var1 + ", var 2:" + var2);
Is this ...
The next bit of code does exactly what i want it to do, but it is 'rather' unelegant and unpythonic, so the question is quite simple: how can this code be changed into something more elegant
import numpy
from scipy.stats import nanmean
def dosomething(d2):
a0 = d2[0, :]
a1 = d2[1, :]
...
@Malachi, look at the winning combos. For clarity, repeat it out: Rock, Spock, Paper, Lizard, Scissors, Rock, Spock. With that ordering, each item loses to the next two in the list (or wins against the two right before it). So for example bool defeats(Weapon2& a, Weapon2& b) { return ((5 + a - b) % 5) < 3; }. – Michael Urman 12 hours ago
I don't understand the code he used but the rest of it I get
I need a query that results in similar products based on number of common tags. For example similar products of product A (with T1, T2 and T3 tags) should be something like this:
product B | T1 - T2 - T3 - T4
product C | T2 - T3
product D | T1
I have this query but although it results are corr...
[after playing out all possible outcomes for Global Thermonuclear War] Joshua: Greetings, Professor Falken. Stephen Falken: Hello, Joshua. Joshua: A strange game. The only winning move is not to play. How about a nice game of chess?
I was given a task:
Given any integer - write a program, which:
finds all digits of the integer
writes odd and even digits from the integer
finds the biggest even and smallest odd numbers
writes out of odd digits the biggest possible number
writes the smallest possible number out of even digit...
I would like your opinion on the following subject.
I have to provide icons in different sizes and states. The sizes will be 16*16, 24*24 and 32*32.
The states bright, dark, disabled and link.
Because of browser support we decided for png instead of svg.
Do you feel this is the best css approach ...
@Jamal is it badge-whoring to ask for 10 upvotes on a meta-post? It just occurred to me that the "Weekend Challenge" post would earn me another "nice question" badge if it got another upvote. Shall we give it a go now? It's at 9up/0down :)
There doesn't seem to be anything really wrong with this method. But it has a little smell to me. Does the name make sense (do what you think it would do). Is there some logic I could use to make the enabler a bit more elegant?
private void tryEnableCRUD(bool tryEnable = true)
{
...
A method like this should do at least two things in addition to MrSmith42's answer:
It should return boolean to indicate whether it succeeded or not
if it declares a parameter tryEnable = true then it should either use it, or remove it.
I initially thought that this was just an architecture issue so I placed it on programmers as Thoughts on refactoring a generic DAO. Then I asked on codereview meta here and decided to put up the code here.
Here's a github link if someone wants to see there.
There are four DAOs - DAODelete, DA...
open System
type Date = System.DateTime
type SafeDate =
| WorkingDate of Date
| InvalidDate of Exception
let dateAttempt (x: int, y:int, z:int) =
try
let returnDate = Date(z,y,x)
WorkingDate returnDate
with
ex -> InvalidDate ex
let rnd = System.Random(...
I'm building a GUI in JavaFX for a rather large Java project. This project has many different worker threads doing some heavy computations in the background and I'm trying to visualize the progress of these worker threads in a GUI. By progress I mean not only a bare percentage but also other vari...
Say I have the following SQL:
SELECT
amount,
amount*.1,
(amount*1)+3,
((amount*1)+3)/2,
(((amount*1)+3)/2)+37
FROM table
is there a way to avoid this duplication?
@svick - serves 3 purposes ... keeps some level of interest. Allows us all to vote each other up in various ways, and we learn a few things from each other.
I'm hoping that more people will participate in the weekend-challenges. We might need to make more announcement about them though (That is, spreading the word outside the chatroom)
open System
type Date = System.DateTime
type SafeDate =
| WorkingDate of Date
| InvalidDate of Exception
let dateAttempt (x: int, y:int, z:int) =
try
let returnDate = Date(z,y,x)
WorkingDate returnDate
with
ex -> InvalidDate ex
let rnd = System.Random(...
I have been writing the application. I meant to implement a repository pattern with Unit of Work. Is it correctly done? Can you make a code review? I use SQLite wrapper sqlite-net.
IFeedRepository:
internal interface IFeedRepository<T> : IDisposable where T : IBaseFeed
{
int Count { get; }
...
If weekend-challenge questions make it to the Top Questions Last Week in the weekly CR newsletter, I bet a Community Manager is going to come by and say hi. This site was only missing a fun [meta-]tag; core users [/we] must lead by example and show newcomers that [almost] anybody can write up a review.
I agree with @SimonAndréForsberg, it shows we're an active community
And I think it's healthy for the site... until we have 450 participants posting a Rock-Paper-Scissors question within the same 48 hours...
Say I have the following SQL:
SELECT
amount,
amount*.1,
(amount*1)+3,
((amount*1)+3)/2,
(((amount*1)+3)/2)+37
FROM table
Instead of repeating that identical code every time, I really want to be able to do something like this:
SELECT
amount,
amount*.1 AS A,
A+3...
@rolfl if there is a way yes, if there isn't a way then someone can answer that there is not a way and explain why what OP is doing is the best way to go about it
@rolfl with explanation
I think that I had an Edit rejected and then I re edited it and it went through on StackOverflow
Say I have the following SQL:
SELECT
amount,
amount*.1,
(amount*1)+3,
((amount*1)+3)/2,
(((amount*1)+3)/2)+37
FROM table
Instead of repeating that identical code every time, I really want to be able to do something like this:
SELECT
amount,
amount*.1 AS A,
A+3...
There doesn't seem to be anything really wrong with this method. But it has a little smell to me. Does the name make sense (do what you think it would do). Is there some logic I could use to make the enabler a bit more elegant?
private void tryEnableCRUD(bool tryEnable = true)
{
bool enable ...