« first day (717 days earlier)      last day (3598 days later) » 

00:00
I didn't say he's stupid.
Just because someone has nK reputation, doesn't make them exempt from asking basic questions, also, they may have points for language1 and be branching into language2.
I just said it was interesting...
I wasn't criticizing.
Oh, I see
I must agree then
:P
Hey, what are review queues?
00:35
Maybe this will be convincing enough:
i.imgur.com/rC2CtTn.png using it as an if let does not compile. Xcode 6.3, Swift 1.2. Using it outside the let is exactly what my first comment warns about, and that comment will stand. i.imgur.com/7VxVaIX.png It will crash if firstObject returns nil (and it very much so can). — nhgrif 4 mins ago
Can't you just declare it seperate to the conditional?
Huh
that's confusing
What do you mean exactly?
Using it in the conditional is a good and special trick to do. It's definitely the recommended approach... but you have to use as? rather than as!
if photos.firstObject != nil
doSomething
0
Q: Create a structure to store data about a movie

MaryBelow are the instructions for my program and the source code. My program runs and works but I would like second opinions on how to make my program more efficient or if there are any loose ends in my source code. Using functional decomposition, write a C++ program that will use a structure call...

Quill, then you have to do this...
if photos.firstObject != nil {
    let photo = photos.firstObject as! NSDictionary
    // do something with photo
}
So, that's more code, uglier, and still prone to crash if firstObject is something other than a dictionary
00:47
I suppose
Recommended approach:
if let photo = photos.firstObject as? NSDictionary {
    // do something with photo which is definitely a non-nil NSDictionary
}
photos is an NSArray. NSArray's firstObject property's return type is AnyObject?, that is, it could be any type of class or nil. The question mark is Swift syntax for optional value.
01:31
0
A: Create a structure to store data about a movie

Hosch250If you enter an invalid number for your int values, your program breaks. To prevent this, you could check your input like this: int val = -1; do { if (!std::cin) { std::cin.clear(); std::cin.ignore(); } std::cin >> val; } while (!std::cin); This will make your us...

Two answers today.
I can't shoot hostages?
This game limits my abilities
> 1914x1080
What kind of crappy resolution is that
How do they even get to that
I'm missing out on 6 vital pixels
6x1080, even
Ah, it calculates the border of windowed mode
fancy
@JeroenVannevel What game is this?
@Quill GTA V
@JeroenVannevel around 60GB wasn't it?
Yeah, 59.1. Took me almost 2.5 hours to download it
01:44
I literally have 180kb/s here, I don't even want to do the math on how long that would take
steam's estimate was 17 hours at 1024 KB/s
180 kb/s is terrifyingly low
ADSL1 internet, modem made before wifi was widly around, router is from 2009
> This is what i have so far using The amazing audio engine
Sounds like a superhero
0
Q: JAVA SERVER How is my chat server code? Anything that can be improved? Does my Cleaner work as it should?

Charles StaalUserConnection /* * Copyright [2015] [Charles Joseph Staal] */ package com.staalcomputingsolutions.chatroom.server.model.clients; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.n...

02:02
If GTA is any indication of my real life driving skills, I'll need an amazing insurance
And lawyer
Lol.
I need to get my license this summer so I can drive to my internship next summer.
And I'm waiting for my $age to increment several times.
It's GTA.... just do $age++
I think bjb is talking about life...
also, if GTA was written in PHP
02:19
I should become a stresstester
This car is going down
I'm sure enough 14 year olds have volunteered already
0
Q: VBA Text Array - Scan two columns rather than one

PootyTootI have some code which is designed to scan Columns F & G for occurrences of words found in an array, the array containing text found in Column J. If it finds occurrences in either Column F or Column G, it will copy and paste the terms into the corresponding columns. During testing, the code pr...

I meant for the car manufacturer
Though they have already surprised me
I feel sorry for my sister.
I'm whipping her 270-202 in Words with Friends.
02:53
If your code works, try asking this on Code Review. — TigerhawkT3 just now
Just don't do that? Not sure why this is more problematic than naming controller HeaderCantroller "which breaks the architecture"... Is there particular reason you are looking for it (like particular pattern that can't be stopped with good naming/code review)? — Alexei Levenkov 51 secs ago
@TigerhawkT3 uhm... i really don't know, what is code review? — E.Laemas Kim 29 secs ago
0
Q: TopCoder problem "Bonuses" used in SRM 145 (Division I Level One)

PrakharThe problem statement Summary: You are given an int[] points, where each element contains the points earned by the corresponding employee (i.e. points[0] is the number of points awarded to employee 0). Using this, you are to calculate the bonuses as follows: First, add up all the poi...

03:27
0
Q: SPOJ problem - The Last Digit

Atul ShanbhagHere is the problem statement: Nestor was doing the work of his math class about three days but he is tired of make operations a lot and he should deliver his task tomorrow. His math teacher gives two numbers \$a\$ and \$b\$. The problem consist in find the last digit of the potency of ...

03:43
It's a SE site where you can ask for advice on how to clean up and improve working code. — TigerhawkT3 12 secs ago
Monking!
Monking
03:55
0
Q: C++ assignment in school LAB; enter values, generate a list, and search

bedlamI made this program in C++; can it get smaller, faster, and easier to read? #include < iostream > #include < string > #include < algorithm > #include < vector > using namespace std; void main ( ) { vector < int > nameTemp { }; vector < vector < int >

