« first day (828 days earlier)      last day (3487 days later) » 

11:09
0
Q: Check if all leaves are at same level in a binary tree

MehrdadI have written this code for checking whether all leaves are in the same level or not, in a binary tree. Any suggestion or improvement is appreciate. import java.util.LinkedList; import java.util.Queue; public class Methods { //* ---- Method for check whether all leaves are in the s...

0
Q: Performance comparision of SQL queries versus LINQ in Visual Studio 2012 (code posted)

arbab akbarI am new to VS 2012 and need to use it with SQL Server. I need to get data from a table in SQL Server 2012 with 500 rows and 15 columns and process the data in it and update another table. All this has to be done in 100 ms. I tried traditional method with SQL query filling a dataset and then acc...

@Heslacher Yea, it's usually used with , but IMO it could be replaced with
the connotations are different...
11:25
What do you think your code is not enough elegant? And wouldn't be better in Code Review at least? — Soner Gönül 48 secs ago
great... and Mathematics is at it again...
What's wrong with them?
Monking
11:44
Greetings
Stupid question: who named the chat?
7
Q: What should be the name of our main chatroom?

Mat's MugOur main chat room is currently called Code Review General Room, with "General discussion about Code Review." for a description. I propose The Zombie Hunters' Lounge, but I'd like the community to post their ideas here (1 per post, include why it's the best name), the one with the highest number...

@IsmaelMiguel please... start... searching such stuff on meta.
You can say "It's on meta"
Because not everything I ask is on meta
maybe you want to start checking meta first
because there's a lot on meta
Exactly
And the search on Stack Exchange is quite...........poor.
It never finds what I'm looking for
abuse google for that..
11:47
Which also contains massive amounts of garbage
all se sites are very frequently indexed by google
you can restrict google searches to a specific site
I know, by using site:<domain>
~BTW.Work
11:49
Thanks for the link
Greetings, Programs.
Greetings, user
Greetings
Greetings
I just use !se [search for whatever] to look things up on SE
12:00
I'm voting to close this question as off-topic because code review — Martin James 38 secs ago
@Duga voting to delete this comment because grammar
@IsmaelMiguel When you say "can't", do you mean it wouldn't count because you're already familiar with it?
Ugh. I hate those comments. The user asking the question has 1 rep. It's clearly his first post...
Although, on the other hand... his profile pic does have a translucent confederate flag over top of what I can only imagine to be his picture.
Hmm. We have . I feel like maybe we should just have a tag instead (and apply it to questions primary concerned about any sort of control flow structure [loops, if/else, switch])
12:16
0
Q: Java project: code analysis and feedback

