« first day (1200 days earlier)      last day (3116 days later) » 

00:00
RELOAD! There are 2630 unanswered questions (92.8334% answered)
@user2296177 nice
 
1 hour later…
02:07
0
Q: how to insert quick sort in this function?

user6712868 void display_all() { account ac; ifstream inFile; inFile.open("account.dat",ios::binary); if(!inFile) { cout<<"File could not be open !! Press any Key..."; return; } cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n"; cout<<"===============================...

02:31
0
Q: django class based view URL API

deltaskeltaSo I kind of started making an API for my site in a django class based view because it seemed logical and now it has gotten quite large and unruly and I am starting to wonder if I am doing this correctly... class URLAPI(View): def get(self, request): if request.GET.get('param') ==...

03:13
codereview.stackexchange.com is a better place to request comments on the style of working code. SO for help fixing problems. — Barmar 56 secs ago
0
Q: GUI Elements for pygame games

Mr.PythonI've been making games using the Pygame module, recently. I've noticed that Pygame has no builtin GUI elements. So to save time for me(and hopefully other people), I have created some very simple GUI elements. buttons, labels. The button module was the first to be created, and is probably the mo...

03:51
1
Q: Scale the ingredients of a recipe up/down

Rick ViscomiI wrote a React app to adjust the serving size of a recipe. For example, if the recipe serves 4 people and requires 4 eggs, scaling it down to serve only 1 person should only require 1 egg. I try to also keep the units singular/plural accordingly while converting units when they become too big or...

-1
Q: Can it more Pythonic?

钟远辉#!/bin/bash/env python3 import copy def coinChange(): amount, coins = int(input()), list(sorted(map(int, input().split(sep=' ')))) min_package = [x for x in range(len(coins), 0, -1)] min_sum = sum(map(lambda x, y:x * y, min_package , coins)) if amount < min_sum: print('N...

 
1 hour later…
04:56
Monking
Monking
Morning. Happy Tuesday to you!
Happy Tuesday to you too ;-)
I think I'd better go to bed. Enjoy the solitude ;)
sleep well
@Heslacher Monking.
05:08
hey @EBrown
Howsit eh?
The same old....
morn
does anyone knows is there a Apache Commons method which I can write this two lines in a single method?
String str = "";
if(str.subString(0, str.indexOf('x')));
05:10
@EBrown yes, looks good
^ This might actually throws an IndexOutOfBounds
This will throw for sure
but not really an IndexOutOfBounds. I guess some kind of ArgumentException because indexOf will return -1 hence calling subString will throw
@EBrown Would be nice if one could sort the avaible sites by e.g answercount questioncount etc.
@Heslacher Yeah, I need to add some stuff to it like that.
05:37
@Heslacher yes. I had actually missed this scenario in my test cases
I just wonder is there any way that I can avoid making the code to throw exceptions in this case
@Heslacher I updated the graphs a bit.
I am looking for a way that I can set a default value if the looking x is not in that given string
@EBrown looks good. Are you sure the values for Users is correct ? For Code Review on 31th of July it shows -50
@Heslacher It's what SE reports. Could be roomba.
@CrazyNinja this looks strange as well. subString() returns a string but you use it as a condition. Does this compile ?
05:54
@Heslacher yeah. It doesn't. my bad, typo
Make all these values nullable I said.
It'll be good, I said.
False, it's terrible.
So much broken.
All better. :)
@Heslacher @Hosch250 I updated the graphs and raw data. If the value is undefined, it's not shown.
06:15
@DanPantry If you're ever around when I'm on, I need your help.
It's JavaScript so I've already tried everything I know.
06:47
First of all, C is not C++, and vice versa. Second, for the C++, I guess Microsoft implemented something that checks your code conformance to Support Guidelines. For the second and third point, you can ask on Code Review. Be sure to read help center. — Olzhas Zhumabek 34 secs ago
07:18
I think codereview.stackexchange.com would be a better fit for this question. — spickermann 36 secs ago
possible answer invalidation by pythonLover on question by pythonLover: codereview.stackexchange.com/posts/138736/revisions
I'm voting to close this question as off-topic because it belongs to codereview.stackexchange.comspickermann 43 secs ago
Ok fine. I'm not aware of code review site, will see you there.. — tumati 41 secs ago
0
Q: Send newest file as attachment with gmail