There are monkings here? What a waffley world.
OvEbll83!b#212654ZZ^
HEY YOU GUYS!!! Guess what! I just updated my website; Graphics Geek. I linked to this room a couple times on it as a resource for other programmers, and to say thanks for your help. :D
> "So, what else can I find here?", you ask? I have been sharpening my database skills with the help of The Eagles Club's Calendar of Events, as well as the friendly people of The 2nd Monitor - a programming chat room provided by Stack Exchange.
:21210075
Hi again, @Shortstuff81000!
Whoops, wrong room.
04:30
Hmm, I find that our former mod codesparkle is from Australia.
04:45
0
Q: Query to find users from where?

Hosch250Based on my question here, I have updated my query to take user input so it can be a generic query: DECLARE @location AS nvarchar(max) = ##location:string##; SELECT u.Id [User Link], u.Reputation, u.Location FROM Users u WHERE lower(u.Location) LIKE lower('%' + @location + '%') ORDER BY 'Reputat...

05:41
0
Q: Off-line minimum using disjoint sets - C

Dang Manh Truong" The off-line minimum problem asks us to maintain a dynamic set T of elements from the domain (1..n) under the operation INSERT and EXTRACT-MIN. We are give a sequence S of n INSERT and m EXTRACT-MIN calls, where each key in (1,2..n) is inserted exactly once. We wish to determine which key is r...

05:56
-2
Q: Javascript & C#

Sathishupdate gridview cellsBind by checking checkbox checked using javascript without postback everytime For Chk1 is in Processing | Status | CheckBox Column | 1 | In Processing| Chk1 checked | 2 | Requested | Chk2 checked | 3 | Requested | Chk3 checked | After Completed Chk1 process the output wil...

06:51
@JitendraPancholi: This is actually a very good answer. This is a general problem I see with architects, who rather try to prevent people from being able to do things wrong, which often lead to very complex useless code structures where the developers still find a massive amount of things to do wrong and ways to work around the architect's restrictions. Instead, developers should be educated and the team should have code reviews, because those are much more effective. — Steven 42 secs ago
0
Q: Is my design following Single Responsibility Principle?

davidI am using RestTemplate as my HttpClient to execute URL and the server will return back a json string as the response. Customer will call this library by passing DataKey object which has userId in it. Earlier I was using AsyncRestTemplate which is part of Spring 4 but in my company they are not s...

07:31
Thank you! I edited your answer and add it here:codereview.stackexchange.com/a/87518/70836 . — hasanghaforian 36 secs ago
@PanagiotisKanavos: and because you need to make assuptions this questions isn't cleat at all. Code refactoring is also off-topic on So, he could post it on stackexchange.com. — Tim Schmelter 19 secs ago
0
Q: SPOJ problem- The last digit of a number to a power (follow up)

Atul ShanbhagAs a follow up to my post here. Please refer to the problem statement in that post. I have edited this code to make it time efficient, but doing so the size of the source file has crossed the limit of 700 bytes. Here is the edited code #include <stdio.h> int main() { int t; scanf("%d",

0
Q: Recursive functions for C++

OinkOinkWe have a formula a_n = a_n-􀀀1 * a_n-􀀀2 - a_n-􀀀3, where a_0 = 0.1, a_1 = 0-2, a_2 = 0.3. Write a progam to compute the value of a100000, and print the value to the screen. Array and vector should not be used in this program. This is the code that I've came up with: #include <iostream> using...

0
Q: Write struct data to binary file, then read and print data.

dxrsmI'm self-studying c and trying to understand memory allocation and basic I/O. My code creates a "database" object which contains a pointer to an "address" struct. This last pointer I use as an array, and allocate for it the required space. I write the data to a file, and the I open the file to re...

08:05
0
Q: Division Program

user3189142I wrote a program that does division and either does or doesn't show repeating groups. After designing it the first time I had to redesign it because although it worked it was unnecessarily complex. And now I am presenting to you my refined division program, for feedback and improvement ideas: i...

0
Q: XML parsing program in C++

JimmyThis is my code which works and compiles but I feel make be non-optimal. It reads two xml files and finds what has been added or deleted on the new file. For new items it uses a map to link a tag name to a category of data (content tag is a description). This is importance since different files ...

0
Q: WinHttpRequest / MSXML2.DOMDocument in VBA imitate using Internet Explorer

mamoI am trying to find the quickest way to get the HTML code of a webpage. The issue is that I have to use the internet explorer, for this webpage. As I know using WinHttpRequest is so way much faster, my question is: Is it possible to use the WinHttpRequest or MSXML2.DOMDocument but "pretending" ...

09:00
0
Q: validation of drop box which is dynamically added from database

priya18How to validate drop boxes which will not select same values when submit the page.The drop boxes are added the values dynamically from database

09:37
-1
Q: Component and Architecture Behavioral

valkongrI want to code a mux 4 to 1 that is using mux 2 to 1. It does compile, but when I try to load the design it says # Error loading design . I really can't figure what is wrong and my guess is that it has something to do with the component. library IEEE; use IEEE.std_logic_1164.all; use ieee.std_lo...

Do you believe in best ways in programming? So your code works, and it is all about effectiveness? There is special site for code review. — Regent 14 secs ago
If this is working code that you think could be improved, consider codereview.stackexchange.com. However, note that on CR and SO the code should be in the post itself. — jonrsharpe 31 secs ago
Then if you want to ask here, reduce to a minimal example. If you think CR is more appropriate, see e.g. meta.codereview.stackexchange.com/q/1919/32391jonrsharpe just now
09:55
0
Q: Checking that data has been created in multiple tables