user80864First of all I would like to apologize it this is not the right place to ask (if that's the case please let me know where can I ask). I submitted a Java coding test for an interview that unfortunately did not pass. It works fine but I guess the design or the Test-Driven Development approach was...

0
Q: Asynctask should called after crating tabs

TufanI am using tabhost with asyncktask ..my condition is tabhost should update after post execute of asyncktask I had written code something like this public class BusLayoutNew extends FragmentActivity { private FragmentTabHost mTabHost; public static final String TAB_UPPER = "Upper"; public stati...

0
Q: Posting code that is partially not my own

morbidCodeSay I am learning a programming language through a tutorial. To demonstrate a concept the tutorial provides a program, that is, some working, runnable code (not Code Snippets). Then I encountered an exercise that goes like this: Improve this code, add N functions to do other things. Modify some...

@MartinJames No. — Mast 14 secs ago
Should we report users carrying the Confederate flag?
Or isn't it that banned yet?
You can ask on the SO or SE meta.
I haven't heard of SE banning it...
Just my opinion, but I would lean toward your first solution, because it would be easier to understand the code in it's entirety and ensure that it's not broken or stub code. — RubberDuck 13 secs ago
@StackExchange ermph... license problems..
12:21
@RubberDuck I'm writing an answer.
@RubberDuck I think it could work, but you'd probably have to quote the code not modified and give attribution..
0
A: Posting code that is partially not my own

nhgrifIn the past, I've leaned toward the first solution, for the reason that RubberDuck makes in his comment, however, having seen a few questions asked like this, now, I'm not so sure. Consider Exhibit A and Exhibit B. These are both swift questions that from some Stanford course intended to teach ...

0
A: Posting code that is partially not my own

MastI'll try to answer your statement point for point. Improve this code, add N functions to do other things. Modify some fields and functions to do other things. Improved code is written code. Let's consider every part you improved to be yours. Improve this code, add N functions to do oth...

We posted pretty much at the same time. I'll see if yours is way better.
Don't worry. It is.
You seem to be addressing the concern of whether or not the poster did enough to consider the code his own so whether or not he could post it all.
I'm addressing the concern of how to get the best answers.
(And with the experience of having answered at least two of these questions in the past)
Yea, you found a very important part I didn't address.
12:35
@TheParamagneticCroissant However, the question is not a code review. But without any information about toolchain and targert system it's hard to give an good advice. — flotto 8 secs ago
@nhgrif When I say I can't, I mean that I already read about it or that I tried to use it OR that I have already studied about it.
@IsmaelMiguel Have you got 5mins?
Yeah, but it's hard to chat from the tablet
Ok, remember what i was trying to do the other day? I got it working
It needed another function to merge all the arrays
I just found something fun...
12:43
Thanks to you, I came at it from a much simpler angle
This is a description stored in a database table.
Inside Diameter (A)<br />&nbsp;&nbsp;&nbsp;(1.183 - 1.185)
v nice lol
So.... let's just insert formatting html into our information instead of formatting it application side....
htmlspecialchars()
@CodeX You're welcome. I'm glad it works.
12:44
Now i have a new problem
@RubberDuck It's entirely possible they're storing something as plain text where the formatting is absolutely crucial that it is maintained. And that it's up to the user's input on how to format it.
Duplicate Arrays.. I'm trying to remove them with array_unique() variations but I lost all of the arrays that have a dupe
That looks kind of familiar to stuff I used to work with, and the only thing that would surprise me is seeing the HTML rather than just new line characters.
1.183 - 1.185 <- only info that would need storing imo
output it and format it
I hate answer invalidating edits.
12:47
"It's entirely possible they're storing something as plain text where the formatting is absolutely crucial that it is maintained. And that it's up to the user's input on how to format it." - That too
0
A: Switch statement for adding/removing operands to the text part of a label

nhgrifSo, as a start, I'd take my enum, which you've stuck at the bottom, and move it to the top. It's great to use custom types, but sticking it at the bottom of the file does a disservice to readers. And the fact that it has been placed at the bottom makes me think that the author may have underval...

@CodeX Depends.
"enum Operand: String {
case Multiply = "x"
case Divide = "/"
case Add = "+"
case Subtract = "-"
case Evaluate = "="
}"
Really nice..
Where I came from, we were writing database software for manufacturers.
@nhgrif it's kind of you to give it the benefit of the doubt, but there's actually no way for a user to enter this information....
I have to do it myself until I build an UI.
So one column from one table was a varchar(max) that would store instructions about manufacturing processes.
12:51
@CodeX What exactly are you trying to do?
That makes sense to store the formatting in the DB
@IsmaelMiguel Just remove the duplicate arrays
@CodeX Can you provide a pastebin with the content of all the data?
$out = array_map("unserialize", array_unique(array_map("serialize", $out))); - removes all the dupes and the original
yes
But what are you trying to do?
The description of the problem compared to the code does not really match. You say that you have two objects, and then show code that tries to find two objects. Either way, if the code works you probably want to post it on CodeReview. — Lasse V. Karlsen 51 secs ago
12:55
@IsmaelMiguel Just remove the duplicate arrays
Where are the arrays?
What counts as a "duplicate array"?
an array that is the exact same
so same values at the same indices
and you have what, an array of arrays, some of the children arrays being duplicates of each other?
thats correct yes
12:59
@RubberDuck That's awful.
making a paste bin
That's a duplicated array
I want to remove the duplicates
Do you want the whole array?
Yes, but use var_export next time
its a huge array
13:06
15 elements is enough then
ok 2secs
refresh the pastebin now
Please, don't use print_r
im using var_export(
13:10
0
Q: Shortening code finding and comparing two objects while avoiding NullReferenceException

GodsparkCan this code be made shorter and 'prettier', in < C# 6.0 var a = original.SomeList.FirstOrDefault(p => p != null && p.EType == EnumType.FooEnum); var b = updated.SomeList.FirstOrDefault(p => p != null && p.EType == EnumType.FooEnum); var bEqual = false; if (a == null && b == null) bEqual = ...

var_export() gets structured information about the given variable. It is similar to var_dump() with one exception: the returned representation is valid PHP code.
Sorry
IE's fault
Thats what i used
Yeah, IE was chewing itself
I think it took a while to resave the pastebin
after 5 refreshes, it was the same
13:11
I didnt know about that function
Thanks!
I either use print_r() or var_dump()
You're welcome
It's really great to use for debugging and such
And when you want to replicate an array to re-use
Yes! Wow i used to do some overcomplicated function to get the same result lol
Yay, the new API for my sorting library is defined and works. Now... let's write the doc...
@Morwenn That will take 2 weeks
13:14
I am so incredibly hopeless at writing technical docs. :(
HOpefully you're better at it than me
@IsmaelMiguel It should be done in a few hours. I just have to find the motivation.
@Morwenn Its nice when things come together
I had the same success but on a smaller scale today
At first, I only had two functions to document. Now I have to explain what are sorters and sorter adapters, how to use them, how to write them and which ones are available out-of-the-box.
Shouldn't take you too long
No one liked this answer?
0
A: Switch statement for adding/removing operands to the text part of a label

nhgrifSo, as a start, I'd take my enum, which you've stuck at the bottom, and move it to the top. It's great to use custom types, but sticking it at the bottom of the file does a disservice to readers. And the fact that it has been placed at the bottom makes me think that the author may have underval...

13:16
Haha sorry @nhgrif I forgot
@Morwenn The basis of the specification of Corky took about 2 weeks to write
@nhgrif Sorry, but that is completely outside my knowledge range
-1
Q: Selecting multiple input in Java JOptionPane.showInputDialog?

Ryan Hi I'm curious on how to change my code to allow it to take multiple inputs. public void readInput() { try { String num1 = JOptionPane.showInputDialog(null, "Enter your choice of cake:\n\n" + "1. Strawberry (90 cents) no. of cakes available: ...

0
Q: ActionGroupContext to know an id of the current context

JakobMy services(or services that depend on services) need to know about a current action group id. To add an extra optional parameter to each service for the id was an idea but in my current environment to difficult and ugly because every service would have to take in the parameter only to pass it to...

13:32
@CodeX It is running fine. Try this code: pastebin.com/2rpvG8zy
@IsmaelMiguel I still get 2 of the same array :/
Monking Monday!
1100 Reputation until 20k!
Bounty Ending in 2 hours --> codereview.stackexchange.com/q/98759/18427
@IsmaelMiguel I think i see the problem
@IsmaelMiguel The array when dumped is array() array() they need to be inside an array() so.. array( array() array() array() ) maybe..
@Malachi Me too ;-)
13:47
I am going to have to try and catch up to you now!
Thats not fair, I have much work to be done !
Btw, only 1000 Rep for me ;-)
0
Q: De Casteljau's algorithm in OOP and C++

anonymous#include <cstdio> #include <iostream> #include "Point2d.h" #include "Collection.h" #include "Coordinates2d.h" #include "graphics.h" #define PRECISION 0.01 Point2d Approximate(double t, Point2d const & pt1, Point2d const & pt2) { double x = pt1.x * (1-t) + pt2.x * t; double y = pt1.y...

@Heslacher I saw that
I have work to be done as well.
but I think I might have a question or two I can post...
Bring it and let me earn some rep.
14:04
@CodeX Sorry my stupidity but I don't get it
Oh
Maybe you have a different value
The array must be 100% exact or it won't work
Maybe a space, a comma or something
@IsmaelMiguel here is my code pastebin.com/Bv2Fa7LL
The duplicate arrays are exact
But there is no duplicate there
Wait...
Are you searching on the pastebin?
no
let me put the actual duplicate in
31 mins ago, by CodeX
user image
Searched in the firefox window
I saw that
I can get some variations of unique to remove all dupes but they also remove the original too
14:09
Can you create another pastebin with only the duplicates?
its my array thats the problem
Yes
I will give you the raw XML data
@CaptainObvious Burn it. Example code.
@Heslacher We need 1 more
Deleted by owner
14:15
@IsmaelMiguel The array is wrong but I'm not sure how to fix it, at the moment the code is producing an array for each item then putting all those inside a variable but not wrapped in an array
It could be the loop causing the issues also
Confused? You should be.
My answer to the JavaScript Bounty question....
1
A: jQuery plugin that makes a slider out of an <ul> list

MalachiI saw something that could make your code more dry... // be sure the plugin is attached to only one DOMElement if($(this).length == 1) { new $.sdSlider(this, options); } else if($(this).length > 1) { console.error($.messages.severalElements); ...

all I need is that bounty and to max rep and I will be ahead of you @Heslacher!
:)
112 more rep and I will catch you
@Heslacher Link me some of your posts so I can help you mortarboard so you don't get beat by him. :)
@CodeX And I am
14:20
;-) I am not into pimping unless it is a really ooooolddd zombie
@EBrown
@Heslacher Define old
Fine, I'll go search through your posts myself. :P
@IsmaelMiguel older than 8-12 months
@Heslacher The oldest I had was 7 months
nhgrif didn't liked that I was going to answer it saying that there's no improvements and he quickly found some things to improve
I haven't answered an old one lately. These old ones are usually hard ones where you need a lot of time which I don't have at the moment. So I will let them lay around some more.
14:22
And the 2 who answered found 2 bugs, which is really great
Javascript and PHP
?
Mostly C# , some Java and very little c++
@Heslacher How closer are you to capping for the day? Wouldn't want to push you over the limit.
I forgot how to C#, I don't do Java or C++
@EBrown Long way to go ;-)
@EBrown Be careful when voting. The system may detect too many upvotes in a row and roll them back
14:25
And you should also read the answers and decide if they really should get an upvote.
2
@Heslacher Oh I have been.
Even commented on one of them already.
(I don't upvote without reading first, seems wrong.)
@Heslacher totally agree
@EBrown good to hear
Your comment about var is ok, but it is not only used with Linq. If the right side of the assignment makes it clear what type it is one should/could use var. Like var value = "blabla";
@Heslacher I get that, but I would also include the information about using the var keyword with LINQ. (My information was merely an addition to yours. :) )
Its like Option Infer On in VB.NET.
14:35
There is such thing?
I use Option Strict On and Option Infer Off in VB.NET.
@EBrown Thats the best setting for VB.NET.
@IsmaelMiguel Yes, but the default at least in VB 2010 is Option Strict off which is a bad idea.
@Heslacher Unfortunately, due to the original programmer here at work, I am still working on validating all my work code to VB.NET with those settings.
@Heslacher I never used VB 2010
Only older
IIRC the default since Option Strict was added has been off.
14:39
@EBrown I seldom use VB.NET anymore. I am more used to C# now. If I need to do some VB.NET I get compiler errors a lot because of semicolons ;-)
@Heslacher I had that issue when I first started at this company, but unfortunately, due to the fact that our original programmer (and Sys/Net Admin) is a VB.NET guy, I have to stick to it.
Too bad
Yeah, it's unfortunate.
So, I've been slowly refactoring our code to 2015 standards, instead of VB6 standards.
Every now and then I need to touch some old VB 6 code of some legacy applications. Thats awful !
Talking about code, I need some work to be done. See you later
@Heslacher VB would be better if it had Line Terminators
14:49
You can still one-line a lot of stuff in VB
In the end, writing the doc was faster than I thought it would be: github.com/Morwenn/cpp-sort
@Morwenn Do you want to write the documentation for my language?
@IsmaelMiguel I never want to write documentation. It's just that I don't feel that my projects are complete if they're not documented.
5
1
Q: python - speed up string tests & transformations

