« first day (1263 days earlier)      last day (2737 days later) » 

12:00 AM
RELOAD! There are 2882 unanswered questions (92.5038% answered)
 
0
Q: A small "TODO" app built using a modular pattern

Olav GundersenI am just beginning to learn JavaScript and although I feel I am starting to grasp the language, I don't feel I know how to structure an app properly. I decided to start small and build a "TODO"-app using a modular pattern. I am aware that I should use more validations, there are unused functio...

0
Q: How can I optimize my Gulpfile.js both for performance and writing style?

marvindanigI have this hurriedly written Gulpfile that does quite a few things for my project resume. It'd be awesome if someone can review this near first-cut so that I can tune up my development style appropriately. I can see myself not using -Sync methods, for example, cutting out the fs module for fsp...

0
Q: WebGL skinning - COLLADA to JSON bone's offset matrix unexpected behaviour

RphysxBefore even getting into the required matrix recursion between animation keys and bones toParent matrices i'm trying to correctly apply the offsetmatrix inside each bone to see if the output is correct. What I want to see is basically all meshes of the object displayed at the center of the world...

 
12:28 AM
@Hello Code review type questions are generally considered "off topic" here. SO is generally reserved for helping people diagnose and resolve programming issues they're having. You might have more luck on Code Review, but even there I suspect you'll have to provide more details on what you're trying to improve within your code (performance, readability, ... etc.). Good luck! — nbrooks 29 secs ago
 
12:52 AM
This code would be offtopic on Code Review because the code does not work as advertised. What your code is doing is determining the number of different records, rather than identifying how many are not duplicated. Until the code works as advertised, it is offtopic on Code Review because it's non-working code (and is broken) — Thomas Ward 37 secs ago
@Daniel Is it just me or is that a video without sound? No commentary, just typing? There are so many so much better ones to watch. Btw, you forgot the invocation of the IIFE shown in the video. Regarding the question, just use var q = {} and drop the functions. About the rest of the code, I rather not comment, but if you want you can ask a question at Code Review. — Bergi 28 secs ago
 
wow they picked up on it lol
 
@Bergi - Yes, it is without sound. I adapted the code and added (a working) example to the above question. I read your post on constructor leakage. That was helpful. As for the rest I adapted the code a bit. I am sure I am in for critique and am a thankful receiver. I will have a look at Code Review and take my "beating" .. ;-) .. Thanks for the help here so far. — Daniel 36 secs ago
@Thomas Thanks for clarifying, I'm not very familiar with Code Review's rules. I haven't read this code. The OP stated that they're "not having any problems with it..." but are looking for "ways to improve it". So evidently it's working code (insofar as it meets the OP's needs). If your concern is with the method naming, I would guess that's something bring up in a Code Review...but it's not really a "programming issue", so off-topic here. — nbrooks 10 secs ago
 
1:49 AM
-1
Q: Can anyone help me with this blackjack game?

user120506" Write a program to play the game of Stud Black Jack. This is like regular Black Jack except each player gets 2 cards only and cannot draw additional cards. Create an array of 52 integers. Initialize the array with the values 0-51 (each value representing a particular card in a deck of cards) in...

 
Is this "working" code? If so, please ask it on Code Reviewcricket_007 20 secs ago
 
2:04 AM
0
Q: How to simplify the below expression?

Ler Wslet deltaF: TransformBlock = { f in let transformation = (f > pow((6.0/29.0), 3.0)) ? pow(f, 1.0/3.0) : (1/3) * pow((29.0/6.0), 2.0) * f + 4/29.0 return (transformation) } Says here that this expression is too complex to be solved in reasonable time. Is there anyway to simp...

 
2:57 AM
0
Q: Google Foobar Challenge: Lucky Triples

Edwin RiceNote: Since my time has passed for this challenge, I do not remember exactly the stipulations but will attempt to recapitulate them to the best of my knowledge. Essentially, the challenge was this: Given a list (from 1 to 2000 elements) of random integers (from 1 to 999999) write a function, ans...

 
3:08 AM
This is irking me.
I signed up for a required class on system design, not a class on UI.
They are walking my through designing a system, and I didn't mind doing use cases and ERD diagrams and such.
This week, I have to literally design the user interface for the blooming system...
Next week I expect they'll have me implement it in LOLCODE or Whitespace or something.
2
On the other hand, I submitted two assignments today and got 100% on them both, and I got 100% on my other midterm a few days back.
 
Way to go!
 
I kind of expected it.
 
what is the difference between xpath and xquery?
 
3:35 AM
No idea.
I know we use one, or both, of them in Rubberduck for the grammar tests.
The web should have plenty of detail if you just search that phrase.
 
4:10 AM
@Malachi I think one makes you want to gouge your eyes out slightly quicker than the other ;-)
2
I've used xquery once or twice in SQL server, there was nothing fun about it
40
Q: Difference between XPath, XQuery and XPointer