d347hm4nI have 4 tables that I want to check for data. When there are Rows in all the tables - I want to print a success. When there aren't any rows in any table I print an error - When 1 or more table is missing data I want to warn (Unless they are all missing data) The following script does exactly wh...

10:09
1
Q: Pygame game structure

RoopeI'm building a game with Pygame, a simple turn-based strategy game where on each turn a character can move and/or perform an action. I have a somewhat good structure for the game on the background, and pygame provides the gui for that. Below is the code of the main file. I think the structure of ...

10:22
0
Q: Python algorithm, find arbitrage bets

Martol1niThe goal is to find the triples (O1, O2, O3) that satisfies 1 <= 1 / O1 + 1 / O2 + 1 / O3 <= 0.87 Exampledata: o1: [{O1: 2, O2: 3, O3: 10}, {O1: 1.8, O2: 8: o3: 4}], o2: [{O1: 1.8, O2: 8, O3: 4}, {O1: 2, O2: 3, O3: 10}], o3: [{O1: 2, O2: 3, O3: 10}, {O1: 1.8, O2: 8: o3: 4}], As you can see, ...

10:34
Wrong place my friend, try codereview.stackexchange.comEpodax 15 secs ago
I'm voting to close this question as off-topic because we don't do code reviews over here. — PeeHaa 44 secs ago
Monking
off to work
10:57
0
Q: Designing a Ciruit of Gates in Clojure and doing forward and backpropagation

Ashish NegiI am reading Hacker's guide to Neural Networks. Since i am also learning Clojure, i tried to implement them in Clojure. I would like the feedback about what could be more idiomatic and better in the below code. Also i have some problems which i have asked at the end. Here i have simple gates li...

1
Q: Python PBKDF2 using core modules

Wizard Of OzzieI'm trying to implement pbkdf2 in Python 2.7/3.4 without needing the pbkdf2 module. (I'm also trying to avoid using classes.) Any insight would be appreciated: from binascii import hexlify, unhexlify import hmac, struct, hashlib, sys is_python2 = True if sys.version_info.major == 2 else False ...

1
A: malloc(), free(), realloc() using brk() and sbrk()

Gareth Rees1. Performance This memory management implementation maintains a single doubly-linked list of memory blocks. The main causes of the performance problems are as follows: When malloc is called, the global pointer to the list is needlessly updated (see §2.18 below) and then the whole list is trav...

^^^
> (See §2.18.)
11:25
Greetings, Programs.
On the one hand... I sometimes feel I should just silently downvote SO answers and move on... On the other hand, if no one else has commented, I feel an obligation to explain the problem with the answer.
This is fine until the answerer is not competent enough to drink the water you've led them to...
Are you recommending if let photo = photos.firstObject as! NSDictionary? (Taking the answer in context with the question) Or are you recommending verbatim what's in your answer? let photo = photos.firstObject as! NSDictionarynhgrif 11 hours ago
i.imgur.com/rC2CtTn.png using it as an if let does not compile. Xcode 6.3, Swift 1.2. Using it outside the let is exactly what my first comment warns about, and that comment will stand. i.imgur.com/7VxVaIX.png It will crash if firstObject returns nil (and it very much so can). — nhgrif 11 hours ago
0
Q: Is there something wrong with my remove-duplicates implementation in Scheme?

