« first day (1221 days earlier)      last day (2789 days later) » 
00:00 - 21:0021:00 - 00:00

12:00 AM
RELOAD! There are 2670 unanswered questions (92.8353% answered)
 
12:17 AM
@Phrancis You come up with any other ideas for stats we can report from that SESE Data?
 
@EBrown Still working on the data part ;P
 
I meant from the already collected data...lol
 
Oh, right. No, not really
 
0
Q: PHP movie data scraping code

user3736114how does this code look? I enter in the imdb link and youtube trailer link in the command line to a movie and the first main program loads all the info about the movie. The second main program uses a imdb link to the movie and loads the actors name and birthday. Would it be better to write t...

 
12:34 AM
@Phrancis It appears to work, to the best of the author's knowledge. That's fine. The author has a concern about the code. That's fine too.
 
OK
 
1:01 AM
0
Q: Multiple Ajax request in React Component

user54115I'm trying to rewrite my old project in Reactjs , as I am a beginner and this is my first app . I need some assistance in understanding what is best way to do this in react way and how to improve myself and this demo project . Here is a working demo of it. ListManager.js import React, { Compon...

 
1:22 AM
HOLY CARP
> Execution time: 3:53:36.409089
FINALLY DONE
 
1:49 AM
0
Q: Thread-efficient nonce generations

DemetriI need to create unique nonces for cryptographic purposes in a library that I am writing. If the nonces ever fail to be unique, the consequences may be up to and including remote execution of arbitrary code (by means of allowing injection of untrusted input into an unmarshalling operation). Whi...

 
 
1 hour later…
2:51 AM
@Phrancis are you doing something with a data dump?
 
@Malachi Yeah, working on something
 
what are you working on? what languages are you using?
 
Putting the whole data dump in a SQL database... with well, SQL (obviously) and a bit of Python for scripting
 
just curious because I assume closed site data dumps are going to be similar to the data dumps for SO
are you working open source? do you have a repo somewhere? sounds interesting
 
Yeah, it's a work in progress but here github.com/Phrancis/StackExchangeDataToMicrosoftSQLServer
I need to retouch some of the READMEs. Then start loading up all this XML into the DB for parsing
 
3:02 AM
thank you, I will follow it tonight, maybe fork it and then take a look at it tomorrow night perhaps....
I am just heading to bed
 
Gotcha
Look at the most recent commit history
 
I might see if I can spin up a SQL Server on Azure, because 176 GB is a lot of space, (I am skimming the read me) maybe i read that wrong, is that just the XML?
 
Yeah just the XML
 
do you have to download it in order to read it into the SQL Server?
 
I have uploaded the Code Review XMLs only on a Google Drive if you'd like to play with smaller data sample
 
3:06 AM
I am thinking that it may be easier to create an application that reads in the XML file from the remote location several hundreds (thousands?) of Lines/records/nodes at a time and convert them into SQL Records
 
let me read through the read me better, preferably after I have had some sleep.
 
@Malachi Either way works, I'm just better at SQL than at application code, so I went that route
Yeah, sleep helps ;)
 
I am still stressing a little about how to proceed with the offer I received on Friday
I know what I am going to do, but it is still stressful...lol
anyway TTGTB
Have a good night @Phrancis
 
0
Q: How this java recursive function works?