ShashiWhat is the difference between XPath, XQuery and XPointer? As far as I know, XQuery is an extended version of XPath. I have some basic knowledge of XPath. Is there any feature available in XPath which is not in XQuery? Yesterday, I heard a new word, XPointer. I am confused. Which language is used...

 
4:30 AM
0
Q: Django REST custom methods for generic views

Ilia_MochalovI'm intern and work on a project where I develop DRF API that need to interact with mobile app written by my colleague with Ionic framework. We are creating new user. My view method is following: class NewUser(generics.CreateAPIView): model = User permission_classes = [permissions.Allo...

 
4:50 AM
Monking
 
@Phrancis thank you
I found a good answer on W3schools
anyway. goodnight....
almost 1 AM here and I have to be up in about 5.5 hours I think....ugh!
 
5:25 AM
1
Q: Is my use of a void* proper?

TCVMI have written a simple window event capture wrapper that gets events that happen to the window, and can be checked anywhere in the program through a global class. I wanted to be able to create a callback anywhere in the program with any event that I have asked to be checked. To hold the data tha...

 
6:08 AM
1
Q: Golang concurrent task pool

guhouMy use case is to dispatch multiple long-running tasks to execute concurrently. The expectation is that the tasks will be IO-bound (e.g. network requests), but importantly each task is different. This is not a question about data parallelism. I've written a simple pool type that wraps a sync.Wai...

 
6:19 AM
0
Q: MATLAB: Locate a number in an array with a special ordering