user16655For an assignment I handed in this code to remove duplicates from a stream. (define (remove-duplicate lst) (cond ((stream-null? lst) '()) ((not (member-stream? (stream-car lst) (stream-cdr lst))) (cons-stream (stream-car lst) (remove-duplicate (stream-cdr lst)))) (el...

0
Q: Translating specific file-not-found exception in C# to inject additional troubleshooting hints?

Martin BaMy code needs to open a specific file. Under certain (expected, but rare) conditions, the code will get handed a file path to a file that does not exist -- the path is expected to be otherwise valid though. The point is that if I get handed a path to a file that does not exists, this is an expli...

11:50
There are a few issues with your question that make it likely to get closed. 1) The ellipses make it smell of example code, although I don't believe it is. 2) You're talking about injecting the reason, but you're doing no such thing. You're hardcoding it. Adding/changing functionality is off topic here. — RubberDuck 59 secs ago
Holding off on any votes for now. It's borderline. Needs improvement I think.
I just verified that the code will now compile (assuming a using statement for System.Collections.Generic and the existence of the ResourceDictionary class). I've voted to re-open. — RubberDuck 12 secs ago
Afternoon :)
Monking @DJanssens
Strictly speaking, you shouldn't hold off votes.
If the question is off-topic as-is, it should be put on hold as-is, then the user can edit it into shape, and we can re-open.
The ultimate sin has been committed... Someone made a new control, then made a form that uses the new control... Then committed the form without committing the control... I cannot build my project... 18 million lashings when he gets in this morning.
12:11
Why not? I'm not sure if I think it's off topic or not. I'm not going to vote if I'm not sure.
@nhgrif The monk is in need of a most serious correction.
Oh, you seemed more sure.
Feeling more sure now I think.
Definitely more sure now. OP edited to clarify (and try to make it on topic), but only clarified that it is certainly not.
Hmm... Gitlab + Jenkins as version control and continuous integration for developing a full-stack application (likely some Javascript frontend (AngularJS or React or something) and REST API backend, possibly Spring MVC
Do we need more tools?
I just realized I posted a code review request, so I made a separate question on the code review beta. Thanks for your time. — C Bauer 29 secs ago
Monking!
12:28
@skiwi Always
0
Q: Test file word cloud in F#

C BauerThis code is meant to take in a command line argument and output a 'tag cloud'. It's more of an exercise in learning F# for me because this is my first non-tutorial code file and I was wondering how this code could be improved? open System.IO open System [<EntryPoint>] let main args = let ...

As long as you know when to use what, you can never have too many tools.
There should be more advice in the world about how to use a debugger.
4
I am not missing today's star-fest.
Agreed. Many of the students in my class could have benefited from a 30 minute lesson on debugging.
Oh. Thinking of, @rolfl you were right. I did learn something. I learned about anonymous types the other day. So, all is not for naught.
That's ...well... OK then
12:58
Please see also the question on codereview. — mat 7 secs ago
There should probably be advice on how to avoid using a debugger.
2
@200_success There is. It's called TDD.
@200_success there is advice for this... "Go ask on Stack Overflow... Paste a wall of code and say 'I tried this but there were errors.'"
You're not going to write code that doesn't crash before you write code that does.
And there are plenty of people who don't even know where to find the exception message that post to SO.
13:21
Plus, inevitably, the guy whose code you are maintaining was a clown-shoe-wearing idiot who should be flipping burgers. This is always true even if that guy is your former self.
0
Q: Replacing all occrances of a substring in a string without using regex

AnirudhProblem Statement: Given two strings, base and remove, return a version of the base string where all instances of the remove string have been removed (not case sensitive). You may assume that the remove string is length 1 or more. Remove only non-overlapping instances, so with "xxx" removing "xx...

0
Q: Query the context or resulting list

PeteI was just getting some products using entity framework and was wondering which would be better to do when getting the results or if there is no difference Option 1 - Query the context directly return dbContext .PPCProducts .Include(p => p.Attributes) ...

0
Q: Model interval inclusiveness in C#

csetzkornThis is my first attempt to model a day's time interval and the fact that the start and end are either inclusive or not: public class UtcTimeOfDay { public int HourOfDay { get; set; } public int MinuteOfDay { get; set; } public int SecondOfDay { get; set; } } public class UtcTimeInt...

half way to a C# Gold Badge
65 more answers and 500 more upvotes
13:36
I need 41 objective-c answers and 287 upvotes for gold.
I have enough votes for the bronze beginner tag, but I still need to answer 7 questions if I want it.
this is not a code review board. Please make a MCVE (stackoverflow.com/help/mcve) and update your question — knitti 39 secs ago
14:18
Is @StackMonkey going to get an actual icon?
It should literally be a stack of monkeys...
4
I suspect Duga is going to reappear really soon.
@Duga needs an icon too.
-1
Q: First Java Program

Φλώρα Κ.hey guys i am making my first program in java and it is about a hospital archiver..we have to read from a standar input and one question is about to put in the doctor's class a code that is unique and is given by the system not by the user..do you have any idea if this variable is going to be fin...

14:35
If visual studio couldn't not try to write more code than me, that'd be nice.
0
Q: Combine columns to produce product keycodes using Ruby CSV

Soviet_JesusI have written the following code that achieves my desired goal of converting a "raw" CSV file into a keycoded list. The idea is that a person will get the first product they ask for, and English products are coded as blank because they are the default. The following gist contains a sample of the...

I see you backspaced an End If... Let me just change your indentation on about 30 lines...
I see you wanted to create a new empty line after the word Then, let me just create another End If and change your indentation all over again.
VS can't figure out which End If belongs to which If yet insists on making massive changes everytime you try creating one or deleting one.
This should be on codereview. — Daan 39 secs ago
General code review and advice is off-topic for this site. — Abhay 45 secs ago
Code review; that or closed as a duplicate to the "How to avoid SQL injection" link. — Fred -ii- 44 secs ago
As noted above, this REALLY should be on codereview.stackexchange.com since you are not trying to solve a specific problem. — Mike Brant 6 secs ago
14:51
@StackMonkey Oh, CR is the place for not solving a specific problem? Lol.
I'm voting to close this question as off-topic because this should be on codereview.stackexchange.com — Mike Brant 33 secs ago
Sorry. I simply wasn't aware of the codereview site. I'll try post it there then. And obviously I'm not saying just because this part is secure then everything else is too. But it's this part that I'm suppose to do and secure here. — gerre 20 secs ago
15:08
0
Q: Javascript - Process multiple AJAX or SOAP calls on an array of objects

Below the RadarEach object has to trigger multiple AJAX calls, but the order here matter. The first object must have completed all its requests before the next object starts his requests and so on. Actually, in my code, all objects are processing their requests simultaneously even if I use a timeout in the wai...

0
Q: Secure login system

gerreThe assignment is to create a login system secured for SQL injections and XSS. It's in PHP and i'm using PDO with prepared statements obviously. Which from my point of view should protect againts the simplest injections at least. The ones I'm throwing at the system are ineffectual. If you belie...

Check out this post, if you just want to calculate the Bell Number: codereview.stackexchange.com/questions/12119/…tommy.carstensen 9 secs ago
15:26
1
Q: C++ singleton -- not full C++ 11 standard

Karel BurdaI'm struggling to design a thread-safe singleton implementation in C++, but it will be targeted primarily on the Visual Studio 2012 environment. I know that the C++ 11 standard guarantees that this Foo& Instance() { static Foo instance; return instance; } is thread-safe. But co...

0
Q: Make shelly script readable

sevoThis script cleans up destination directory and copies file into it with new name. Can this intent be expressed more cleanly with shelly? main = shellyFailDir $ verbosely $ do escaping False $ rm_rf $ webapps </> "*" cp (m2repo </> groupPath </> artifact </> version

You might get better responses posting this on the Code Review Stack ExchangeAaron Brager 27 secs ago
0
Q: L system equations

yasarThis is my first program on my second try to learn haskell :) import Data.Maybe (mapMaybe) import Control.Exception (try, IOException) import System.Environment (getArgs) type Rule = (Char, String) type Axiom = String type LSystem = (Axiom, [Rule]) getRule :: Char -> [Rule] -> String getRule c...

0
Q: C++ -- Typedef in a header file

Karel BurdaIs this considered as a bad practice in C++ (regarding the "global" typedef): // header.h namespace configuration { class ConfigurationHandler { }; } typedef configuration::ConfigurationHandler cfgh; and then use in any source file: // whichever-source.cpp cfgh instance; // use i...

15:49
It's been a while since a non-bot has said anything.
0
Q: Recommendations on improving HID report descriptor?

jeffI have been trying to figure out how to properly have this report descriptor pass/push data on down from the control collection/s at the top (needs to have mouse data) to the mouse collections underneath (the mouse devices look real to the OS but they are virtual/simulated). I already have it cre...

0
Q: Swift: Typed NSUserDefaults

milosI was looking around for a Swift wrapper around NSUserDefaults and found some very nice projects (see e.g. SwiftyUserDefaults). Unfortunately, it all boils down to stringy keys galore... Eventually, I tried something myself and came up with the code below. I'm tempted to use it in production, bu...

@SirPython You should've had SirAlfred say that.
Hey, a Swift question.
Hello everyone!
16:04
Hi
Hi
Cue: Am I missing a starfest?
2
@rolfl Not yet ;)
I have been working on a code review here: codereview.stackexchange.com/questions/87571/…. Its more of a code review then a recommendation because I am looking to figure out if I coded the report descriptor correctly and its specific because I am looking to see if mouse data can be passed into it (i.e. x,y,buttons). I was afraid if I posted it on stack overflow they might send the post here or down vote it.
@jeffery - that's not what I was expecting it to be....
... it is hardly a code review request either.
Then post your code here instead codereview.stackexchange.comBeing Sunny 56 secs ago
@BeingSunny - , I was curious to know how Code Review would be able to help, since Code Review is for working code, and this question is about adding new functionality that's not working... have you read the Code Review help center? — rolfl 12 secs ago
16:26
@rofl, I have been trying to work hard on figuring my mind around it. It is in c/c++ though rofl. Take a second look. If you were talking about the code. My plan was not to merely figure out why the code does not work. It does work but does not give my expected result. It needs to pass mouse data down from the control/tlc (top level collection) collection and I have alternative's I have tried to show that I am not asking another stackoverflow if you wish for me to put that in their too.
@jeffery Note that, to all intents, your 'code' is array x = {...};
it is a big, single statement.
Now, saying that it 'works' is a stretch, because, it does nothing, except 'define' an HID interface
and the interface it defines does not work?
do you want help on how to structure your array definition, and code style conventions?
*alternative's I can show so it does not seem like I am asking another stack overflow question. It's a code review of device driver code that's why I posted it. I could write to the mouse devices already but I need the added functionality (which is more of an enhancement/performance metric then a coding error) listed in the post to allow me to use them with Windows.Devices.HumanInterfaceDevice.
Note that code like that is typically declared as being a structure-of-structures.
I am pretty sure that's the way the system is laid out for you.
you have essentially in-mapped a 2D or 3D array-of-arrays in to a flat memory-block.
and you are asking for help in identifying why your memory block has the wrong values.
Great explanation, thanks. It felt cleaner to me to use separate records to allow separate implementations of a protocol for things like limiting the number of spaces the king can move. But I'm very ignorant of game programming; if you have another approach, I bet the OP of the Code Review question that inspired me to ask this would like to hear about it. — tsleyson 25 secs ago
16:43
@rofl, Yes, Its closer to help with proper array structure. The hex values produce a different HID report structure overall which could/could not affect performance. Someone could edit that in if they wish but I am made a basic edit to show this.
This seems like quite a bit of code... Could you narrow it down a bit? Otherwise, codereview.stackexchange.com might be the place for you - I'm not very familiar with that site, but it sounds like the sort of thing you might be wanting. — cullub 58 secs ago
17:00
0
Q: Recursion java program

AngelWrite a method printNumDots() to print an ascending sequence of integers beginning from 1, each followed by dots as many as the preceding integer. For example, printNumDots(6) shall print 1. 2.. 3... 4.... 5..... 6...... This is what I have so far: I can only get it to print the numbers in asc...

Try codereview.stackexchange.com instead. — tommy.carstensen 49 secs ago
@rofl, added an for example showing how its more about a structure problem then a programming problem per-se. The values in the report are equivalent to an array structure. For example, end collection is similar to the } in C,C++ and C#. A physical collection would be mouse, gamepads, etc.
Yeah, and I am still struggling to see any actual code other than the variable declaration... and your question is not about getting a code review, it is about getting someone to understand why your definition is not defined right (even though the code compiles). Your actual question is telling: "What's the most effective report descriptor people would have for doing this?"
you want to know what people should do to get the X and Y descriptors included... it is about functionality that does not work, and the current close reason holds.
.... but may be better as being closed as: code not yet written, or code that does not work as intended.
What exactly is "to much work for the pc"? Are you experiencing any performance issues with this code? This isn't really a question for StackOverflow. Maybe try CodeReview instead? — Kevin Workman 35 secs ago
0
Q: My first big project and think I have major structural issues

