« first day (871 days earlier)      last day (1747 days later) » 

3:00 PM
Closed one, but now it has 2 re-open votes...
lol:
 
0
Q: Deletion after Uploading in PHP?

McLinuxI am uploading a file to a server via js and then i need to delete that file in php(don't ask why). Which of these two solutions would be better? CODE: unlink($_FILES['file']); or $_FILES['file'] = null; Which is more efficient?

 
This is better suited for Code Review or you need to precisely specify what your question is... — Martijn R 59 secs ago
 
@EBrown my crystal ball reveals a splendid MS bash-o-rama... and a nuked A51 proposal.
 
@Mat'sMug Part of that has already happened.
 
Indeed.
 
3:09 PM
I've never browsed A51 before. There's a lot of surprisingly niche stuff.
 
@SuperBiasedMan Some of the proposals are really cool.
 
Beer
2
 
This question might be more appropriate on codereview.stackexchange.comKristján 29 secs ago
 
3:11 PM
 
@Vogel612 Beer Review
 
POB
 
Beer SE, haha.
Don't see why you need Ask Microsoft when Super User exists.
 
@Legato I don't see why you need any SE site if Beer SE exists.
 
Same reason we need Ask Different?
 
3:12 PM
@Legato it's a sub-site... much like CR was once a SO sub-site
 
I get that, I'm just against it. Why does it need another site?
 
What is monking ?
 
CR makes more sense. It's a completely different paradigm.
 
@Vogel612 @ARedHerring @TopinFrassi Hello ;-) browser crashed after joining O.o
 
@CaptainObvious does $_FILES['file'] = null really delete a file ? I doubt it.
 
3:14 PM
24
A: What's a Zombie? And what are the many other memes of Code Review?

Vogel612Meme: Monking Originator: Morwenn Cultural Height: The 2nd Monitor Background: A morning greeting to the Monkey doing his monkey-business, in other words: monking Examples: A small chat search Variations: Monkernoon, Monkevening, Monknight, ... Important is only that it begins with Monk... ;...

 
Mat's beat me to it.
Basically it's Morwenn's solution to timezones.
2
 
0
Q: Limit an integer to certain number of digits and suffix '+'