Waqqas DadabhoyI have written code to get all urls on a webpage & put them in a set, and would like tips on simple changes I can make to increase its performance. soup = BeautifulSoup(html_doc) for link in soup.find_all('a'): url = link.get('href') if url is None or ' ' in url or '<' in url or '>' in u...

Same here, except that this time I'm doing backwards
I wrote the specifications and after that I will implement it
That way I have a baseline to look at
In fact, I have to update it
15:02
Thats not the cool way to do it, @IsmaelMiguel..... you should write the specifications, then after that you should write the tests then only after that should you implement it.
By writting the tests, you mean example code?
If so, I'm 6 months ahead of you
No, formal unit tests, and an automated test system.
TDD
Actually, forget what I told about documentation. I never feel that my projects are complete.
Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence. Test-driven development is related to the test-first programming concepts...
How can I make unit tests to something that isn't developed?
15:04
create a failing test that tests new functionality
then make it go green
refactor
rinse and repeat
So, I create a code that does nothing and then, based on tests, make it work?
correct
one small step at a time
But the steps are like 20cm
15:05
and (theoretically) cleaning up after every new functionality
And the road if 50km
if you have a unit that needs 50km walking it's not a unit
and then your design needs an overhaul
I mean
The goal is 50km away
@IsmaelMiguel I fixed the problem, im just removing the duplicates from the DB instead
@CodeX Sounds a good solution
15:11
@IsmaelMiguel It was definitely quicker
0
Q: Is there a better way to write this so I don't have to use Globals?