LNASI'm coding a small program in Python that manages employee shifts in the workplace. I'm struggling to advance the program any further as I think I have some fundamental structuring issues which will just lead to an abundance of errors as the program grows. Was hoping someone would have a quick lo...

17:18
@kevin I didn't know about CodeReview thanks! — Geen just now
17:30
@KevinWorkman Code Review is for complete, working code, not a code snippet like this one. — durron597 12 secs ago
@durron597 Cool. I'll let CodeReview help him with that. — Kevin Workman just now
Please do try codereview.stackexchange.com, downvotes just mean that SO is not the proper place. — dallen 19 secs ago
The question as it is would be closed as off-topic on Code Review. Please only refer to other site when you're sure they will accept the question. — Marc-Andre 52 secs ago
17:52
Damnit, where's my 2nd monitor?
My phone needs a 2nd monitor.
This will need to do on university for my final project...
Better as a single screen at home
18:09
4
Q: Starting a Clojure Chess Engine

erturneIn my journey to learn Clojure I recently decided that I would like to write a chess engine, which is kind of funny because I don't really know chess either. ;-) My goals are to learn Clojure and chess, and write something that is fairly easy to understand. Currently I'm working on board repres...

^^ Looks like magic to me
0
Q: Finding common elements, ignoring duplicates, in two given string arrays