RajSharmaI am working on a program to print the top view of a tree. You can find the details here- In the editorial section I found below code- void goLeft(Node node) { if(node.left != null) { goLeft(node.left); } System.out.print(node.data + " "); } void goRight(Node node) { System.out.print(node....

 
3:10 AM
I am betting there is a nice and super easy way to do what you are doing but with C#
anyway, I am going to bed I will look at it tomorrow if I have time
 
3:31 AM
No doubt
 
0
Q: A reader and its associated writer for disjoint value access

user2296177While extending the functionality of my polymorphic_callable<> type, I designed a way to obtain a result through a reader type that is set by a writer type; this is very similar to what std::future<> and std::promise<> do, but in a non-multi-threaded way. Since that other question is already ver...

 
unless you come up with a specific error, might be better in stackexchange code review... — Noctis 10 secs ago
stackoverflow.com/questions/38430502/… your problem is a particular case of the one mentioned in the link. Instead of posting the code you should explain the algorithm and test case where it fails. If your algorithm is correct post the code to code review forum instead. — Yerken 1 min ago
 
4:04 AM
0
Q: The veiled guise of binary and string

LegatoChallenge Conceal a binary code within a word. Specifications The first argument is a path to a file. The file contains multiple lines. Each line is a test case represented by a space separated word and a binary code. For each test case, print the binary masked word. The mask alters the word ...

 
4:31 AM
@Malachi you may want to stick around the Cardshifter & Projects room, chances are you might want to re-fork it tomorrow as I'm working on a few commits before I GTB
in Cardshifter and other projects, 4 mins ago, by Duga
[Phrancis/StackExchangeDataToMicrosoftSQLServer] Phrancis pushed commit 8a78bdec to master: Change section about splitting large XML files in top README.md
 
4:47 AM
0
Q: Write ListItemCollection item to a file

NewbieCoderI am using below code to write list item to a file.I want only 2 fields from the list. Is there any direct way without looping through all the items to do that? Here serversToshutDown is a SharePoint ListItemCollection. using (System.IO.StreamWriter file = new System.IO.StreamWriter(...

 
Monking
 
"fields.CallStack, which ensures that the if (key.IsEmpty) evaluates to false" -- we have no way to verify your claim, since you didn't bother to provide a good Minimal, Complete, and Verifiable example. In any case, there does not seem to be an actual problem here. I.e. what's wrong with the code? What are you trying to get to work that you can't get to work? If you just want someone to review your code, that's what codereview.stackexchange.com is for (but they don't want incomplete questions either, so you need to improve this one before you post it there). — Peter Duniho 11 secs ago
 
5:22 AM
Since there is nothing "wrong" with this code, it may be better to ask this question on Code Reviewchthonicdaemon 31 secs ago
 
6:05 AM
You should probably try on Code Review instead, since SO is about fixing broken code — Daniel 52 secs ago
 
0
Q: Increment variable Javascript since a date

FrancescoHi I want to use 3 different counters that show me 3 different increasing numbers starting from a certain date. I've tryed this: <script> var START_DATE_1 = new Date("July 18, 2016 10:30:00"); // put in the starting date here var INTERVAL_1 = 5; // in seconds var INCREMENT_1 = 1; // increa...

 
@CaptainObvious broken
 
1
Q: Program for face recognition

VinI have been using the following script for face recognition as a security feature: main.py from itertools import izip from PIL import Image def compare(self,pic): i1 = Image.open("pic1.jpg") i2 = Image.open(pic) size = i1.size i2 = i2.resize(size) assert i1.mode == i2.mode,...

 
@Daniel: Be very careful about recommending Code Review. I'm sensing that something like this is off-topic. — Makoto 47 secs ago
Good that you found a solution (now mark one of the answers, such that the question is seen as "answered"). But please use other places for code review (codereview.stackexchange.com ?) And problems like yours are an invitation to fall in love with a testing framework like minitest. — Felix 36 secs ago
@Makoto this question seems ok for code review. — Heslacher 21 secs ago
 
6:28 AM
0
Q: JApplet code set up issues (MVC pattern & encapsulation)

Zach I gave myself a small project to work on and at first I wanted to use the MVC approach, but I got confused as to which part of my code should go into which class. I did some research and still don't quite understand how I should go about it. I created the View class: public class LevelUpView e...

 
Usually I would say yes, but OP already posted the question on CR. Unfortunatetly here an answer is given, so deleting the question is impossible. — Heslacher 48 secs ago
@Felix I think I did mark Pawel Duda's answer, not? (Is it the green check?) I will check this codereview place ;) Not sure what you meant by minitest... — Felipe Maion just now
 
6:49 AM
You better move this question to code review instead of stack overflow. — Saeed Adel Mehraban 35 secs ago
 
6:59 AM
monking
 
7:53 AM
-1
Q: Create a aspx page, which of server name,user name, password

Vishnu VardhanThis is vishnu, I have a query, I want to create a wizard (aspx screen) which consists of three textboxes and one drop downlist SERVER NAME: TEXTBOX USER ID: TEXTBOX PASSWORD: TEXTBOX When i click on submit button how i can connect to another server through aspx. page. Similarly, how we do i...

 
@CaptainObvious no code no glory
 
8:04 AM
0
Q: Require.js : Using require / define & doing right

l2aelbaI am a bit new of Require.js and i was wondering about im doing right or not. jQuery should be used any parts (that why i have to include jQuery before require.js) Global functions should be used any parts Including part : <script type='text/javascript' src='jquery.min.js'></script> <script ...

 
0
Q: Imported data from CSV successfully, but slow

Đỗ Tiếncurrently I am using the gem activerecord-import to seed more than 55,000 records into my database, and it works fine. However, the thing is it takes too much time. I am wondering if there are any other ways to shorten the import time. Any suggestions would be appreciated. ocean_routes_columns =...

0
Q: accessing base list in linq query

BMillsI have a query that looks like this: var tournamentMatches = community.Tournaments.SelectMany(x => x.Rounds. SelectMany(y => y.Matches)).Where(j => j.Away.Members.Count > 0). Select(t => new TeamLeagueMatch() ...

 
8:45 AM
I think this is in essence the same argument that comes up when you write 1 + 2 << 3. Is the reader expected to know C operator precedence, or should I add parentheses to that? What about 1 + 1 * 2? And so on until you've done enough code review and want to get on with something more exciting ;-) — Steve Jessop 49 secs ago
 
Christ, I hate myself 3 months ago. Why did I write code like this?
 
 
1 hour later…
9:48 AM
I agree. This can be migrated to Code Review. — Mast 45 secs ago
 
@Phrancis Only once you're perfectly sure it works as intended or you'll have to download the whole thing again :-)
@CaptainObvious RBA.
 
10:13 AM
0
Q: Generate Orders from Matrix and save as CSV

Denik GorbunovGood day, Community! I had a task to create a VBA macros which will take a matrix data set with products in rows and persons as a columns (on intersection we have an ordered qty for each material for each person) and convert it into a CSV file for Advantix to load. As I'm new to VBA, I spent a c...

 
If the code is correct it's better suited for codereview.stackexchange.com, otherwise please specify the problems you have. — Thomas 58 secs ago
 
10:26 AM
note to self, always write tests
code you write without tests is always stupid
 
10:41 AM
Tests double awesomely as docs.
Especially for those wacky functions you though you couldn't do without that solved the problem so neat but are impossible to read correctly at first (and second/third/fourth) glance.
 
10:53 AM
tests just made me realise I need to extract something in order to get my stuff to work and also that i was using the wrong sign
 
Mmmmking
 
0
Q: GCD of numbers using ruby

tesI am trying to implement a algorithm for gcd of two numbers in a functional approach.Can this be improved further also improve performance def gcd(a, b) return b if a ==0 return a if b == 0 return b if (a%b == 0) return a if (b%a == 0) (a > b)? gcd(a, a%b) : gcd(b%a, b) end

0
Q: Server side formula computation of an Excel like client side view

AlexeiOne of the projects I am currently involved in requires to have a view that is similar to one in the Excel, except that most of the cells are read-only and the area is much more limited (the maximum size is about 300 rows x 10 columns). Based on some parameters, some aggregated values are fetche...

 
11:09 AM
0
Q: Simple geometry problems involving rectangles and circles in Python 3

SassySamuraiI'm working with some simple geometry problems featuring rectangles and circles. My code is as follows: # Working with simple geometry problems featuring rectangles and circles import math class Point(): """Represents a point in 2-D space.""" def __init__(self, x=0, y=0): self....

 
Monking
 
0
Q: oAuth2 token creation when registering new user

LearnerI am working on Django Rest Framework for backend to develop android app. My project is about Food Delivery System. My app has user login and registration feature. I preferred oAuth2 for token based authentication. I did the user registration part. When a user registers, a new token is created fo...

 
11:40 AM
How's eternal September going?
 
-1
Q: Testing my code with DIMACS maximum clique problems

SkrsalamI will like to test my code with DIMACS problems on maximum clique. I tried downloading the problems from https://turing.cs.hbg.psu.edu/txn131/clique.html but when, I opened it, I did not understand the contents of the files. Can anyone guide me on this?

 
>

The programmer's wife couldn't take it anymore. Every discussion with her husband turned into an argument over semantics, picking over every piece of trivial detail. One day she sent him to the grocery store to pick up some eggs. On his way out the door, she said, "While you are there, pick up milk."

And he never returned.
4
LOL
82
A: Could a paradox kill an AI?

Robert CartainoThis classic problem exhibits a basic misunderstanding of what an artificial general intelligence would likely entail. First, consider this programmer's joke: The programmer's wife couldn't take it anymore. Every discussion with her husband turned into an argument over semantics, picking over...

 
0
Q: Is there a way to make a this program faster that calculates even fibonacci number sum

Cubestormer IvSo, in my first attempt I created a code that generated all fibonacci numbers and appended to a list. This list I then traversed to get the even numbers and added them up. It worked, but took like 5 complete seconds to work. Then I decided to not create a list and add the even numbers as I'm gene...

0
Q: File search program not efficient enough

VinI have created a program to search for a file in the computer. But I feel it can be improved. Can anyone help me with this? filesearch.py import win32api import def filesearch(self,*args): drives = win32api.GetLogicalDriveStrings() drives = drives.split('\000')[:-1] searchfile = ''....

 
11:57 AM
Monking!
 
@CaptainObvious needs more CVs
 
12:17 PM
You are better off posting here codereview.stackexchange.comtherealprashant 14 secs ago
 
12:27 PM
-1
Q: fixing interface changes in a shared library for two different versions

sandun dhammikaI'm developing for linux and I need to create a one binary release for all the distributions ( I know this is not a realistic dream but I was forced by the customer). And our driver ( user mode) is depending on libudev.so.X functions. But in our target linux distributions there are two different...

 
12:44 PM
 
12:59 PM
Reveiws of working code are better fitted on CodeReview (codereview.stackexchange.com) than Stackoverflow. — 911DidBush 15 secs ago
 
boolean minutesDecimal makes me want to stab things
4
 
lol
hmm, FieldRep?.Equals(null) when FieldRep is null gives you null
 
0
Q: This program prints the primr numbers between given any two numbers

Abhishek SharmaAfter running the below code on spoj website, It says Time Limit Exceeded.I think the program I am writing is correct.Would you Agree?What does it mean that time limit exceeded?Kindly suggest how to decrease time or memory? Is there any better way to solve this problem? import java.util.*;...

 
> What does it mean that time limit exceeded
It means you exceeded the time limit. I'm not sure what other answer you are expecting here
 
@Pimgd That sounds dreadful... what were they thinking!?
 
1:07 PM
there were thinking "it's 2001 and I need to get this feature in"
5
 
LOL
 
Speaking of wanting to stab things
    var appointments = new[] {AppointmentFactory.GetUpdatedAppointment(existingAppointment)}.AsQueryable();
    // ReSharper disable once PossibleUnintendedReferenceComparison
    var context = Mock.Of<IDataContext>(c => c.Set<APPOINTMENT>() == appointments);
This annoys me
would be much nicer if I could just
 
new[] { what the...
 
^ that
 
Mock.Of<IAppointmentContext>(c => c.GetAppointmentWithId(id) == existingAppointment)
new [] { T } creates T[]
c.Set<T>() must return IQueryable<T>, which is a set of T, so, no way around it
that's why I would prefer the above suggestion of hiding the implementation detail of using IDataContext.
because I'm not a prat and care about leaky abstractions
 
1:15 PM
Greetings, Programs.
 
In other news, I finally have a fully functional process for getting this XML data in the DB with no fuss :D
in Cardshifter and other projects, 1 min ago, by Duga
[Phrancis/StackExchangeDataToMicrosoftSQLServer] Phrancis pushed commit 93f2ad67 to master: Solidify and test loading XML files using the processing queue
Just loaded 100 Badges files in about 4.5 minutes
 
1:31 PM
0
Q: dynamically attaching table name in entityframework

SivaRajini0 down vote favorite I am using Entity Framwork with a database-first approach. I want to change the table name or view name dynamically based on conditions. Here, I am using V_OVT_VLD_340B_DNA_CLD or V_OVT_B_table or V_OVT_c_table to get the records. Based upon the source, I need to call the d...

 
@CaptainObvious That would be a terrible idea.
 
@CaptainObvious That code is ugly.
If only more beginners would take 10 seconds to paste their code into a code beautifier.
> 0 downvote favorite
 
Newest 'c#' Questions - Page 4 - Stack Overflow
stackoverflow.com/questions/tagged/c%23?page...
Vertaal deze pagina
Here, I am using V_OVT_VLD_340B_DNA_CLD or V_OVT_B_table or ... c# entity-framework linq c#-4.0. asked 3 hours ago. SivaRajini. 2,14784277. 0. votes.
google result hit for V_OVT_VLD_340B_DNA_CLD
 
Those are horrible table names
 
1:43 PM
0
Q: Dynamic table name in Entity Framework

SivaRajiniI am using Entity Framwork with a database-first approach. I want to change the table name or view name dynamically based on conditions. Here, I am using V_OVT_VLD_340B_DNA_CLD or V_OVT_B_table or V_OVT_c_table to get the records. Based upon the source, I need to call the different table ...

 
What GetTable() method meant. i am not able to find any method named "GetTable" in context — SivaRajini 2 hours ago
 
Good grief
 
SO needs to learn that SO is not a substitute for google
nor is CR
 
@DanPantry Or the official documentation
 
also, C# not having named tuples is really annoying
or at least, more sugary tuples
Rust has (a, b) which can desugar to let (a, b) = tuple
my pc just threw up when trying to type into this chatbox. i'm done. =.=
 
1:50 PM
what did it throw up
 
a reminder that my work laptop is awful
 
awww I was kinda hoping like a large amount of computer chips or something
I dunno what I expected
 
IsEmpty() doesn't check to see if a cell is empty. You most likely want ws.Range("G" & x).Text <> vbNullString instead. See here.Comintern 12 secs ago
 
make one change in .edmx, save, 189 errors completely unrelated to the change.
excellent
restart visual studio: down to 2.
 
@Mon: As I commented earlier, your question was already too broad for Stack Overflow, and your edit made it even broader :) If you have additional questions, please create a separate question post (one main question per post). If you are just interested in a code review, you could ask on Code Review. — unor 8 secs ago
 
1:57 PM
i hate microsoft.
 
I CAN HAZ INDEXZ?
Good grief this table is slow (my fault)
 
lol, wtf
I saved a file and visual studio deleted about 100
 
lol VS
 
Congrats on 99,999 @200_success ;)
10
user image
5
 
@Sven - Also, see item "2" at this link for an explanation of why you shouldn't use your Col_Letter function. — Comintern 36 secs ago
Didn't even realise there was a Code Review SO site. Cheers! — aendrew 12 secs ago
 
2:10 PM
TTGTW
 
Oh you young people and your acronyms
4
 
1
Q: Implementing a Generic Quick Sort With Various Optimzations

Luis AverhoffI decided for educational purpose to make a generic sort like the one in the standard library as an exercise for my self in learning more about how to do generic programming in c and so I would really appreciate it if you guys could tell me how I could have done a better job and what other variou...

 
2:27 PM
@200_success now congrats to 100K !
@Legato thats what I wanted to do as well but had been on the phone ;-)
 
Thank you!
 
so now what?
Swag?
 
I was thinking of putting bounties on some worthy zombies. Any suggestions for which questions?
 
I'm sure we can think of something.
 
but swaggggg
maybe you can get a CR unicorn painting?
3
Bounties are fine too ofc but this is a milestone of sorts
 
2:42 PM
5
Q: Function outcome: consistent approach and easy logging

Jake MMy goal is to make a consistent and easy way to determine how a function fails/succeeds. I'm looking for code review of my Status class for any bad practices, code that isn't thread-safe and general improvements and changes. For logging and debugging I always needed to know how a function failed...

> asked Dec 26 '15
One answer, current vote count on that is 0/-1.
 
This question is better suited for Code ReviewLuis Lavieri 18 secs ago
 
3:01 PM
This isn't a very specific programming problem. If you want someone to give you feedback on working code, you can try Code Review. You should start by profiling your own code first. And when asking for help, you should include a reproducible example with sample input that can be tested. But you should also isolate the problem and share the minimal code necessary to re-create the problem. — MrFlick 29 secs ago
 
0
Q: Optimize store proc performance being called in c# on array loop

PapiI have a c# application(mvc) that allows a user to upload an excel sheet containing an account number key and amount value to be passed as parameters to a proc that then validates those records, the proc then return an error or warning if any are found. My issue is that the BI team implemeted a p...

0
Q: How to check if an exe is open or closed

TatsuI did this code and I put in a timer in order to check if the exe is open or closed. I create a class and put it inside and then call it after in Winforms. Here is the code private static WINDOWPLACEMENT GetPlacement(IntPtr hwnd) { WINDOWPLACEMENT placement = new WINDOWPLACE...

 
3:29 PM
@CaptainObvious Broken.
 
0
Q: Fatal error: Call to a member function prepare() on a non-object

Abed IlyesHello i made a website and i have a problem in Login.php and Register.php !! It's the same. PROBLEM IS IN THE LINE N°6 : Fatal error: Call to a member function prepare() on a non-object in /home/a7278696/public_html/login.php on line 111 { $errors[] = 'Please fill in all fields'; ...

 
@CaptainObvious Very broken.
 
What bug are you having? If none, this question would be better in Code Review: codereview.stackexchange.comRobotic Cat 14 secs ago
I'm voting to close this question as off-topic because it is not a programming problem but a Code Review request. It would be better on Code Review: codereview.stackexchange.comRobotic Cat 35 secs ago
 
3:53 PM
@Pimgd I read that as "get a CR union going". I thought to myself: "I'm not joining no frikkin union."
 
I really need to close some tabs, opening new ones is taking 10 seconds for days already, it's starting to get on my nerves
700 tabs now, it was working fine with 2000, not really sure why it's an issue now
 
4:17 PM
0
Q: Finding the indices of multiple words in a string

T145In response to a recent SO question, I answered with the following code, and was wondering if anyone had any input on it. I'm always looking for an opprotunity to learn! import java.util.HashMap; import java.util.Map; import java.util.Stack; public class WordFinder { public static void mai...

 
@DanPantry If FieldRep is null, the Equals part will never be evaluated.
 
@Hosch250 Yeah, I get it now
 
4:45 PM
@skiwi try to get it down to, say, uh, 7
monking!
 
@skiwi Check the uptime from your machine. If it's over 3 days, reboot.
 
checks own uptime
> 15:01:24:40
 
0
Q: Inherited a big piece of legacy code, not sure what to do

Eats IndigoI've inherited a piece of legacy code that's pretty huge, and I've no idea how to go about breaking it into smaller pieces, and how to make the DB queries more efficient. The project is built on a vanilla python backend with no ORM, hence raw SQL queries, the purpose of the function is to totali...

 
@Mast Shutting it off every evening, so that's no isue
 
5:08 PM
@skiwi Check it anyway.
You'll see.
 
Huh
 
^^
 
> 17:05:52:10
Is that bad?
 
In Windows 10, shutdown doesn't shut down.
@skiwi With how you handle your tabs, probably.
 
Isn't that since UEFI motherboards?
 
5:09 PM
If you really want to shut down hard, use shutdown /s /t 0
/s is the trick, /t 0 simply tells the system to do it now.
 
I heard del C:/system32 also works for a real hard shutdown
 
It probably won't allow you :-)
 
Hmm... only running Hearthstone and Firefox right now I'm using 7,8 GB RAM
No need for this cumbersome method. Just hold Shift while initiating the shutdown and you're done. Shift Reboot brings up the Advanced Startup Options screen. — Daniel B Apr 22 '14 at 13:11
@Mast This should work too ^^
 
@skiwi That only works for reboot IIRC, not for shutdown.
A reboot is always a full reboot on my system.
Anyway, reset that uptime and you'll be fine for a while.
 
Hmm, it might fix the issue though
Resetting uptime that is
 
5:17 PM
Yes.
Incorporating a full shutdown in your daily shutdown routine would fix it long-term.
A reboot fixes it for today :-)
 
Would probably be a while until the full 16 GB RAM would fill up when not opening any program ;)
So there's nothing wrong with having 700 tabs open, cool :)
 
A system with a non-full RAM can still bog down.
Don't ask me why.
I don't know a thing about computers.
 
                var filteredItems = items.Where(item =>
                    (item.CreatedBy != null && item.Username.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0) ||
                    (item.UpdatedBy != null && item.Username.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0) ||
                    (item.Code != null && item.Code.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0) ||
                    (item.Date != null && item.Date.cToString().IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0) ||
what the
3
 
@skiwi Just x out of the browser, it will set you free... to make a brand new 700 tabs.
 
@DanPantry f?
 
5:25 PM
this is in the controller layer. moving it to the model layer, at least, holy crap
 
@DanPantry Oh crap.
That could use some serious refactoring.
 
        var filteredItems = items.Where(item => item.ContainsString(filter));
sweeps under the rug
I'm not sure why this has to be a oneliner, or is trying to be one, given that it spans 10 lines.
 
This code dump recently had an explanation added. I've undeleted it. It could benefit from some positive reinforcement.
-4
A: Print 10 × 10 square of X and O characters, split diagonally

mcgooberEach line of your output is the same as the previous but with one character different. Thus a StringBuilder can be used to hold the string such that it can be manipulated. The StringBuilder can be converted into a String at any point for display purposes. StringBuilder sb = new StringBuilder("O...

 
you are not helping, resharper.
2
@200_success upvoted :)
 
Retracted downvote and upvoted. Now it's on 0.
 
5:34 PM
@DanPantry So messed up even resharper cannot save it anymore
 
@DanPantry Are you trying to refactor that to be easier on the eyes?
 
@user2296177 I'm trying to refactor it so it doesn't look like a 10 line ternary
:P
        public bool ContainsString(string criteria)
        {
            return (CreatedBy != null && Username.Contains(criteria)) ||
                (UpdatedBy != null && Username.Contains(criteria)) ||
                (Code != null && Code.Contains(criteria)) ||
                (Date != default(DateTime) && Date.ToString(CultureInfo.InvariantCulture).Contains(criteria)) ||
                (Type != null && User.Contains(criteria)) ||
                (Type != null && Type.Contains(criteria)) ||
This is a bit better, I suppose
i have no idea why (Type != null && User.Contains(criteria)). This is why you don't copy pasta code, kids!
 
@DanPantry Can you make the first condition into one? What I mean is:
 
I think the better solution is to torch it to the ground.
2
Or use elasticsearch, because this is doing very inefficient searching
 
public bool ContainsString( string criteria )
{
	return ( ( CreatedBy != null || UpdatedBy != null ) && Username.Contains( criteria ) ) ||
		( Date != default( DateTime ) && Date.ToString( CultureInfo.InvariantCulture ).Contains( criteria ) ) ||
		( Type != null && User.Contains( criteria ) ) ||
		( Type != null && Type.Contains( criteria ) ) ||
		( Result != null && Result.Contains( criteria ) ) ||
		( Reference != null && Reference.Contains( criteria ) ) ||
		( Notes != null && Notes.Contains( criteria ) );
 
5:38 PM
I could do that, but I don't think that's really all that much more legible
 
I guess not.
 
wait, what
oh my word
UpdatedBy != null && Username.Contains( criteria )
 
lol
 
why does it check if UpdatedBy is not null and then check another variable?
I quit
 
That's why I was telling you to merge it into one.
 
5:39 PM
I am done making sense of this code. I'm going to go get a tub of icecream. And cry into it.
 
I smell a copy/pasta chef
2
 
@Mat'sMug The author does look a bit familiar
 
@Mat'sMug Copy pasting code is the microwaving frozen food of the programming world?
 
Copy pasting code is even more lazy that microwaving frozen food
¯\_(ツ)_/¯
Copy pasting is fine and dandy for hacking about but for the love of God, clean up your mess before you push to master
 
0
Q: Cluster/Group nodes

user12282Hi I would like to know if there is a proper algorithm to cluster/group nodes for the example below: I have DB records with the following structure: per_id com_id 1 1 2 1 2 2 3 2 3 3 4 3 5 7 5 8 6 7 As output I would like to gro...

 
5:44 PM
@CaptainObvious make this go away please
 
More dead horses?
 
0
Q: Today I didn't pass the test task for the position C++ junior/middle developer

Little nonamerWhat i did wrong? Please help improve myself. Task: Description. Write a template class - an array of any type of data, and tests to demonstrate the work with this class. Should be implemented all the methods also acceptable to extend the functionality. Tests: The solution s...

 
We hate other people's code if it's part of a functional codebase but we love people's code if it's a @StackOverflow answer we can paste 🤔
 
@DanLyons to be fair i've never seen a highly upvoted SO answer with a 10 line ternary which doesn't even work properly :P
 
6:00 PM
@DanPantry sounds like a challenge
but I don't hate other developers that much
 
@DanPantry To be fair, that things that get upvoted puzzle me sometimes.
 
As you mention, query works so this should be asked on CodeReview as folks there will eat your question up with excellent comment to optimize since so few questions are asked on the site compared to here. Second page for some tags like [sql] go to 2 months ago, not 2 hours ago! — Parfait 33 secs ago
 
-2
Q: Can someone help me in understanding this Bitwise Operation in C#?

ThePerceptConsider the code example below to Display bits within a byte using System; class ShowBits{ static void Main(){ int t; byte val ; **val=123**; for (**t=128**;t>0;t=t/2){ if((val & t) !=0) Console.Write("1"); if((val & t) == 0) Console.Write("0"); } } // The Output is : 01111011 } ...

 
@DanPantry FWIW that thing you have there is not a ternary ;-)
 
@Mat'sMug it's even worse, then =.=
 
6:15 PM
it's just a very very long predicate
I'm guessing you're not on C# 6?
 
@Mat'sMug we are, actually
what's your suggestion?
 
someone needs to pay for this
3
 
For Code Review questions go to this stack exchange: codereview.stackexchange.comhttpNick 53 secs ago
 
    public bool ContainsString( string criteria )
    {
        // not *exactly* the same thing. adapt as needed, copy/paste at your own risk
	return (Username?.Contains(criteria)
            || Date?.ToString(CultureInfo.InvariantCulture).Contains(criteria)
            || User?.Contains(criteria)
            || Type?.Contains(criteria)
            || Result?.Contains(criteria)
            || Reference?.Contains(criteria)
            || Notes?.Contains(criteria)) ?? false;
    }
 
ah yeah i was trying to use that operator but i gave up after realising half of the code didn't work
=.="
 
6:20 PM
@Mat'sMug you'd probably need to add a ?? false so the return type is still a bool instead of bool?
 
btw what's the point of falling back to default(DateTime)?
@DanLyons probably
 
@Mat'sMug the original code was Date != null, so I just corrected that to default(DateTime) without thinking
 
and the .Contains after the .ToString needs the ?. operator :)
 
wouldn't Date?.ToString jump out right away? that ToString can't return a null
 
@Mat'sMug idk if you're responding to me, but i literally just looked at the code and went "well, that's derp, DateTime can't be null" and left it at that :P
 
6:23 PM
gah
then just use a DateTime? and use null to mean "NO VALUE" instead of default(DateTime)
 
0
Q: JavaScript async functions queue approach

AzevedoI wrote this queue object to handle async functions in JavaScript. I'm not sure if this is a correct approach. Is this steady enough to run on nodeJS or it may fail/fault? var queue = { callbacks: [], start: function(){ this.callbacks.reverse(); // FIFO this.callbacks.pop...

 
@Mat'sMug I know how it should work.
 
you mean how it should work
 
This is not code I wrote, the only thing I changed was date != null to date!= default(DateTime)
 
...did it even compile?
 
6:26 PM
Yep
 
so date is a DateTime? nullable
 
Yes
CreatedBy?.Contains(criteria) || UpdatedBy?.Contains(criteria)
 
(that question mark was part of the type)
 
on the other hand, does not
Can't apply || to bool? and bool? apparently
which does make sense, sort of
 
in my defense, there was a disclaimer in that snippet
 
6:27 PM
:P I know
 
and I've only ever used the .? operator here in The 2nd Monitor.
fwiw ContainsString is probably a bad name
 
Originally, date was DateTime and checking if it was not null compiled (for some reason?)
what would you suggest instead?
i'm quite short sighted so I don't c# :^)
5
 
lol
 
hmm then R# was saying "expression is always false" or something like that
 
Yes, that's what prompted me to change it from date != null
 
6:29 PM
@DanPantry Made me laugh more than it should have.
 
In all seriousness I am short sighted @user2296177 :)
 
ironically I'm probably more short sighted than all of you =)
 
@DanPantry Myopia's great.
 
You're a mug, you don't even have eyes @Mat'sMug
2
 
@DanPantry see? told ya
@user2296177 IDK, for me myopia's too blurry to see how great it is
 
6:33 PM
@Mat'sMug That's the pessimist's view. For me, it's too blurry to see how bad it is.
 
your dad jokes are awful
 
@DanPantry that's a tautology
 
almost as bad as this spotify discover weekly. my word
 
@DanPantry Mine is terrible this week as well.
 
7:01 PM
0
Q: Small portfolio project with sliding content

kr099I've done a small portfolio project and I'm looking for some review, especially of: HTML markup, CSS/Sass, animations used, media queries. What could been done better? Thanks for help in advance. Here's a pen. HTML <div class="container"> <ul class="projects-list"> <li class="project">...

0
Q: Diameter of a binary tree in java

PradeepI wrote this java code to calculate the diameter of a binary tree. Are there any cases for which this code might fail? class BST{ ...... int diameter=0; ..... public int diameter(BST t,Node root){ int left, right; if(root == null) return 0; left = diameter(t,...

 
Welcome to CR! You might want to include your actual BST class. As it stands reviewers are left making a ton of assumptions, which isn't ideal. — Mat's Mug ♦ 9 secs ago
and Node I suppose
 
7:24 PM
Thanks Patrick, I've updated the question with more detail. The 'My Code Reviews and Requests' and 'Incoming Requests' selectors are slow; the others are fast. Unfortunately we use this tab to identify incoming requests so simply using the fast selectors isn't an option. The problem started happening overnight leading me to believe that build up of code review data isn't the problem e.g. it's like the update pulled an index of a critical database table for instance. — ScheuNZ 23 secs ago
 
1
Q: Find tags in text for replacement, my brute force solution

JensBI have a text such as string text = "Hi [img-2] tst[img-3] test ttteessstt grawr[img-1-800]tet"; I want to find img tags in the text and get their id (second value) and possibly the third value if it exists. string text = "Hi [img-2] tst[img-3] test ttteessstt grawr[img-1-800]tet"; var th =...

 
7:42 PM
Interview starting in about 20 minutes.
@DanPantry Have you been looking through RD's codebase?
That looks like some of the inspections :P
 
shhhh
(some of the inspections are way worse than that!)
 
You should ask this on Code Review instead. — vaultah 31 secs ago
Off-topic because it is a request for code review — khelwood 46 secs ago
You should describe what it does, have a title that tells reviewers what problem the code is solving, and yes, ask on Code Review instead. Voting to close as too broad because code reviews are, well, too broad for SO. — Mat's Mug 39 secs ago
 
Starting!
 
8:03 PM
0
Q: Grid displayer: Game of Life and Langton's Ant

CaridorcRe-use Given that both the Langton's Ant and the Game of Life use a grid, I decided to code a generic grid_diplayer code and use it both for GoL (Game of Life) and Langton's Ant to put into practice the principle of code re-use. Rules of Game of Life Rules of Langton's Ant Pure logic The cod...

 
Hi people! Am I really the first to post a question about the Langton's Ant, or did I just not menage to find a previous one? It looks like a common and easy problem in CS
 
@Hosch250 No
 
0
Q: Compute Gregorian year from given number of days since day zero

aschipflI am working on a batch file for doing date/time maths. One challenge is to determine the (proleptic) Gregorian year from the given number of days that have elapsed since day zero (that is, 1st of January, 0000 AD, 00:00:00 o'clock), particularly when regarding leap years. As per definition, a y...

0
Q: Group By and Sum using Linq

JamesI am trying to groupby UWYear (these are columns returned by the sp_GetRelationshipExperience) while summing up the other columns. Here is what I orginally had but I need to groupby and sum u. This works perfectly otherwise public IList<RelationshipExperience> sp_GetRelationshipExperience(int ...

 
8:19 PM
seems sp_GetRelationshipExperience kinda defeats the purpose of abstraction levels here... the fact that you're calling a method vs. executing a stored procedure should be a sign.
 
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Compacting code for World's Hardest Game remake
 
I don't know if it went too well...
I was never really stumped, but I just have a feeling.
 
@Mast Hard reboot didn't fix the issue :| In Firefox it's just stuck on loading site X (external resource for example) for quite a while
Chrome is magic and instant
Even Internet Explorer is faster than my Firefox at the moment
 
monking
 
8:39 PM
0
Q: Python 3 can I simplify this script

Samuel TerrettThis program tells me what lessons I have tomorrow then emails them to me This program works fine, but i was wondering whether there is a way to simplify the script or make it more efficient. I have removed my email and password and who it is to for privacy, but it does work. Thanks in advanced ...

 
What is "the application procedure" and what makes you think that something might be wrong? Do you have a working program and are looking for some code review? — flatmouse 1 min ago
 
Hi, @EthanBierlein.
Long time no see.
 
Yeah, it's been too long.
 
Apparently I made a mistake in my interview.
They asked what my hobbies were, and I said reading and programming.
My mom said they were trying to figure out if I had a life, and I should have told them about my walking/biking. I'd forgotten about that for the moment.
 
Why would the interviewer care anyways if you "had a life" or not?
 
8:46 PM
Just saw GetAsync().Result. noooooooo
 
@EthanBierlein Because work can be a social environment, I suppose.
 
Hi @EthanBierlein Welcome back
 
Hi @Caridorc
 
Should this be on code review? — vgoff 45 secs ago
 
I've read that employees who have a life are more stable and more reliable.
 
8:52 PM
Maybe, I've never used code review....I'll look into it — matthewalexander 32 secs ago
 
Employers are kind of wanting people that have more diverse interests
Not sure how much of a negative it is though if you either don't mention it or don't really have it
 
@Hosch250 there are other ways to see it. they could also see you as someone passionate about what you do - and that's also very valuable IMO
 
Well, they said they have a hard time getting people to come out to the location.
 
@LightnessRacesinOrbit I applied, but when I interviewed myself I decided I wasn't suitable for the position :p — Benubird 2 hours ago
^^
 
I've been wanting to move out to that general area, but wondering if I could get a job...
 
8:58 PM
@Mat'sMug and RubberDuck I love what you are doing with Rubberduck. Please keep it up. Certainly my life is easier because of it (I happen to do a lot of small programs and prototypes in Excel VBA). BTW, the Rubberduck mention in my post was just me trying to be nice to RubberDuck himself, which in turn has been nice to me here in PE. :) — carlossierra 15 mins ago
#MakesMyDay
 
00:00 - 21:0021:00 - 00:00

« first day (1221 days earlier)      last day (2789 days later) »