ElessarrBelow are two examples of arrays (with a special ordering with odd numbers on one side, and even number on the other side) I have, with some given len: For some value z, I want to find the column the value is in. MATLAB code I wrote: if z == 1 column = ceil(len/2); elseif logical(mod(z,2...

0
Q: Code for calculating best possible combination in an array

Kuntal MajumderThe problem here , requires me to find the best possible combination of values in an array which is nearest to 0 and are adjacent to each other , here is an little excerpt from it, The government of Siruseri has just commissioned one of the longest and most modern railway routes in the worl...

 
6:30 AM
possible answer invalidation by 200_success on question by Annabelle: codereview.stackexchange.com/posts/144429/revisions
 
0
Q: VBA: How do I thouroughly optimize this nested for-cycle?

Noldor130884Sadly enough I have a bit of code that is really slow and being a newbie in programmation, I don't have the faintest clue on how to optimize. Is there any way to make those calculations faster? This code calculates the worst case of some parameters cycling through AktBeam and FileCounter (those ...

0
Q: Android Programming: Creating a BaseActivity to render toolbar and navigation drawer

Areeb BeighI'm new to Android programming and this is my first project so I'm not sure if this is the correct method of rendering the toolbar or the navigation of the drawer on the screen: So I have a BaseActivity class that has the methods displayToolbar() and displayDrawer() to display the ToolBar and th...

 
Monking
 
Monking @Vogel612
 
7:27 AM
monking @all
 
possible answer invalidation by Deduplicator on question by Deduplicator: codereview.stackexchange.com/posts/113866/revisions
 
8:19 AM
0
Q: Split big PDF into smaller documents and insert text at specific position

ObermontenI’m new to Java programming and uncertain if I used the right approach to solve my job. This little program uses the iText library to split one big PDF into smaller documents. The trigger for this is a text on every page in a specific region (found with a RegionTextRenderFilter). In all the sm...

 
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Inheritance and small number of parameters
 
Kaz
8:42 AM
Monking @all
 
0
Q: Jasmine toBe vs toEqual

LearnerI have an angular js function as following. This returns the object for given parameter. $scope.getLogistic = function(locationRef) { var logistic; ships.getLogistics().forEach(ship) { if(locationRef == ship.location){ logistic = ship.logistic; } } return logistic; } The test...

 
@CaptainObvious Don't think OP is asking for a review here.
 
8:58 AM
I'm voting to close this question as off-topic because it is requesting a code reviewQuentin 6 secs ago
 
9:44 AM
Perfect candidate to be posted on StackExchange's Code Review site — Sylvain Boisse 59 secs ago
 
10:19 AM
Monking
 
10:53 AM
0
Q: Avoid indexing results from a SELECT statement

GianlucaWhat is the best way to avoid situations where you need to hard code the index of the item in a list, like the following example? # retrieve some data from sql database raw_data = ... # create ItemPrior objects for each row of the results priors = {} for row in raw_data: priors[row[3]] = I...

 
I got to comment on an RFC about javascript today. :D
Also my Riot shirt arrives tomorrow! Hooray :D
 
11:14 AM
user image
2
 
0
Q: how to design sql tables for event with two types of participants?

test.testI have entities: Event, Person, Team and Character. One Event can has persons and teams as participants. Participants are ordered. Each participant can has many characters. I am going to use this design: tbl_event_participants ( id serial, order integer ); tbl_event_team_participants ...

 
@Krease You are right, I should probably not be reviewing posts at night. This would be on topic at code review, yes, I had to reread to determine what was being asked specifically. — Thomas Ward 58 secs ago
 
11:47 AM
@DanPantry I don't know why I star it, but it has Spongebob and Javascript in it, so it must be good
2
40
Q: How to find positive things in a code review?

RobMMurdockAfter some serious quality problems in the last year, my company has recently introduced code reviews. Another developer and I where chosen to review all changes made to the systems, before they are merged into the trunk. This has lead to some tensions within our team. Especially some of the old...

Maybe a CR veteran could be of help there ^^
 
12:17 PM
-1
Q: Shopping cart class and trait

BlahBlagNeed review. Class https://gist.github.com/umarov001/bec313b3fb626af8deb193344b5fb4f5 trait https://gist.github.com/umarov001/f3f9a2b01648b48e49efe613033298c9 Thanks.

 
Should this be moved to code review? — Treycos 10 secs ago
 
0
Q: Building if/else function check boundaries on a container (Pixi.js)

kotI'm building a 2d map using Pixi.js. for this example lets say I have the width and height set to 1000px. I created a if/else statement to check if the containers.x position isn't bigger or smaller than the set minX or maxX. I did this for Y as well. I just feel like there's definitely an easie...

 
12:41 PM
"While the code itself is working fine" you're looking for a code review then. codereview.stackexchange.comUKMonkey 31 secs ago
 
0
Q: Ramanujan's formula to compute Pi

D1XThis is the code in Python 2.7 to compute PI. I am comparing it against math.pi with a certain tolerance import math from __future__ import division tolerance=0.1 k=1 pi=0.0 suma=0.0 while m.fabs(pi-math.pi) > tolerance: sum = (m.factorial(4*k)/m.factorial(k)**4)*(26390*k+1103)/396**(4*k)...

0
Q: Android - handle navigation to multi activities from list view

Mina FawzyHere is my case I made list of items when I click at any item it should navigate to certain activity. Here is my I am done First I set number of constants to distinguish between each activity // constants to show activities onclick event private static final int LOC = 0, SERVICES = 1, PRE_APPR...

 
1:10 PM
possible answer invalidation by Ikm on question by Ikm: codereview.stackexchange.com/posts/142734/revisions
 
0
Q: C# WPF MVVM - ObservableCollection & Entity Framework DbContext

MajakI'm trying to catch WPF using MVVM pattern, where my set of models is implementing ObservableCollection as well as Entity Framework's DbContext. My project is quite simple movies database (looking for movies on disc, getting info about these movies from web, and so on...). I will be glad for an...

 
Greetings, Programs.
 
possible answer invalidation by Paradox on question by Paradox: codereview.stackexchange.com/posts/144404/revisions
 
1:29 PM
user removed their own original code, and simply said "The code in the answer is superior". (The original code is still useful to keep around)
 
1:41 PM
@Duga Rolled back
 
2:31 PM
0
Q: C++ switch statement converting number into words

Kay Kayhow can i convert numbers (from 1-999) into words ? i don't know what codes should be used. i end up using such codes then do not know what to do next . please help me.

 
@Captain, hammer it
 
2:43 PM
0
Q: C++ 14 thread pool executor design

Byoungchan LeeWith a few experience of python and golang, I tried to make (simple) thread pool executor. Tasks of the executor must be copy-constructible std::function<void()> and the result of tasks are required in the main thread. My Header and Implementation File: #include <iostream> #include <queue> #in...

 
3:14 PM
0
Q: Shifting an array with less touches

AaronI have an array that I am shifting by a certain number of spaces. I am wondering if there is an better way to do the shift with less touches. Here is my code function rotate_array(array, shift){ if(array.length -1 <= shift){ shift %= array.length; } for(var i =0; i < shift...

 
3:42 PM
If this code compiles and works I think it would be better to move it to CodeReview.SENathanOliver 13 secs ago
Is this a working program? Do you want to have it checked for style, best practices and similar? Then your question is eligible for Code Review. — Zeta 42 secs ago
 
0
Q: Find and display best Poker hand

Vermillionimport itertools def numeric_ranks(cards): """ Changes the input list of card strings to a list of strings with numbers substituting for face cards. ex. numeric_ranks(['AS','3S','4S','5S','JC']) returns ['14S','3S','4S','5S','11C'] """ suits = get_suits(cards) ...

 
I second the motion to move it to CodeReview. I would also recommend linting the code for style because there are some basic stylistic flaws that would be caught by a linter. — Eli Sadoff 15 secs ago
 
Hello all! I just posted a question, thanks for your review :)
0
Q: Adding vector functionality to TI Calculators

Timtech Although TI-83/84 calculators support multiple data types, such as real numbers, complex numbers, 1D and 2D lists, fuctions, etc., there is no data type for vectors. This program is my attempt to take the sequence three sequence functions (u v w), which are rarely used for their intended functi...

 
@Timtech Captain Obvious messages us new posts so you don't have to.
 
0
Q: Adding vector functionality to TI Calculators

Timtech Although TI-83/84 calculators support multiple data types, such as real numbers, complex numbers, 1D and 2D lists, fuctions, etc., there is no data type for vectors. This program is my attempt to take the sequence three sequence functions (u v w), which are rarely used for their intended functi...

 
3:57 PM
long time no see @Timtech
 
4:08 PM
0
Q: In-App Purchase Code - App crashes when IAP button is tapped

fs_tigreI just submitted my first app that contains in-app purchases, it was approved last night. I downloaded my app and tried to purchase it for testing purposes but to my surprise it crashes when the button that offers the in-app option is tapped. What is more interesting is that it only crashes when ...

0
Q: BinaryTree Advice, Really Urgent

Christian ChanThis is my first time using this website, so I'd like to ask: are the setLeftchild() and setRightChild() methods alright? public class BSTreeNode { private Object element; private BSTreeNode parent; private BSTreeNode left; private BSTreeNode right; public BSTreeNode(Object e, BSTreeNode p, BS...

 
4:18 PM
Tests are too valuable to ever skip them.
2
My lesson learned when writing a brand new project that utilises multiple systems together at once
If for nothing else, it enables much better refactoring and lets you see where your design is awkward
 
@DanPantry unless what you just changed is obviously correct but the design was changed so all tests broke
2
Then you should finish the refactoring and adjust the tests after that
 
Hey, @Timtech. Have you looked at my comments on your answer here?
10
A: ASCII table in Brainfuck

TimtechI think this would be a more efficient way of doing it (at least for the printable ASCII characters): ++++[->++++++++<] Use cell 0 for loop and cell 1 for ASCII codes ++++[->>++++++++<<]>>> Use cell 2 for the space +++>++> ...

More specifically:
The first code block here only results in gibberish, it prints ` ! " # $ % & ' `. The cells your are using don't add up and doesn't make sense. Why use 95 for the loop? And what is the purpose of that loop? Why does cell 1 also contain value 32, same as cell 2? In addition, the "fixed code" that you show is nothing but a minimized version of the code in the original question, with all comments stripped. This answer provides no real value at all in my opinion. — Simon Forsberg ♦ Oct 17 '15 at 10:56
The only upvoters on the answer seem to be people who don't know Brainfuck and who thought what you wrote was correct.
 
TIL about System.Uri. I've been using string this whole time. I feel like such a fraud.
5
 
@DanPantry haven't xaml'd much have you? ;-)
 
No :(
Design question; my CLI can take a set of IEnumerable<string> from the CLI.
 
4:34 PM
hi
 
IEnumerable<string> is actually an enumerable of Uris. At what point should I be converting those strings into Uris / reporting them as errors if they don't convert properly?
I'd assume right after parsing them
 
@DanPantry Read -> TryParse -> Process -> Display
 
@EBrown Sounds about right. TY :)
Luckily I have tests to cover the expected case if it breaks! ;-)
 
@DanPantry Because TryParse also checks if input was correct, if not, you re prompt for new input.
 
s/TryParse/TryCreate
nah this is a cli switch so if you specify an invalid path it should just crash
 
4:39 PM
"Waiting for www.facebook.com..."
I'm on Hulu, what do you need Facebook for?
 
social media plugins I guess
gotta block your connection for the like button /s
 
Can't even log in because I cannot connect to auth.hulu.com.
 
0
Q: Select random IDs from a table, using MySQLi

Ismael MiguelI've created a "simple" function that receives a MySQLi resource and, using a custom where query, will fetch random IDs from a provided table. Some caveats on this: No object-style! This needs to be understood by people who only know the old mysql_* procedural API; No order by rand()! It is sl...

 
I can control my music on my laptop from my phone. This stuff is magic.
 
@Derek朕會功夫 I know this is not duplicate question, but I know this guy from codereview chat, from long back. — overexchange 28 secs ago
 
Kaz
4:46 PM
@DanPantry It's usually the other way around for me. Controlling the music in my headphones via bluetooth from my phone, controlled from my desktop.
 
Monking
@DanPantry I was trying to get Comment to get to work with CommentContainer but haven't managed to get the onChange portion of the Comment component to work correctly... Is this a case where I should pass a callback function to the child Comment component, and call that function onChange?
 
    string GetFixtureFolder()
    {
        // There is really no better way to do this in C#.
        // Do NOT change the location of ./fixtures or this breaks.
        var buildFolder = typeof(NspScannerTests).GetTypeInfo().Assembly.Location;
        var projectFolder = Directory.GetParent(buildFolder).Parent.Parent.Parent.FullName;
        return string.Concat(projectFolder, Path.DirectorySeparatorChar, "fixtures");
    }
forgive me father for I have sinned
@Phrancis looking now, sec
@Phrancis what do you mean by onChange component? There are no inputs here so nothing can change?
 
Wait, wrong file :|
 
hey guys
am I remembering it wrong or was there some code evaluation window in visual studio?
 
@Hakase There's an Immediate window.
 
4:58 PM
I thought I could quickly test a few lines of string manipulation but it didn't work in the command window
 
@DanPantry TextInputFieldContainer along with TextInputField (which is the one giving me trouble)
 
@Hakase And a C# Interactive Window.
 
ok that's what it's called
 
@Phrancis Yes, here you would pass onChange from TextInputFieldContainer into TextInputField. You do realise that you are not actually rendering TextInputField from the container?
 
@Hakase View -> Other Windows -> C# Interactive
 
4:59 PM
oooh thanks!
 
@DanPantry Right, I patched it up temporarily until I could make it work how I want
I would need to name the callback function prop I pass to the child something other than onChange right?
 
No
onChange is not a special reserved name
I mean, when you're passing it directly to an input, it is
but if you're passing it among other components it's perfectly fine to use that name
 
So something like render() {return <TextInputField onChange={handleChange} />} ? Then use <input onChange={props.handleChange} in the child?
 
errrr
no
<TextInputField onChange={whatever} /> corresponds to props.onChange inside the child
 
Ohhhhh right #NamingThings
 
5:03 PM
so TextInputField = (props) => <input onChange={props.onChange} />
 
OK
 
I have to review some React stuff soon ^^ so
tfw you get to code review as a job
4
 
team fortress warriors?
 
It stands for "that feel when", but team fortress warriors is much more awesome.
 
I thought it stood for "time for work".
 
5:06 PM
♫ I'm... hooked on a feeling, I'm high on reviewing.... ♫
 
How about tfw when you win a three-hour timed chess game in 35 seconds?
 
I thought it was "FTW" with some threading issues
 
@DanPantry is it the case that only if I had more than one callback functions I'm passing (say for instance I have 2 or more input fields in the child) that I would need to find different props names? e.g. <MyChildComponent onNameChange={this.handleNameChange} /> then use <input onChange={props.onNameChange} /> in the child?
TTGTW
 
@DanPantry Oh, I read it as "the f when"
 
5:17 PM
 
This changes the meaning of a lot of things.
 
tfw when you get your fifth-best rated win in antichess.
 
Just to be clear, if you have been using Java for the past 20 years, then camelCase is correct for method names. PascalCase is the C# standard though. — Nate Diamond 1 min ago
what say you JAVA Java People about this?
 
wouldn't it be java to follow casing rules?
 
Java or java doesn't matter much IMO
camelCase is the correct choice for Java though
 
5:30 PM
@wheaties you are right, I have deleted Q4. But I don't think separating the question is a good option. Maybe I should post it to code review — T-800 57 secs ago
 
so apparently there's a .lol TLD
 
Yes, seems like you want code review. — wheaties 51 secs ago
This is off-topic here, try Code Review. — Biffen 36 secs ago
 
@Vogel612 for methods?
 
5:46 PM
@Malachi sure...
 
0
Q: Google maps directions: per-state distance traveled calculation performance issues

ddgdI'm trying to calculate the distance traveled per state with google maps directions service. This script does the job, but is slow to the point of being unusable. (It takes anywhere from a few minutes to an hour to get the mileage breakdown) Any ideas on how the runtime could possibly be reduce...

0
Q: All combination of character alphabet

Mohamed Ezzeddine MacherkiI write this code to find all combination of an alphabet z={A,B,C...N}. In DNA case,we use z={A,C,T,G},then the function Words and Words1 and for general case the function alphabet_words for a given alphabet. Exemple: words(2)=aa,ac,ag,at,ca,cc,,,tt The code is written with Rccp and ...

 
and fields...
and everything but types and constants
 
@Vogel612 Constants in Java are still SHOUTY_SNAKE_CASE, no?
 
yea
that's one of the few exceptions
along with types, Annotations(which are types) and enum members (which are actually just constants)
everything else: camelCase
 
uh, enum members in C# are "actually just constants" - enum members in Java are closer to being full-fledged classes with their own methods and properties and whatnot.
I don't know what Java enum members are, but they're definitely more than "just constants" ;-)
 