B. MourrierI am struggling to find a solution to send by email (with gmail) the latest/newest file located in a directory as an attachment. For the moment I achieved to send e-mail with gmail (see my script below). Can anyone help me out and gives me tips / lines to add to this script, to attach the newest...

@EBrown what's up?
@ArukaJ I appreciate it's confusing, but put it this way: If you have all those variables names for example, someone will form the basis of a review on it, at which point you will respond "Oh, it's just example code, that's not present in the real code". It wastes everyones time. This is excluding the fact that real code actually has context.
07:46
This is off-topic, right ?
Monking
@Dex'ter Asking to add features, off-topic
@JoeWallis yep. Just wanted to make sure
@JoeWallis I got to do that hashing thing eventually
@Dex'ter That's good, I thought you managed to figure out a way to do it on the last message, that's why I didn't respond...
Still got some errors at that point, but I wasn't using os.path.join when I actually should've ^_^
@DanPantry I want to live sort a bunch of <div> elements with JS.
07:54
Sorry to hit you with so many warnings here but this short chunk of code is so full of serious problems I can't not mention them. Yes, if you're writing an encryption method you must have a doctorate in cryptography or you'll get something wrong, I'm not even kidding here. Even experts make huge mistakes, that's why they always have their code reviewed by others. — tadman 53 secs ago
@EBrown oh dear
use a template framework, don't try and do that in raw js
@DanPantry Yeah. Basically, I want to sort everything on this page by certain properties.
check out this library
But without refreshing.
it's fairly small, 6kb
it'll also handle any other template binding you have
the solution is to split the data from your divs and order the data, and just let the visual representation reflect that
<div rv-each-item='item | orderBy: someProperty'>
  ...
</div>
07:56
That sounds like a PITA.
it's a lot nicer than the alternative :)
@DanPantry What if I want a drop-down with each property?
item | orderBy: someProperty is an expression, so someProperty could very easily point to some value in memory that backs a drop-down
Tumbleweed candidate; zero score, no answers, no comments, and low views: Min Heap Implementation
Is there anything less painful? I remember rivets and I hate it.
08:00
Well, you could maintain your own data representation in memory and do model binding yourself....
For some values of "less painful"
Oh snap, I think I found my answer.
Zak
Zak
Monking @all
I’VE HAD AN IDEA WE’LL TAKE ALL THE BAD CODE BUNDLE IT TOGETHER AND SELL IT TO VCS AS A COLLATERALIZED TECHNICAL DEBT OBLIGATION
That one speaks to me ^^
Monking @all
Zak
Zak
@Mast Monking
@CaptainObvious Broken.
08:08
Monking @Mast
Napalmed
wtf
my font-face won't render in chrome
just.. none of the font glyphs show up
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
08:25
I'm voting to close this question as off-topic because it is about code review. — Manu just now
1
Q: Node.js MySql code using Promise API

Rahul ShivsharanI have written a javascript code for fetching data from mysql database. I have used connection pooling, and Promise API also. the code is as follows, var mySql = require("mysql"); var Promise = require("promise"); var pool = mySql.createPool({ host : "localhost", user : "root", password...

0
Q: WA for QUADAREA - Maximal Quadrilateral Area Spoj

sarvajeetsumanYou need to build a house of maximum possible area with four available walls a,b,c,d. question link spoj. I have implemented this question in C, but I am getting wrong answer. Please review my code. #include <stdio.h> #include <math.h> int main(void) { int t =0; scanf("%d",&t); whil...

0
Q: Efficient way to create multi-dim array from coursor

MaMuI'm executing a cursor. I have cutted off the code how the procedure is called and executed. This part is efficient. At last I have a a not big cursor. I'm calling the procedure, which returns this cursor many times on the page and I need to create a multidimensional array from it. This array sho...

09:11
meh, any C++-aware human here ?
@Dex'ter Sorta on both "C++-aware" and "here".
I get a weird error here: dpaste.de/zF8h
> Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) ConsoleApplication1 \ConsoleApplication1\ConsoleApplication1\MSVCRTD.lib(exe_main.obj) 1
Since I learnt templates and classes I have such problems that I didn't have before ):
I think it's because of the template declaration above main.
What do you mean ?
template <class T> above int main() might be doing it.
09:16
So what are you sayin' is moving it below ?
Remove it maybe?
I'm just guessing, I've never used templates.
I think a more appropriate site for this question to be a site codereview.stackexchange.comBWA 25 secs ago
@Heslacher Added sorting. ;)
great
@EBrown meh, I'll try it when I get some XML processing done in Py ^_^
09:24
remove the template
you're making main generic, which gcc doesn't like
at least thats how I interpret it
GJ. What did you do? @EBrown
@DanPantry Used something called List.js.
It was actually really easy to setup, and pretty quick as far as processing speed too.
Quick enough that the sorting can be live without a major slowdown.
@DanPantry the purpose of the program is to dinamically allocate a template ^_^ if I remove it... well...
@Dex'ter Yeah.... but that doesn't make sense on main lol
main is not generic
there can be only one main method and that must be int main(), it can't be int main<T>() (which is what your template does)
what do you mean 'dynamically allocate a template'?
09:38
0
Q: Finding prime numbers exercise