alanbuchananI am going through the CodingBat exercises for Java. Here is the one I have just completed: Start with two arrays of strings, a and b, each in alphabetical order, possibly with duplicates. Return the count of the number of strings which appear in both arrays. The best "linear" solution makes ...

0
Q: HackerEarth: Minimum days to meet target

Rohit JainThe problem was like this: Given an array: [1, 2, 1, 3, 4] where each index value shows the production of that particular day. So, at index 0, production is 1, index 1 - production is 2, so on... Then we're given some targets (N numbers of them). For a given target T, we've to find the index...

18:47
This is an excellent question for codereview.stackexchange.com. You should also add some input and expected output. — tommy.carstensen 28 secs ago
19:00
I would suggest you try codereview.stackexchange.com - that seems like the kind of thing you're looking for. — cullub 17 secs ago
@cullub: Code Review is for working code. Please don't send people there with a buggy mess. — Mat 27 secs ago
1
Q: Equation parser and solver

CaridorcI wrote this equation parser and solver, I feel like it is well documented and tested: import doctest def swap_sign(num): """ Swaps the sign of a number-representing string. >>> swap_sign('9') '-9' >>> swap_sign('-4x') '4x' """ if num.startswith('-'): re...

0
Q: import text file into mysql database using c#

Norchene BelhassenI'm using c# and I have my table as a text file, I want to import this table into mysql database, I upload the path as textBox_path.text and I use this code : SqlConnection conDataBase = new SqlConnection("Data Source=WIN-ULCV9AGF96B\\SQLEXPRESS;Integrated Security=True"); Strin...

@CaptainObvious Broken
19:53
Noted, thanks for the Code Review link... — David Cool 51 secs ago
Мункинґ!
("Monking" with cryllic alphabet, at least how I would spell/pronounce it)
20:06
0
Q: Processing 2 Sketch - Will threading speed up animations with many objects?

David CoolI'm working on a processing sketch here: https://github.com/davidcool/processing/tree/master/polyhedrons/polyhedrons_4 It's not very elegant code-wise but works fine. It renders rotating complex (meaning many faces) polyhedrons to the screen. Each time you click it adds 5 new rotating polyhedron...

0
Q: Separate combined words in a sentence and convert them into Pig Latin

MaryMy program is complete and working, but I would like second opinions on it. Here are the instructions for the assignment. The program will accept a string as input in which all of the words are run together, but the first character of each word is uppercase. Convert the string to a string in w...

20:24
Yeah, I've missed you too, Mr. Obvious....
3
20:37
0
Q: Length Converter

thecoder16I have a Swing application that converts lengths. Inches to centimeter, feet to yard, etc. I’m wondering if I could make the super large HashMap a little smaller, or more efficient. Any other suggestions are also appreciated. Thanks! import java.awt.*; import java.awt.event.*; import java.util.H...

0
Q: Bitwise flags in Python

Arne RecknagelI have written a function with a lot of possible flags, and in an attempt to make the parameter list more readable and the code more compact, I turned all flags into a bitmap: # flags POS = 1 NEG = 2 NEU = 4 OBJ = 8 OON = 16 # 'flag transformation dictionary' ftd = {u'positive': POS, u'n...