usernumber2""" lim_current.py - A simple program to initialize and display Linear Induction Motor (LIM) current. Requires Python V3 and tkinter """ import socket from tkinter import ttk from tkinter import Tk from tkinter import N, W, E, S from tkinter import StringVar CLIENT_SOCKET = socket.socket(sock...

@CodeX How?
@IsmaelMiguel ALTER IGNORE TABLE foobar ADD UNIQUE (cardname)
SCORE!
15:21
0
Q: Text based game

Keanu Jones#import import random import time import sys #animals def game(): snake = {'name':'snake', 'health_4':7, 'attack':(1,7)} lion = {'name':'lion', 'health_3':10, 'attack':(3,10)} bear = {'name':'bear', 'health_5':8, 'attack':(3,9)} #players weapons and enemies def player(): player...

0
Q: Rest service image upload file not working

Kaushik KishoreContract of wcf [OperationContract] [WebInvoke( Method = "POST", UriTemplate = "/UploadFile?fileName={fileName}")] void UploadFile(string fileName, Stream uploadedFiles); Main class that is implementing interface. public void UploadFile(string fileName, Stream uploadedFiles) ...

0
Q: Java project: code analysis and feedback

user80864First of all I would like to apologize it this is not the right place to ask (if that's the case please let me know where can I ask). I submitted a Java coding test for an interview that unfortunately did not pass. It works fine but I guess the design or the Test-Driven Development approach was...

Thanks @Mast
the OP thought my answer was better than the other answer! Bounty Acquired!
@CodeX Oh, that should do it
Yeah this process only has to happen once every 6 months
Or until I can build a better system
15:24
@Heslacher you will probably stay ahead of me today, unless I get a couple of accepts and that other bounty (which I doubt)
;-) Congrats to the bounty.
thank you
Some day in the near future I will throw my keyboard out of the window ! It is swallowing chars
@Heslacher Sticky keys?
15:27
No, some internal resets sometimes. If I see the lights flashing I know that some chars got swallowed.
sochars
Was that on purpose?
No, that had been the problem
New keyboard then?
Thanks for your help again today @IsmaelMiguel Finally got to a good stage in development
@CodeX You're welcome. You did most of it
15:29
I should get one, but I need a PS2 one or need to check these adapters.
Why ps2?
Monitor switch
@IsmaelMiguel Sometimes when you have someone else look at your code you see the mistakes &&|| realise you are overcomplicating things
@CodeX In your case, I think it was overcomplication
15:31
You have been really helpful, its much appreciated, obrigado!
You're welcome
15:42
Morning
I've had it with Windows 10.
8 bluescreens in the last two days, constant network issues, extraordinaly slow startup times, overall slight decrease in performance.
2
@EthanBierlein Do you have your foot near the power chord?
Nope
The power cord is situated up on a slot in my desk. Far from the floor.
Stupid fucking Windows 10 disabled my network driver. Again. And now I get another bluescreen when I try to re-enable it.
I got exactly 2 BSoD with 8.1, ever.
One was on purpose.
www.ustream.tv/nasahdtv
Live space farming
2
Oh well look at that, now it says "networks available". Let's try to connect to one.
15:54
-1
Q: AES 128 - C# vs Oracle

Cristian Angel BrunerIm trying to encode a string with C# and getting the same result while encoding in Oracle select. Using AES 128 / Pad Zeros / CBC I cannot get the same results, and I have been working on this and searching for answers on many forums and pages. Oracle Select Result:**MjQ5MEJBOTQ1QjI3QzNBMTQzRTc...

0
Q: android - web service handler classes

mina fawzymy webservice class public class ConnectionExector { private Context context; private static final int WAIT_RESPONSE_TIMEOUT = 3000; private static final int CONNECTION_TIMEOUT = 30000; protected ExecutorService executorService; // to handle thread result Handler handler...

0
Q: Allow VBA code inside protected worksheet

Ahmed El AmraniI recorded the below VBA code that hide/unhide rows then sort on worksheet_Activate event, in no time :). Just one thing, the worksheet is required to be protected and this code refuse to be executed in a protected sheet, could you please advise how we can protect the sheet and allow this code at...

Oh, well now it decides to auto-connect to my default network. Wonderful. It still isn't working though.
@nhgrif Do you happen to know when they expect the results?
@CaptainObvious Broken code
Well it certainly is possible: codereview.stackexchange.com/q/50910dyp 41 secs ago

« first day (828 days earlier)      last day (3487 days later) »