Herman Tam Create a program to find all the prime numbers between 1 and 100. One way to do this is to write a function that will check if a number is prime (i.e., see if the number can be divided by a prime number smaller than itself) using a vector of primes in order (so that if the vector is c...

damn it, how do i even read this article
In mathematics, a partial equivalence relation (often abbreviated as PER, in older literature also called restricted equivalence relation) R {\displaystyle R} on a set X {\displaystyle X} is a relation that is symmetric and transitive. In other words, it holds for all a , b , c ∈ X {\displaystyle a,b,c\in X} that: if a R b {\displaystyle aRb} , then ...
I need a Computer Science for Dummies
Zak
Zak
> It’s common to hear developers get so frustrated about working with a piece of code they run ‘git blame’ in a fit of rage to figure out who wrote that mess, only to find it was themselves.
3
Yep, that sounds familiar.
literally happened yesterday
09:53
@DanPantry I might help you
a colleague who studied maths explained it..
basically in english it's saying that partial equivalence is when:
1. if `f(a, b)` then `f(b, a)`
2. if `f(a, b)` and `f(b, c)` then `f(a, c)` must hold true
Yeah, that's right. The reason for it being written like that is that those relations can hold for many different things. Such as matrices, or even shapes.
and absolute equivalent is the same as the above, except that f(a, a) must also hold true
coffee + water + sugar = sugar + water + coffee
it absolutely does not
>:(
09:58
I meant coffe powder or something >.< Beans?
Our professor introduced us to the set of real numbers in [0, 1]. Eg all real numbers from 0 to and inclusive 1. Then he defined a equivalence relation, basically defining 0 ~ 1. Eg 0 and 1 are the same elements. Which basically make the number line [0, 1] into a circle.
We thought he was crazy until he said it was important for our topology exam. Then we accepted his gospel as the one and only truth.
I broke my SQL server.
Oh carp.
Nope, just my worthless internet like usual.
"you f***ing donut, of course you don't microwave a salad"
oh gordon ramsey, you have such a way with words
Why did the chicken cross the road? Because you didnt **** cook it.
10:09
0
Q: C# TCP Server with Tasks

nullHello I'm writing a TCP Server using Tasks and I wanted to know if there's something I can improve and how am I doing. On ConnectionHandler.cs : public class ConnectionHandler { private List<TClient> CLIENT_LIST; private TcpListener LISTENER; private const int PORT = 8080; pri...

s/ramsey/ramsay
This was kinda neat. They take a disk and basically define a equivalence relation on the boundary (all the blue points). Turning it into a sphere.
Basically saying that all the blue points are the same point :p
10:24
@DanPantry When you find one, let me know.
I've been looking for something like that for quite some time now.
@DanPantry Put the salad next to the idiot and you got an idiot sandwich deluxe.
use std::thread;
use std::sync::{Arc, Mutex};

fn main() {
    let vec: Vec<i32> = vec!(1, 2, 3);
    let shared = Arc::new(Mutex::new(vec));

    let clone = shared.clone();

    let join_handle = thread::spawn(move || {
        // Why can't we try here?
        let mut data = clone.lock().unwrap();
        data.push(5);
    });

    // TODO: why we can't we use try! here?
    // JoinHandle's join() return value seems to be a different 'type' of Result.
    join_handle.join().unwrap();

    let clone = shared.clone();
This code seems so hacky, and I have so many questions.
like, why can't I try!(join_handle.join())? join_handle.join() returns a result, but rust yells at me about something to do with (), presumably because join_handle.join() returns Result<T> and not Result<T, E>..
@skiwi ?
And why is there no 'neater' way of getting the wrapped value of a Mutex other than unlocking the mutex then dereferencing the unwrapped value (which I also cannot use try! on) :(
(Because clone.lock() returns Result<MutexGuard<_, Vec<i32>>>, so clone.lock().unwrap() will give me MutexGuard<_, Vec<i32>>, not Vec<i32>)
What's that, Rust?
Yep
the type system is really cool, if a bit.. unintuitive
On one hand, it makes sense that Result<T> should not be transitive with Result<T, E>.
On the other hand, why is Mutex using a different type of Result in the first place
No, it still doesn't make sense. :P
Mutex.lock() returns Result<Guard, PoisonedError<Guard>>, so I should be able to try! it
0
Q: Why can't I try! Mutex.lock?

Dan PantryI'm trying to play about with multithreading in Rust and I've come across something I'd consider rather trivial. Here's the code snippet: use std::thread; use std::sync::{Arc, Mutex}; fn main() { let vec: Vec<i32> = vec!(1, 2, 3); let shared = Arc::new(Mutex::new(vec)); let clone =...

10:49
SOHVA
@DanPantry you did define a vec before that already....
let vec: Vec<i32> = vec!(1, 2, 3);
^^ I'm sure that one is not a MutexGuard<T>...
0
Q: Correct way to initialize variables in PowerShell

JohnLBevanIs there a preferred practice around initialising variables which are first defined within a branch of code, or is this purely subjective / personal preference? i.e. there are multiple ways this can be done; the most obvious of which are below: #option 1 [string]$path = '' if ($ENV:PROCESSOR_AR...

@Vogel612 Shadowing makes it work out fine
you can shadow previous variables with different types in Rust
The real issue is that I was using try! in main.
try! enforces the enclosing method to return Result, but main must have the signature fn main() -> ()
Hence the confusing error message
0
A: Why can't I try! Mutex.lock?

Dan PantryRunning the 'explain' on rustc will explain this error - I thought I already had, but I guess not. This error occurs when the compiler was unable to infer the concrete type of a variable. It can occur for several cases, the most common of which is a mismatch in the expected type that the compile...

Rust's compiler explains this
Also, props for such a good explanation built into the compiler
Although I'm not sure why try! forces the enclosing method to return Result<T, E>, frankly
Why would a statement force something onto it's enclosing scope???
Well, if you use await in C# for example you must use async in the declaration and return Task<T>.
It doesn't make much sense to me though because here is the expanded code after try..
    let vec =
        match clone.lock() {
            ::std::result::Result::Ok(val) => val,
            ::std::result::Result::Err(err) => {
                return ::std::result::Result::Err(::std::convert::From::from(err))
            }
        };
11:02
why do you have to convert the error?
it may be a nonstandard type or something
Ahh, that's why
the return does not apply to the Err(err) => {} block
it applies to the enclosing method
that's.. a bit confusing. and surprising
I should've figured. yet you cannot return from main, can you?
11:17
Why not?
In C-style languages you can return from main with a status code to indicate whether everything executed correctly (assuming you check whether it did and throw a different status code if anything fails).
The famous return 0; you see in many mains.
2
Q: Is it ok to return in main?

Syntactic FructoseSince mains return type is an empty tuple (), is it considered a work-around to use return; in fn main() ? I'd like to end my program but don't want to panic! , I just want to calmly end. Is there a standard way to end main early? Or is this ok to do? I come from a C++ background where if you nee...

Although you usually use std::process::exit() IIUC.
@Vogel612 Yes, you can.
Its just you can only return ()
(empty tuple, basically rust's void)
11:54
wow, rust is hard
or I'm just stupid
:P
LMFAO
my landlord just text me
Why not both?
"can you move out by the end of the month? I may be able to extend it by 2 weeks"
My contract says he has to give me 1 month's notice
and he's giving me 2 weeks
lol
Didn't you give him notice earlier?
I gave my work notice I was resigning
for the 16th september
I'm in an AST
> they’ve given you at least 2 months’ written notice that they want the property back (‘notice to quit’) and the date you must leave
So your boss is SOL.
12:05
Yeah, but it's my landlord being a douche
Zak
Zak
How long do you still need to be around for?
at least until 16th sept
that's when my exit date is for work
My colleague has offered me temp lodging in case this happened anyway
How did your landlord figure out you are moving?
He didn't... he just wants someone in who will pay more for the crappy place he's renting
He knows I got the Riot job and I would be looking to move out middle of September, but I offered to pay the full September term so I would have 'ownership' of the flat until the 25th September
UIElements are laid out in the order they are introduced in the xaml. If they overlap, the later elements will be on the top of their successors. Otherwise I'd suggest a code review, the design is "interesting". — aQsu 36 secs ago
12:11
Instead he's deciding to try and get rid of me at the end of September, which makes him lose money and me get screwed over
Not much to say until the relocation situation gets worked out with Riot, though
I suggest causing a riot with your landlord
lol :)
Well, I would like to have my deposit back, though knowing the landlord he'll likely try and take every single bit of it he can...
s/end of September/end of August
I lost 108 euors of my depositum when moving out. So yeah
Will remember to take pictures when I move in and out next time
I don't mind losing some of the deposit
But it's £570, equiv to a month's rent
OOTH if I have to move out at the end of August that saves me £570 rent
...but then I have to obviously find somewhere else to go in 2 weeks, which will be hard
12:14
Especially seeing as I have no holiday off..
Should the landlords duty to find a new atendant.
Because if I am being kicked out at the end of August but I don't move until 3rd week of September that's 3 weeks of not having somewhere to live :P
and I have to stay in my current area-ish until 3rd week of September anyway because I am still contractually obliged to in work
This is going to be a fun few weeks :)
Live on the street
"Will write JAVA for food"
2
Had to pay double rent for three months (500 euros x 2) because of a shitty land lord. Why are some people so dirty?
12:17
Money.
I'll just have to see how the Riot offer pans out. I should have something today, but this severly reduces my negotiation power.
Zak
Zak
@DanPantry If it's in your contract that they have to give you a certain amount of notice, and they're trying to shorten it, just tell them no.
@DanPantry Riot doesn't have to know. I think you can afford to bluff a bit
also... what Zak says
Maybe Riot told your landlord to increase their negotiation power.
@N3buchadnezzar grabs tin foil hat
0
Q: Basic Array based stack in java

jillianHere is an array based stack. I tried to implement this basic stack from memory. I want to make sure it is correct. import java.util.*; public class Stack{ private int[] stack; private int size; public Stack(){ stack = new int[5]; int size = 0; } public Sta...

12:44
Since you apparently do not have a problem with your code, this question would be a better fit for the Code Review site than this one. — Rory Daulton 18 secs ago
If you have working code which merely needs improvements then you're probably in the wrong place with this post. Code Review is where they handle existing / working code and do their upmost to improve it in terms of speed, security, sustainability, and longevity including best-practices. Give it a try. They're good! — Ralph 36 secs ago
okay, good news
gone through holiday with directory of dept
I get to leave 16th sept
Much better.
I've used guesstimate in the past, now I encountered guesstimeasure.
The words people come up with sometimes. (source)
I'm voting to close this question as off-topic because this question belongs to an another site in the Stack Exchange network: codereview.stackexchange.comspickermann just now
13:05
@CaptainObvious private class fullStackException extends RuntimeException....
people do stupid things
yeah, who creates a class with camelCase names?
That's by far not the biggest flaw.
it's very hard to hit the 'send' button on this leaving e-mail.
parkinsons is a bitch
Not that hard
Hello, @Mat'sMug
13:18
monking!
Well... the next month will be fun :)
Zak
Zak
13:41
It's 3pm and I've used precisely 2 stars today. This feels.... weird.
4
Zak
Zak
@DanPantry fine, 3 stars.
anyway given that my leaving date is the 16th
I could go around a few parts of the UK before leaving, budget providing
as I won't have to pay for the rent this month.... :)
Zak
Zak
@DanPantry Come visit London.
That... was the inclination, yes
and also Newcastle, I have a friend who is visiting from Canada
13:58
0
Q: Out of memory, how to Speed up excel-VBA macro?

Lóránt Csaba MihályI have 9 sheets with 1668 rows and 34 cols. The code collects all data from every sheet into one Summary sheet in the following format: service 1 supplier 1 price etc.. service 1 supplier 2 price etc.. Unfortunately excel freezes around the 7k row and I receive 'out of memory' error. Any sug...

0
Q: A simple function to rename columns in data frame to standardized names in R

EkaI wrote this simple function to rename columns in a data frame to standardized names in R. This function is useful when we have a very large data set with large number of columns especially for machine learning applications. colRename<-function(x){ for(i in 1:ncol(x)){ colnames(x)[i] <- ...

If it was me, I'd stay far, far away from the cities.

« first day (1200 days earlier)      last day (3116 days later) »