20:58
This is more for the site codereview than stackoverflow. codereview.stackexchange.com I suggest that you move your question there. — JFPicard 59 secs ago
Please note, if you want to move this to Code Review site, make sure you include all the code to be reviewed, rather than having //..... sections. Otherwise, it may get closed as stub code. — Phrancis 24 secs ago
Should I delete the question and post it on Code review or is there a way I can migrate this from here. — San Mor 26 secs ago
@SanMor it's less "messy" if you just delete it and post a separate question on Code Review. — Phrancis just now
This might belong on codereview.stackexchange.com. — ShadowCat7 9 secs ago
@TravisWebb it doesn't sound like the code is working correctly: "Also, the code above is not working properly I can't get the validation to execute on the badge". This would be off-topic for Code Review. — Phrancis 23 secs ago
21:26
Hm. JavaScript can have heterogeneous arrays... Is this common in other languages? e.g., var myArr = [42, false, "hello"];
In Objective-C, NSArray and NSMutableArray hold the type id, which just means any type of object.
This question would be off-topic for Code Review. Please don't recommend it be migrated there; the user doesn't want to ask his question there--he's not asking for a code review. If you feel the question needs improvement in order to be a good Stack Overflow question, I suggest you either make edits or leave comments explaining how the asker can improve his question for Stack Overflow. — nhgrif 54 secs ago
In any object oriented language, you can declare your array of some parent class type, and the array can hold objects of that type or any thing which inherits from that type.
And in a lot of object oriented languages, there is a base class which everything inherits from. In Objective-C, everything inherits from NSObject. In Swift, every class inherits from AnyObject. In Swift, everything (including non-objects) inherits from Any. In Java everything inherits from Object (I think).
OK. Now that makes more sense. I guess JS being what it is, arrays are probably declared as some kind of super-type that all other types inherit from?
In fact, in Swift, you can write that line exactly:
var myArr = [42, false, "hello"]
Which will create a variable, a mutable array, called myArr, whose type is [Any], which holds an Int, Bool, and String currently.
In Objective-C, we'd have to write:
NSMutableArray *myArr = @[@42, @NO, @"hello"];
Which holds two NSNumber objects and an NSString object. Objective-C's NSarray and NSMutableArray cannot hold non-objects.
Why is there NS in front of so many things in Obj-C?
Objective-C does not have namespaces. So to avoid naming collisions, Objective-C tradition dictates that libraries use a common 2-3 letter symbol at the front of all of their classes.
Ah right, you said that before
The base library for Objective-C, Foundation, which declares (almost) all of the NS types was originally developed by a company called NeXTStep (which Steve Jobs worked at for a while after Apple got rid of him).
The NS comes from NeXTStep. The company was eventually purchased by Apple.
There are other common abbreviations in Objective-C.
All of the user interface objects for iOS development come out of the UIKit library and hold the UI prefix.
There is a CoreGraphics library which defines a lot of types which have the CG prefix. Also CoreAnimation with CA, CoreMotion with CM, and AVFoundation (library with lots of audio/video stuff) with AV
SpriteKit has SK.
21:56
@sᴉɔuɐɹɥԀ As for this specific statement specifically about JavaScript, I cannot say for sure. I'm not certain exactly how JavaScript's type system works.
monking
Swift answer
0
A: Typed NSUserDefaults

nhgrifOur constructors would be better as failable initializers. Nothing prevents us from passing a wrapped NSNumber to the String initializer, or a wrapped String to the Int initializer. In your code, this would simply crash. It would be better if our initializers were allowed to fail. First, we...

22:28
And for good measure, a SQL answer:
0
A: Checking that data has been created in multiple tables

nhgrifAs I mention in this other SQL answer: Any SQL query has up to eight primary clauses. WITH, SELECT, INTO, FROM, WHERE, GROUP BY, HAVING, and ORDER BY. Everything else is a part of one of these clauses. These 8 clauses should have zero indentation relative to the query as a whole, and everyth...

0
Q: PowerShell - Convert list of UTC to Current TimeZone

user4317867I found myself with a list of UTC timestamps and wanted to convert them into the local time zone. Using this web post as a starting point, I modified the script to grab a text file containing UTC times (one per line) and loop over each one outputting the results in a nice two column format. Is ...

This question is much better served being on the code review stack exchange. You should be using the inbuilt password hashing if you can. That takes advantage of bcrypt hash algorithms which are designed to be "expensive". Also, as a general security tip, it is better to just tell the user that the password and username is wrong, and not to differ between the two. — Scopey 57 secs ago
Mac users, by the way, have Jedi powers.
2
22:43
How so?
We have the power to Force Quit.
0
Q: c# Assert.AreEqual not workng

SimonI am playing around with unit testing on Visual Studio. Trying to test a simple call Assert.AreEqual(2, 1, 2); When run the test, it say pass? Shouldn't it be failed.