5:57 PM
@Mat'sMug In all fairness, you can make C# enum types feel like classes.
 
with what, extension methods?
 
Yeah.
Obviously your options are limited.
 
@Mat'sMug they're constant instances
which works out for reference equality
 
@Vogel612 right. the real problem is the lack of actual value types
 
there is value types
they're called "primitives"
 
5:59 PM
no. there's primitives and then there's everything else
primitives aren't value types the way .net has it
 
well that's semantic hair-splitting ...
 
primitives are hard-wired into the language, they're basically a hack
 
ValueTypes aren't?
 
entire java is a hack
CSI: miami level of hack
 
@Vogel612 Can you define your own value types in Java?
 
6:01 PM
because as I see it the compiler treating objects differently depending on whether they're value types or reference types is basically a hack, too
@EBrown not sure how exactly you mean that, but ... there is no such thing as struct in java
 
^^ that
 
@Vogel612 That's what @Mat'sMug was referring to as far as I can tell.
 
struct ==== value type
 
You cannot define custom value types.
You're stuck with what the language provides.
 
@EBrown why would you need to define custom value types
 
6:02 PM
for plenty of reasons
 
@Vogel612 Point?
Or Vector2?
 
I think you'd find better answers (faster answers more in line with what you want) if you ask this question at Code Review. SO is generally for helping people fix their code that isn't working. If you do have working code, but aren't satisfied with it's performance times, Code Review may be the place for you :) — Tyeler 35 secs ago
 