icemanI am having a problem describing what the following code does. Below is my attempt at its javadoc. /** * Convert an integer so that the notion of its size fits within a certain number digits. * e.g. * Fit 123 to 2 digits -> 99+ * @param in The integer * @param order The order of magnitude t...

 
it's linked to, in the 10-star pinned post "Welcome to The 2nd Monitor!" ------>
 
@Mat'sMug meta has no HTTPS cert and so I can't browse it. Who do I contact about that?
 
3:15 PM
drop the s
 
string[] values = { "x", "y", "z" };
var actions = new List<Action>();
foreach (string value in values)
{
    actions.Add(() => Console.WriteLine(value));
}
foreach (Action action in actions)
{
    action();
}
 
@Mat'sMug drop the bass
 
Anyone know what that'll print in C# < 5?
 
x
y
z
 
@Mat'sMug lol, yes, I can browse it if I view http. But I would really rather browse in https given how my work's firewall works
 
3:16 PM
@Mat'sMug Nope.
z
z
z
In C#5 your answer would be correct.
 
closures strike again huh
 
wtf that is some screwed up closure
 
@Mat'sMug Yep.
 
fix:
string[] values = { "x", "y", "z" };
var actions = new List<Action>();
foreach (string value in values)
{
    var val = value;
    actions.Add(() => Console.WriteLine(val));
}
foreach (Action action in actions)
{
    action();
}
 
whats a code monkey
 
3:19 PM
@ARedHerring basically... https on meta sites is currently not supported
 
@Mat'sMug stil z z z
 
@Vogel612 alright, as long as its known i'll add an exception to https everywhere
 
@june1992 A nickname for somebody who writes much code instead of quality code.
 
@Mast a.k.a cowboy coder
 
@Heslacher really?
 
3:20 PM
tested and confirmed
 
@ARedHerring Not necessarily. A cowboy coder still wants the thing to work kind of neat, but has a style nobody else shares.
 
@Mat'sMug Yep
 
missed var
 
quality meaning not like understood by the 'code monkey'
 
dammit, I need to re-read the part on closures
 
3:21 PM
@june1992 Was that a question?
 
@Mat'sMug That's ok!
 
yes
 
@TopinFrassi ?
 
And of-course there's plenty of monkeys who code without being code monkeys.
 
whoa
 
hinting at @nhgrif
 
@Mat'sMug With the var, the output will be "x,y,z", not "z,z,z"
 
@ARedHerring Semi, which would fit the definition best?
 
@TopinFrassi ah, so I don't need to re-read it then ;0)
 
Spaghetti coder perhaps.
But not necessarily.
 
3:23 PM
@Mast I was thinking Spaghetti, too
There was another article on this that had images and more descriptions but I can't find it
 
0
Q: JWT with Firebase php-jwt

James HealdSo my web app requires JWT authentication and I decided to make a mockup wrapper class for php-jwt before implementing it into my web app: class JWTWrapper{ public function newToken($issuedAt, $notBefore, $expire, $server, $sessionData){ $tokenId = base64_encode(mcrypt_create_iv(32))...

 
-1
Q: Getting WA in SPOJ INCSEQ - Increasing Subsequence

ShakilProblem Link : http://www.spoj.com/problems/INCSEQ/ I am trying this problem by Dynamic Programming . I tried many cases and in each case it provides correct output . But I am still getting wrong answer. Where is the problem in my code ? Here's my code : int main() { int n,k; s...

 
A code monkey is someone who writes the code they are told to write rather than what is actually right.
 
Monking @nhgrif.
 
Code monkeys don't think critically about the problem they are solving
 
3:25 PM
monking @nhgrif
 
I think I successfully ate an elephant on this project for work. :)
 
sounds like my colleagues... and the problem is people usually side with them - managers dont caer how its done. just that it is done :p
 
spaghetti coder but I don't think i write spaghetti maybe not at least
 
@MartijnR "Where is the problem in my code?" is explicitly off-topic on Code Review. — Mat's Mug 32 secs ago
 
@StackOverflow @Mat'sMug We recently allowed such a question. Let me find it.
2
Q: The trip challenge from "Programming Challenges"

Baroudi SafweneI have a solution to the trip challenge from "Programming Challenges". I read the input using double, then multiplied by 100 and put them in an array. My idea is to calculate the average and then calculate the difference between the average and the values below it, based on my manual tries. My c...

 
3:26 PM
@Mast great. let me nuke it.
 
@june1992 As nhgrif said, a code monkey is someone along the lines of.. if you ask them to jump, they ask how high
 
@Mat'sMug @Mat'sMug @janos allowed it.
Basically it says "It's working great, but the judge says it doesn't"
 
I hate questions
 
@Mat'sMug Nope :p
 
haha that's basically me but don't think that's something to be proud of
 
3:28 PM
they're the only posts where "it works, but not the way it should" is accepted
 
Mister 90% makes sense also
 
@Mat'sMug Why? Bug = bug.
 
i guess
 
@StackOverflow RBA
 
@Mat'sMug I have a quick VB.NET best-practices question.
 
3:29 PM
@Mast I know. And I agree. And I'd hammer-close it. But I'm not the community. It was asked 4 hours ago and has collected only a single close vote.
 
So one mod thinks it's fine and another would hammer it. This is going to be interesting.
 
@EBrown I might have an evasive answer ;-)
 
grabs popcorn
 
@Mat'sMug Which of Not Item Is Nothing or Item IsNot Nothing or Not Item = Nothing or Item <> Nothing is preferred?
I think Item IsNot Nothing is the best.
 
my experience on this predates .net.... in VB6/VBA you'd do If Not Item Is Nothing Then - I'd expect VB.NET to read the same awkward way ;-)
 
3:32 PM
0
Q: Procedural generation an infinite map made up of 1's and 0's

MunkybunkyThis is my function to procedural generate an infinite random map of 1's and 0's it only calculates what you can see at the time and when the view moves it calculates the next rows. Complexity is the size of the view that is on the screen e.g. if complexity = 7 then the view on the screen is a g...

1
Q: Get similar posts with manyToMany relationship: Make faster

Max LipskyI have table 'post' with manyToMany relationship to 'tag' and 'product' tables. post <---> tag post <---> product For example, if I have post, I can get similar posts similar by tags and products: Post.php <?php namespace Ranger\AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctri...

0
Q: Google Analytics Category/Action/Label Tag Maintenance

JbrysonIn implementing google analytics events I found it difficult to remember the names of all the categories/actions/labels I was using. (Was it Player or Players?...) So I set up a struct system to help me keep the labels consistent: struct AnalyticEvents{ enum Category:String{ ...

0
Q: Project Euler #14: Longest Collatz sequence

Song KyungwooProblem : source Which starting number, under one million, produces the longest chain? n → n/2 (n is even) n → 3n + 1 (n is odd) I want to receive advice on my code. It is too slow... It takes 514 seconds import math from functools import reduce import time start_time = time.time() ...

0
Q: Find foreign key membership including owner in SQL Server

Fred LackeyWas hoping someone could sanity-check this SQL statement. I need to find the owner (schema), table, and column on both sides of a foreign key: SELECT s1.name AS FK_schema, o1.name AS FK_table, c1.name AS FK_column, fk.name AS FK_name, s2.name AS PK_schema, o2.name AS PK_...

 
@Captain wo there
@CaptainObvious look! a monkey!
 
do code monkeys actually ever learn anything /?
 
they learn to type faster
 
That ^^
 
Also, @Mat'sMug did you read the Foreward in the Jon Skeet book? Eric Lippert says "Of the latter kind" five times.
 
3:36 PM
@EBrown I did :)
 
@Mat'sMug What do you mean? on
People who say that or?
 
Also, I use an SO sticker as the bookmark for when I quit reading it.
Seems only appropriate.
 
If the problem is supposed to have a O(n) running time and it's O(n*n) then maybe it shouldn't be posted a valid entry...since it isn't. But it's an otherwise acceptable question.
 
@Legato no, lol... I just have a bias against and other questions. IMO if it's not working as expected, it's not working => off-topic.
 
Oh yeah, I agree with you there then.
 
3:39 PM
I guess I'm a code monkey. I just memorize code like construct algorithms that are simple list of instructions , concepts some(briefly) and also learning data types and some data structure of primitive types and maybe composite type. I guess i really suck
as a programmer
 
if your specs say "solve the problem in O(n)" and you solve it in O(n^2), your code isn't following the specs, and isn't working code.
 
@june1992 So how did you get here?
 
if you solve it in O(n), put it up for review. then you might get a O(log(n)) solution.
 
by typing
I guess
 
lol
 
3:40 PM
yeah
 
@june1992 how long have you been coding?
 
for about 4 months
 
0
Q: SPOJ INCSEQ- Increasing Subsequence

ShakilProblem Link : http://www.spoj.com/problems/INCSEQ/ I am trying this problem by Dynamic Programming . I tried many cases and in each case it provides correct output . But I am still getting wrong answer. Help please.Here's my code : int main() { int n,k; scanf("%d %d",&n,&k); ...

 
but learned everything in 2 years as that makes sense now
but still learning code
 
@june1992 you're lightyears ahead of where I was 4 months into programming
 
3:43 PM
^ sounds about right
no use beating yourself up over being inexperienced.
 
that's about where I was, 4 months into programming (except I hadn't heard of FizzBuzz then):
17
Q: Commodore-FizzBuzz

Mat's MugI felt nostalgic recently, and decided to install a Commodore-64 emulator. C-64 BASIC 2.0 is the first language I ever programmed in... some 20 years ago (yes, C-64 was already well beyond deprecated by then). Implementing a simple fizzbuzz in such a limited language, and un-learning pretty much...

 
@CaptainObvious It's that SO question we talked about earlier.
 
#PeopleDontRead
 
4 months into programming like learning or already taught meaning code monkey teachings
 
my VS just had an access violation..... what
 
3:46 PM
I was copying snippets from a C-64 BASIC 2.0 manual, running them, and calling it "programming"
@ARedHerring break time I guess ;-)
 
Well 4 months into programming I was on codecademy learning nothing about programming and learning javascript as a side project when in reality I wanted to learn programming
 
@june1992 After 4 months, I was starting to learn what a class is. I struggled with my for loops and I didn't get the while/do/while until 4 months later
 
haah me to
 
@june1992 I'm confused as to how you were saying you were learning JavaScript and not programming.
 
point is, give yourself the time. pick a problem, solve it the best you can. make it work, and post it on CR - you'll learn at lightning speed
8
 
3:49 PM
Hey, I started out on Codecademy too, heh.
 
well on codecademy its not considered programming but web programming right
?
 
Make sure you make it a decent question and we'll love you.
@june1992 It's just a sub-set.
 
1. Web Programming is still programming.
2. They have other languages, like Python, which can be used for anything.
 
@Legato Codeacademy didn't exist yet when many of us started programming.
 
@june1992 thats pretty disingenuous given that javascript is used on the server now. Programming is writing programs using a language (not to argue semantics)
 
3:50 PM
Their Shell course keeps crashing by the way...
 
@Mast You're saying that to say...?
 
@ARedHerring Even English is considered a valid language, given you write Shakespeare.
 
I don't mean to sound bristley but javascript is my main language and I'm also a web developer.. :P but I consider myself a programmer, not just a web programmer
 
@ARedHerring I do want to thank you for the help with rivets.js yesterday, between that and a few SQL optimizations, I got my search method down to about 3-4 seconds of runtime when returning 506 items.
 
well this was like 4 years ago from now
 
3:52 PM
@Legato They generally have decent courses, but they cut corners in their tutorials AND their execution.
 
@EBrown no problem
 
JavaScript has come along way from my perspective when it was just client side even though it still is
 
Re-Monking
 
It has come a long way in the past few years, we'll agree there. But it's definitely not just a client-side language any more
 
@ARedHerring IMO, at the moment you start doing complex stuff, you're a programmer. Wether it's front end or backend or whatever
 
3:54 PM
@ARedHerring The power of frameworks.
 
@Mast I think it's a solid way to get introduced to the concepts. It's still a work-in-progress and seems to be getting better, but even more importantly I would've never been exposed to this field I absolutely adore if it wasn't for Codecademy.
 
@Mast Not really. Node isn't a "framework". It's a runtime. Otherwise we would be calling the JVM a framework :P
@Mast So what you're saying is codecademy is a slightly better w3schools? :P
 
@ARedHerring So how do you call an extension on a language?
 
@Mast Node isn't an extension to a language, though? It's an extension to the V8 runtime. In the same way that Java 8 extended on Java 7 (should we take this to javascript libraries?)
 
A guy I know used to post all the W3Schools inaccurate content to w3fools.com.
 
3:58 PM
That's a lot of inaccurate content
I just have the plugin that hides w3 schools from all search results. MDN is just superior in every way
btw.home
 
@ARedHerring I never get them in the first place.
 
I use W3Schools for some things. I find their HTML colors page pretty useful.
 
@Hosch250 I never have to worry about that anymore as Visual Studio has a colour selector built-in.
 
But, on a nastier note, how would you like to use "private protected" in C# to mean "protected and internal"?
@EBrown In my class a year or so ago, I had to use NotePad.
 
@Hosch250 I used to use Crimson Editor (which I think is now Emerald Editor?) for all my HTML/CSS/JavaScript/PHP work.
 
4:02 PM
Prof said I would fail if I didn't use NotePad.
I figured I might as well amuse her.
 
@Hosch250 That's bull, but I can see her reasoning.
 
My C++ instructor used to get irritated when I would build the C++ programmes in Visual Studio, since he wanted us to use Qt.
 
Please vote "no"!
"private protected" is the worst thing possible for "protected and internal"!
 
wtf is private protected??
 
Feature request for C# 7.
It will mean "protected and internal".
"protected internal" already means "protected or internal".
 
4:06 PM
protected internal means it's only visible to derived types within the assembly
 
Well, read the thread.
 
wait, I got it wrong.
> The type or member can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly. Access from another assembly must take place within a class declaration that derives from the class in which the protected internal element is declared, and it must take place through an instance of the derived class type.
wow that's dumb and confusing
 
Well, it is there.
 
0
Q: Traversal of a Tree in this particular order

thebenmanI was trying to solve this problem. Problem Statement You are given a pointer to the root of a binary tree. Print the top view of the binary tree. You only have to complete the function. For example : 3 / \ 5 2 / \ / \ 1 4 6 7 \ / 9 8 Top View : 1 -

0
Q: getIntent 2 times

danielgomezricoI just found in this google example that they call getIntent() 2 times: public class MainActivity extends Activity { public static final int CONTACT_QUERY_LOADER = 0; public static final String QUERY_KEY = "query"; @Override protected void onCreate(Bundle savedInstanceState) {...

 
And your version is coming out under "private protected", when it really isn't.
 
4:09 PM
well the problem is that protected internal is badly implemented from the start then
you'd think the modifiers are cumulative
 
You know, I have never once needed internal.
To me it seems like a hack-y way to do it.
 
@EBrown It is the default for classes, enums, etc.
 
@Hosch250 Yes, but I always added explicit modifiers anyway.
 
It is all over the place in RD.
 
It's either public, protected, or private.
(At least when I code things.)
 
4:11 PM
Yeah, I add them explicitly too.
 
Using internal feels (to me) like a code-smell.
 
Not really.
 
@Hosch250 15 results
 
It is basically a scoped public.
 
Yes, really. To me it feels like a code-smell. Whether or not it does to you is up to you.
 
4:12 PM
@EBrown I tend to agree with that statement
 
Just like private constructors seem (to me) like a code-smell.
 
:What's the idiomatic way in C# to create Algebraic Data Types, then?
 
I make some chained ctors private.
 
@Hosch250 that smells
 
Depends.
 
4:14 PM
@Mat'sMug Particularly bad, as well.
 
Usually, it is a smell, yes.
 
JavaScript is definitely not a client side language anymore , but i'm not sure never used it
I'm gonna work on design pattern
 
0
Q: Letter Altering Code (by word length) in Pyhton

Collin StumpHere is a code I'm working on that alters a individual letters.Each letter is pumped up x amount of letters. This alteration is dependent on the length of the word. So for instance "hi" becomes "jk", "there" becomes "ymjwj", and thus "hi there" is "jk ymjwj". I want to this code to not encrypt ...

 
lol
 
@june1992 find a problem to solve first
 
4:20 PM
I'm going to implement interface by solving a widget problem by winforms
It has to expand through a widget and implement a interface by means of multiplying the widget into 12 conversions by implementing the IWidget interface that I am going to make right now since I deleted my code from last night
 
if you want something fun, here's a suggestion:
28
A: Weekend-Challenge Reboot

Mat's MugThe Ultimate Tic-Tac-Toetm Tic-Tac-Toe is boring. Let's code The Ultimate Tic-Tac-Toe, a whole different story. Uh, what? Each turn, you mark one of the small squares. When you get three in a row on a small board, you’ve won that board. To win the game, you need to win three smal...

plenty of room for plenty of design patterns ;-)
OOP-wise, it's a very interesting problem to solve, too
 
To be truthful I never knew any games and how to implement a interface for a game to be truthful
 
If you are interested in a review (e.g. possible improvements) of your code then you could post it on codereview.stackexchange.com/tour. — Martin R 5 secs ago
 
It isn't any harder than any other programming.
 
I'm just not sure if the initialization for runtime should look like this in object terms FooBarr(new ... new ....) or FooBar(new ...) and thats it for whatever reason should be correct
For decorator
 
Hello anybody here? — McLinux 46 mins ago
 
I understand that the decorator consists of two sub classes from a class that interfaces with the implementation but not the initialization itself such as Decorator(new LuxaryCar(new Car())));
or
 
hi
 
var objectss = new Decorator(new LuxaryCar());
 
> We are just in stealth mode.
 
4:34 PM
I know we are not a fix my code service, but I think that pointing out a single char mistake as a comment is ok isn't it?
 
@Caridorc Yep.
 
$_FILES['files'] = null looks cool
 
@june1992 Either would be OK, really.
 
@june1992 I used this site alot to learn my patterns : dofactory.com/net/design-patterns
 
But, actually, should you be able to create a LuxuryCar without needing a normal car?
So, var decoratedCar = new Decorator(new LuxaryCar());
 
4:35 PM
@Hosch250 I am planning on reviewing codereview.stackexchange.com/questions/105382/… as soon as that error is fixed
 
It really all depends on the signature of the classes.
 
I love terribly written simple code. It gives me the chance to re-write it from scratch while explaining what I think when writing it differently. And how much simpler it can be.
 
Decorator is a bad name. What does it do?
 
@Caridorc And those are the ones that get you 200 rep, easy, usually.
 
So ConcreteA and ConcreteB should be using abstraction by implementing the Component and the decorator should use DI for the use of at runtime ? Is what I understood form the comment
 
4:38 PM
@Hosch250 getting to 10k would not make me sad actually ;P
 
I'm not sure maybe it should be LuxuaryCarDecorator(new LuxaryCar());
 
@june1992 I don't think the Decorator pattern is a good start to learn the patterns. If it's the first one you attack you might want to look at the factory or the composite, as they are easier to grasp. Then you'll get the feel of what is a pattern. But that's my opinion!
 
Well I though I had it
down
but not really
 
problem is that you're mixing things up with inheritance here.
how is a LuxuryCar not just simply a class LuxuryCar : CarBase?
patterns solve common problems
 
i'm confused with this part -> FooBar(new ObjectToInject(new ObjectToInject()));
I was completely lost when I saw this
The Comment itself was wonderful outstanding really but I was lost with this part
 
4:43 PM
I think I might have a good example for the decorator pattern, lemme write it to see if it makes sense
 
alright
 
Since you have working code and are asking for how to improve it, I would think that codereview.stackexchange.com would be a better spot to ask. Please be sure to check codereview.stackexchange.com/help/on-topic before you post to make sure you follow all their posting guidelines. — josilber 12 secs ago
 
@june1992 don't try to learn everything at once. Dependency Injection is a subject on its own
 
Maybe I really was mixing concepts together
 
@Duga Looks on-topic.
 
4:48 PM
think in terms of concerns and responsibilities, in terms of objects. see how they relate to each other, how object A depends on object B; start by newing up object B where it's needed. then learn to recognize a class' dependencies, and how you can "inject" them.
 
@Mat'sMug well, I really just write some random toy programs, and not think at all about design patterns. From which level of complexity are design patterns required?
 
Separation of concerns is possibly the most important principle in software engineering
Appears in many forms in many contexts
 
@itsbruce amen
 
Sadly, it's counter-intuitive for waaaaay too many people
 
@itsbruce Separation of concerns is obvious to me
A car that also makes coffee is absurd, as is a rocket that also plays music.
 
4:53 PM
@Caridorc it depends
 
I think object a and object b depend on the interface and the decorator carries the DI and a borrowable class add the responsibility to object a and object b really
 
@Mat'sMug and so the Lunar JukeBox was invented.
 
Unless using concrete classes
but i'm not sure
 
@june1992 what's "carrying the DI"?
 
4:56 PM
@Mast Touché
 
DI is nothing more than decoupling the components: instead of having Class1 that depends on Class2 like this:
 
@Caridorc But many people design cars where the steering wheel is also part of the air-con system etc. In the software world.
 
var foo = new Class2
 
@itsbruce it the heat from steering is used to heat up the air for air condtioning it may actually make sense
 
...you make Class1 depend on an abstraction of Class2 - its interface - and you take the responsibility of creating that instance, out of Class1. That's all there is to DI.
 
4:57 PM
@Caridorc If you design your wheel to depend on the aircon and vice versa, you now have a mess
 
public Constructor(IInterface _Interface){ this.Interface = _Interface; }
 
Changing one now means potentially breaking the other.
 
sorry
 
@june1992 fix your naming conventions. the purpose of the underscore prefix is to get rid of this qualifiers
 
@itsbruce sure, but that heat sure should not go wasted. Just choose an interface that will not change, and you are free to change internals as you wish
 
4:58 PM
camelCase parameters, _camelCase fields
 
@june1992 You can take a look at this, I hope it'll help you. Also, I think someone more experimented should take a look at my example to make sure it's a good example for someone to learn :p ideone.com/lgv1uO
 

« first day (871 days earlier)      last day (1747 days later) »