I don't get these people
You'd think they understand the code they write
23:03
Why would you make that assumption?
Why do you pass in that third argument if you don't know what it does? Do you always randomly pick an overload and expect it to work? — Jeroen Vannevel 19 mins ago
Spreading the sarcasm network-wide, I see ;)
It'd probably be good if the method had a better name.
Or, if C# enforced named parameters.
It would probably be good if the user smoked the doc a bit.
Assert.AreEqual(arg1: 2, arg2: 1, accuracy: 2)
23:10
Things would get very verbose very quickly like that
I know what the method does, @Hosch250
public static void AreEqual(
	double expected,
	double actual,
	double delta
)
I know you do.
Works fine in Objective-C and Swift.
Incompetence of the programmer should not be fixed by the library
2
Autocomplete does all the work anyway.
23:10
There are certain assumptions you can make and reading documentation is one of them
I'd expect to type:
People that fail that wouldn't be able to make do either way
"ass"-tab-"a"-tab-"eq"-(down arrow to appropriate overload)-tab, then tab through the arguments as the argument names are auto-completed.
Documentation is good... but in languages like C# and Java, you have to go to the documentation just to get even a basic idea of what the method does and what each argument is
Versus languages with enforced named parameters where you never even have to guess which parameter is which.
In VS, it pulls all that up as you type.
Yes, as you're typing.
23:14
You can even scroll through the overloads.
What about 3 months later when I'm trying to fix your bug?
I have to pull up the autocomplete pop-up for every single line. I can't just read it.
It pulls the entire method signature up, with names, descriptions, and everything.
Yes... when you're editing it.
but I can't just read it.
It only pops it up if you're going to edit that specific method call.
If you hover over the method name too.
Yes, and I can still only look at one at a time.
23:15
For that specific overload, anyway.
Compare this to a language where every argument has a label next to it telling you what they all are
Why would you want that?
It's impossible to pass your arguments in the wrong order, and if you're reviewing code in which someone did that, even looking at a page fo 30 lines of code, you'd be able to easily spot it.
You have to read twice as much code to find the problem, and people would find ways to pass the arguments wrong anyway.
Yes, and when they found those ways, it's far easier to spot those places.
You might read twice as many characters but you read it in half as much time because it's easier to know exactly which overload is being used. You never have to guess.
23:17
^ I tend to agree with nhgrif on these
This is especially noticeable when you talk about overloads with 3, 4, 5, 6, 7 arguments.
Don't guess, hover over the method signature.
Yes, and then you only see one at a time.
Versus looking at Swift where I can sit back and look at the whole set of code.
How many can you read at a time anyway?
I don't have to move my mouse as I read.
I don't have to wait for the popup.
23:18
Hey guys.
Haven't been here for a while
AND, with named parameters, you can have two functions with the same name, same return type, same argument types, but different argument names and therefore different actual methods.
Why would you want that? If two things have the same name and do different things, there is something wrong.
One name, one thing.
Consider two different ways of creating a color.
RGB values or HSC values.
GetRGBValue and GetHSCValue`...
let color1 = UIColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0)
let color2 = UIColor(hue: 1.0, saturation: 1.0, brightness: 1.0, alpha: 1.0)
23:22
Just called for supper.
Two constructors for UIColor, both take four CGFloat values.
A getter takes no arguments... so I don't know what you're talking about.
Maybe you should derive two classes off the base class - one for RGB and one for HSC.
Why?
You manipulate them differently, pass them different arguments.
I don't want two different types of objects.
I only want one class. I want a UIColor object.
23:25
The base would still be a UIColor.
Sometimes I have RGBA values I want to instantiate with. Sometimes I want HSBA values.
0
Q: YouTube video intro, and autoscroll when video ends.

steveBKThis code creates an intro video using the Youtube API, screen text written by Javascript with a typewriter kind of effect. How can I rewrite this as succinct object oriented code?Also im not sure if the way I've handled setInterval and setTimeout functions is optimal. It works but I know its far...

You're saying that two entire different classes just for the same of two constructors is a better option than just labeling your arguments?
In C#, you could do UIColor = RGBColor();
Code Review is for reviewing real code, not hand-wavy concepts. If you ask there, please post functions that could successfully compile, not just some free-floating lines that sort of look like a function but aren't. — 200_success 48 secs ago
23:26
OK, it is really on now, see you.
In C#, you'd have to do entire different classes, or you'd have to pass a 5th argument indicating whether your arguments are RGBA or HSBA.
Took me a minute to type this, but @Hosch250 going back to named parameters/arguments, here is a SQL example (pgSQL to be exact):
CREATE OR REPLACE FUNCTION find_person (
  _id INT
, _last_name TEXT
, _city TEXT
) RETURNS VOID AS $$
  SELECT *
  FROM persons
  WHERE id = _id
    OR last_name = _last_name
    OR city = _city;
end: $$

-- may not work, or slow/unpredictable results
SELECT find_person (42);
SELECT find_person ('Smith');
SELECT find_person ('New York');

-- works:
SELECT find_person (_id := 42);
SELECT find_person (_last_name := 'Smith');
SELECT find_person (_city := 'New York');
Or, you'd have to create a struct which holds RGBA and pass that as an argument, and a struct which is identical in everything but name but holds HSBA values and pass that as a constructor.
(sorry, I realize the discussion has went a little different direction :)
SQL has optionally named parameters. C# supports optionally passing parameter names.
but neither would allow you two different methods with the same name and same argument types and same return type.
23:28
PosgreSQL is more strict, from my experience
You can only have that in a language which enforces named parameters.
Makes sense
Did you see the screenshot I posted?
Just looked at it now
Is color2 extending color1? Just curious why it is red, even though no color value were specified in color2
Because red is what color you get if you have Hue = 100%, saturation = 100%, brightness = 100%
HSL (hue-saturation-lightness) and HSV (hue-saturation-value) are the two most common cylindrical-coordinate representations of points in an RGB color model. Developed in the 1970s for computer graphics applications, HSL and HSV are used today in color pickers, in image editing software, and less commonly in image analysis and computer vision. The two representations rearrange the geometry of RGB in an attempt to be more intuitive and perceptually relevant than the cartesian (cube) representation, by mapping the values into a cylinder loosely inspired by a traditional color wheel. The angle around...
dinner is here for me too
23:35
@nhgrif OK. More to your point though, I'm following what you were saying about named arguments better
OK, TTYL
23:51
Error happens on that line because there'd be no way of distinguishing between that method in the bottom extension and the method in the top extension.

« first day (717 days earlier)      last day (3598 days later) »