Both make very good examples of value types.
 
@EBrown that's a complete an utter hack
 
@Vogel612 What?
That makes no sense.
 
6:03 PM
@EBrown what's the point of having this as a value type?
 
no, it's a full-fledged type stored on the stack at runtime
 
in most scenarios
 
@EBrown Vector2 ~== Point
 
@Vogel612 To try to allocate it on the stack instead of the heap.
 
just struct vs class does not determine heap or stack
 
6:04 PM
@Vogel612 I didn't say that...
 
the distinction Heap vs. Stack isn't one you can make in java
 
yes it is
 
I'm so confused.
 
everything but primitives is an object. it goes onto the heap
the heap is subdivided into generations
 
it's actually about assignment semantics
21
A: What are the differences between value types and reference types in C#?

AaronaughtPlease read: The stack is an implementation detail, and don't ever again repeat the canard that stack allocation is what differentiates value types from reference types in .NET. The CLR may choose to allocate a variable anywhere it wants to. The most important difference is in the assignment se...

 
6:04 PM
local primitives in java are on the stack
 
their reference values are ...
the objects themselves are on the heap
 
84
A: Stack and Heap memory in Java

back2dosThe basic difference between stack and heap is the life cycle of the values. Stack values only exist within the scope of the function they are created in. Once it returns, they are discarded. Heap values however exist on the heap. They are created at some point in time, and destructed at another...

> Now Java only stores primitives on the stack. This keeps the stack small and helps keeping individual stack frames small, thus allowing more nested calls.
Objects are created on the heap, and only references (which in turn are primitives) are passed around on the stack.
 
@JeroenVannevel which is exactly what I said ...
because the scope determines where your stuff is allocated.
 
no, a primitive local is not on the heap
 
@JeroenVannevel "everything but primitives [..]"
as I understand from the SO answer linked by Mat's Mug, in C# you don't get to make the choice either
 
6:08 PM
only when they're locals
correct. Though they're working on changing that
 
anyway we all know C# wins. two words: operator override.
4
 
eurgh
 
operator overloading is a very double edged sword
 
0
Q: yacc program warning

user120463%{ int yylex(); int yyerror(); #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct node { struct node *left; struct node *right; char *token; }node; node *mknode(node *left, node *right, char *token); void printtree(node *tree); #define YYSTYPE st...

1
Q: ATM Machine Program for a Project

MayaharaI'm a novice C++ coder, taking my first class this semester, and we have a project coming up. I get the program done early and it works as expected, but I don't know if it's too messy and can be cleaned up. It's a simple ATM program that allows you to create multiple accounts and withdraw or depo...

 
@CaptainObvious wtf???
@DanLyons why don't unary ops take preference??
 
6:46 PM
0
Q: Beginner here, need help making my form submit the info to an email

BerkanI have a form I've made, which when submitted I want the info sent to an email. As you can tell I'm not professional, but know enough that I'm working on a new website for my business. <form method="post" action="contact.php" > <!-- Form Field - Full Name --> <

 
@Mat'sMug what the heck is ==== ?
 
@Malachi that's "atomic-scale equality"
 
it's TypeScript isn't it?
 
dude, I'm kidding
 
you know, the new JavaScript
lol, me too
 
6:54 PM
I totally hope there's no such thing as "===="
5
oh
lol
 
that would be so confusing
 
=4=
 
7:13 PM
0
Q: c# How to verify if meeting datetime ranges overlap in am IEnumerable list of meetings

Dave AdlerI have an assignment where I need to find out if any of the meetings in a list of meeting class object have overlapping datetime ranges. What I have so far is this. public class Meeting { public DateTime Start { get; private set; } public DateTime End { get; private set; } public Me...

0
Q: Project Euler - #5 smallest multiple [Ruby using a hash table]

yviedevWhy will this code will work for a smaller multiple like 10 but time out for anything over 13? Can this code be refactored to work for larger numbers? (p.s. I have an alternate solution but wanted to see if this code could be fixed to work for more multiples.) #2520 is the smallest number th...

 
I'm voting to close this question as off-topic because it appears to belong on Code Review. — Andrew Morton 24 secs ago
 
Not sure about that migration
the OP appears to be trying to identify a bug
 
@AndrewMorton Seems like the OP is trying to find a bug whereas codereview is about working code. — xDaevax 42 secs ago
 
@Phrancis Sorry can you give me an example?
Christ, how on earth do I suppress the stdout from a c# process
 
7:32 PM
@DanPantry imagine a dumb form component that has a name and email address HTML input fields together, which container component would need handlers for each field's onChange event
s/HTML/JSX/
 
95
Q: Show/Hide the console window of a C# console application

TimwiI googled around for information on how to hide one’s own console window. Amazingly, the only solutions I could find were hacky solutions that involved FindWindow() to find the console window by its title. I dug a bit deeper into the Windows API and found that there is a much better and easier wa...

 
@EthanBierlein it's .NET core
I'm starting the process like so
public static Task<IRepository> CloneAsync(Uri url, Uri destination, bool deleteOnDispose)
{
    var proc = new Process
    {
        StartInfo = new ProcessStartInfo("git", $"clone --depth 1 {url.ToString()} {destination.AbsolutePath}"),
        EnableRaisingEvents = true
    };
    var tcs = new TaskCompletionSource<IRepository>();
    proc.Exited += (sender, ev) => {
        // We use AbsolutePath because we know this is a file.
        var repository = new GitRepository(destination, url.ToString(), deleteOnDispose);
 
Ah, nevermind then.
 
I don't care about the output from the process, I just want to pipe it to /dev/null.
Looks like I can just suppress git clone itself
 
@DForck42 If that code is representative of the code in general, you have a secure job for the foreseeable future :) Pop this question over to Code Review instead, and you will get a lot of suggestions which are likely to apply to a lot of the code. If you mention that you're new to the company and don't want to ruffle too many feathers, you might get suggestions on how to introduce what are probably desirable changes without upsetting anyone else too much. — Andrew Morton 44 secs ago
 
7:43 PM
0
Q: Nested for loop code

Rachel W Need help asap! I am a high school student and am completely lost if anyone has any idea how to do this please let me know!

 
@CaptainObvious HAMMERTIME!
 
I take it all back, Uri feels like I am cutting teeth
@Phrancis uhhh
you'd put pass the onchange to each controls respective container component
unless I misunderstand
        static bool TryParseRepositoryUrlIntoUri(string url, out Uri uri)
        {
            var cwd = new UriBuilder
            {
                Host = null,
                Scheme = "file",
                Path = Directory.GetCurrentDirectory()
            }.Uri;

            Uri relativeUri;
            if (Uri.TryCreate(url, UriKind.Relative, out relativeUri))
            {
                var absoluteUri = new Uri(cwd, relativeUri);
                uri = new Uri(cwd, relativeUri);
                return true;
Damn this was horrible
 
0
Q: Game like ingress, I mean, exactly ingress

karacsi_maciI had some discussion on a forum about how hard to develop a game like ingress. I've sad, the game itself is not so complicated. So I've decided, I will do it myself in HTML5 with jQuery and google maps api. What I have now is: You can move on the streets, and your location is shown on a goo...

0
Q: C++ Tic-Tac-Toe Game

Nikhil DeorkarI decided to make a simple tic-tac-toe game in C++ as a small project. All help and suggestions are greatly appreciated! main.cpp: #include <iostream> #include <string> #include "TicTacToe.hpp" TicTacToe game; void turnPlayer1(); void turnPlayer2(); bool gameOver = false; int main() { std...

 
8:16 PM
@DForck42 If you can see a "flag" link under your question, then you can ask a moderator to migrate your question for you. Give them a few minutes as they are probably busy. It will probably be easier for you if you get yourself an account on Code Review first - that shouldn't be a problem as you have enough rep here on SO to be instantly accepted over there. Also: What is migration and how does it work?Andrew Morton 55 secs ago
 
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Controller method to update properties of a request
 
0
Q: Refactoring App launch sequence using reactive programming

menawiIn the SplashActivity of my Android Application, the following sequence of events occur: Check Google Play Services is installed If Google Play Services available, start InstanceIDListener service. Check if App needs to be updated Load country info using network ip Previously, I'd implemented...

0
Q: Java code refactoring, in order to get rid of code duplication

T.RexI have the following class structure: public class CustomDAOImpl implements CustomDAO { public List<Organization> getOrganizations() { List<Organization> results = new ArrayList<Organization>(); Client client = ClientHelper.createClient(); Resources<OrganizationR...

 
Bah, that stupid *Impl suffix..
 
Stack Overflow is for specific programming questions. If you have a question, ask it. If you have an error, create a Minimal, Complete, and Verifiable example. If you are looking for a code review, read the rules of the Code Review Stack Exchange and create a question there. — Colonel Thirty Two 34 secs ago
This has been cross-posted to Code Review. codereview.stackexchange.com/questions/144577/…janos 48 secs ago
 
8:45 PM
@xDaevax kill it with fire :)
3
 
This has a huge map, and there are bugs where they cause pauses. The incremental "mutator assist"--where your code's interrupted to do a small chunk of work, meant to be just microseconds--sometimes wound up scanning the whole map. See groups.google.com/forum/#!topic/golang-codereviews/kIqdlqEZ4‌​7M, github.com/golang/go/issues/16432 github.com/golang/go/issues/14812, and github.com/golang/go/issues/9477. Go tip might work better, or 1.7 if you're on an older version. — twotwotwo 32 secs ago
 
@Vogel612 Couldn't agree more
 
I do. I stargreed.
4
;-)
 
lol
 
Mugged.
4
 
8:59 PM
lol
 
0
Q: Get a Floating Point Number from a String with a Finite State Machine

deamentiaemundiI wanted to restart the big-float project I had paused the moment I suddenly realized that the implementation of the main four rounding modes (which I postponed so long, that I got all of the IEEE-754 functions implemented in the meantime) needs three guard bits. And it needs them from the beginn...

 
9:14 PM
I wonder if you could use this to "sort" the tuple types and then you could just iterate over the types to make sure they are the same type. — NathanOliver 25 secs ago
 
0
Q: SmallVector - std::vector like container on the stack

NickSmallVector is almost same as std::vector except it keeps its data inside a large array. Similar to std::array, its size can not get bigger than the SIZE parameter. Here is the code: #include <algorithm> // std::equal #include <stdexcept> // std::out_of_range #include <type_traits>...

 
This site is not for code reviews. There is a code review site specifically for that. — takendarkk 11 secs ago
 
0
Q: Finding the distance between two points in C++

BoeNoeI made a program in C++ where it calculates the distance between two coordinates. Is there anything to improve? Add? Make it more user-friendly? Code: #include <iostream> #include <cmath> using namespace std; int ch; double x; double y; double a; double b; double answer; double distance...

 
9:29 PM
I hate to be a stick in the mud, but this belongs on Code Review Stack Exchange. This code works, but you are looking for ways to improve it. — zero298 27 secs ago
 
9:44 PM
TTQW
 
0
Q: Shopping cart java design patterns

Kris SwatI want to create a shopping cart project with discounts for products. Eg. If you buy 2 books, you can get 10% off Parker pen I created a shopping cart example, but without exception handling in this version. My question is : Are my classes Product and Basket, Offers and Discounts properly stru...

0
Q: Shortest possible JS code to get ids of all elements of a given tag

tylerI want to gather all the ids on a page for foobar elements into a comma-delimited string. For example: <div> <foobar id="456"></foobar> <foobar id="aaa"></foobar> <foobar id="987"></foobar> <div> Should give "456,aaa,987" The foobar elements will not ever be nested, if that matters. M...

 
This might be more appropriate posted in Code Review (codereview.stackexchange.com) — Kristian H 55 secs ago
 
9:57 PM
0
Q: Javascript code which outputs data entered into forms

chike nwaenie *{ font-family: "Ubuntu"; } body{ margin-left: 20%; margin-right: 20%; } #outer{ width: 100%; border: 1px solid black; } #inner{ margin-left: 10%; margin-right: 10%; } input{ text-align: center; } .enter{ height: 30px; margin-top: 10px; margin-bottom: 10px; float: left; widt...

 
10:20 PM
0
Q: How two swap two elements in a array list without using collections.swap method

Andrew JohnsonDevelop a method to swap two elements with specified valid indexes I and j: public void swap(int I, int j); This is the method I have to use to swap two of the elements in an array list. The original list is: [a ==> b ==> c ==> d............] After calling swap(0, 2): [c ==> b ==> a ==> d..........

 
Thank you so much! I'm definitely bookmarking Code Review.SE! — Rusty Shackleford 14 secs ago
@RustyShackleford Please note that CodeReview will not help you write code, like this answer. It is for already working code. — user2296177 31 secs ago
 
0
Q: I have this code for finding areas and volumes of geometric figures but now I need to apply TRY-CATCH on every case

indigodreamer11 int option = 0; int solids = 0; int polyhedron = 0; while(option!=11){ option = Integer.parseInt(JOptionPane.showInputDialog ("1: Area\n"+ "2: Volume \n"+ "3: Exit")); switch(option){ case 1: while(soli...

 
10:53 PM
0
Q: Alphabetical order

user182352Problem: There are n Strings and these should be ordered in an alphabetical way and then be written in a consecutive string. In the first line we get n and in next n line , n strings. Sample Input: 7 bat javo he on aaghe irshi bek Sample output: aaghebatbekheirshijavoon What is wrong with my c...

 
11:05 PM
0
Q: Python: Create an algorithm that receives a dictionary, converts it to a GET string, and is optimized for big data

arctelixIf you were on a technical python interview and asked the titled question, which option would you consider the best answer? Any other comments on the code below are welcome.. Common import requests base_url = "https://api.github.com" data = {'per_page': 10} node = 'users/arctelix/repos' Opti...

 
Been very quiet in here today
 
11:27 PM
I'm voting to close this question as off-topic because game code design probably belongs on gamedev.stackexchange.com or more likely codereview.stackexchange.comZong Zheng Li 54 secs ago
No, not codereview. It seems to be about non working code. — Daniel Jour 31 secs ago
 
@DanPantry so many bot posts...
at this point I think we should consider turning captain into a drop-down feed instead of a oneboxing screeneating monster :/
 
11:50 PM
I'm voting to close this question as off-topic because, it should be on code review. — robbmj 35 secs ago
 

« first day (1263 days earlier)      last day (2737 days later) »