« first day (675 days earlier)      last day (3356 days later) » 

4:03 PM
0
Q: Style an optimization of my python code [ already works ]

HelioI developed a code that already works but I think that a programmer can improve it. I think that code style is unclear. #!/usr/bin/env python import platform import threading import signal import sys import time import subprocess import re import os import os.path import argparse import distuti...

 
I wonder if the library path matters when running the bin
 
0
Q: Using Linq syntax, how can I remove the select n+1 issue in this method?

NotMyselfI have the following code in a validation module. It works the way I want it to, but it has an obvious select n+1 problem. I would like to refactor this code to make a single call to the db to perform this validation. Is there a way I can do it using linq or do I need to perform more major surge...

 
Might copy the library into bin.
 
Hello.
 
o/
I think his question is fine, it's not too much noise and gives you enough background to actually work on the code and what he wants to achieve.
 
4:19 PM
Can somebody help me understand this concept?
I learnt about closure attribute of function object that maintains outer objects defined in outer functions used inside a inner function. What is closure property of datatype here?
 
@overexchange this is a mathematical closure, not a computational one.
 
I would recommend that you ask at programmers. While no doubt some of us have studied computer science, you will find people much better suited to answer that sort of question there.
> A set that is closed under an operation or collection of operations is said to satisfy a closure property.
A set has closure under an operation if performance of that operation on members of the set always produces a member of the same set; in this case we also say that the set is closed under the operation. For example, the integers are closed under subtraction, but the positive integers are not: 1 and 2 are both positive integers, but the result of subtracting 2 from 1 is not a positive integer. Another example is the set containing only the number zero, which is closed under addition, subtraction and multiplication. Similarly, a set is said to be closed under a collection of operations if it is closed...
 
the one I talked about is computational one which is used in inner functions?
 
The image you linked is a mathematical one
 
4:21 PM
ok
 
You wont find the words closure property in a programmatic context anywhere on google, at least
so I would assume it refers to the mathematical one
 
def cycle(f1, f2, f3):
    def f(n):
        def g(x):
            if n == 0:
                return x
            else:
                return cycle(f2, f3, f1)(n-1)(f1(x))
        return g
    return f
 
Add to the fact it considers a tuple, which is a type of set...
 
Is this computational?
f1, f2, f3
 
that is a closure
a programming one
yes
In programming languages, closures (also lexical closures or function closures) are a technique for implementing lexically scoped name binding in languages with first-class functions. Operationally, a closure is a data structure storing a function together with an environment: a mapping associating each free variable of the function (variables that are used locally, but defined in an enclosing scope) with the value or storage location the name was bound to at the time the closure was created. A closure—unlike a plain function—allows the function to access those captured variables through the closure...
A closure is not a closure property - a closure property is used to describe something a set has, a closure is something something is
 
4:25 PM
function closures
ah now I remember now, I read about closure/commutative/distributive in my primary
 
> e.g. in /usr/share/nabto/users on Unix systems
Ah.
 
Using the mathematical term "closure" when talking about programming might be mistake, given that "closure" has a very different programming meaning...
 
@nhgrif the image he linked asked about a closure property
 
Configuration files that go in your profile folder instead of project folder, depending on platform.
Nice.
 
Also you would be surprised at just how much mathematics and programming conflicts - see tuples
@Pimgd ~/.vimrc :-)
 
4:29 PM
closure permits to create hierarchical structures?
 
a functional closure allows you to encapsulate state
 
dang
 
I would say that is it's main purpose
 
how do I add files to /usr/share again
 
Pimgd cp
 
4:31 PM
With the right permissions.
 
or mv
or sudo cp / mv as per @rolfl
 
oh yeah, time to grab the sudo hammer
 
cp: omitting directory ‘/home/pim/share’
 
here, borrow mine
 
4:31 PM
it's not doing what I want
 
@Pimgd cp does not copy directories by default you need to specify a flag
 
rsync is often the better tool....
 
@rolfl I'm only clutching at straws here, I am typing from a windows machine in a .NET office.
 
cp -r is recursive (directories and contents).
rsync does so much more.
 
My knowledge of nix is unfortunately not as high as I would want it to be
and almost exclusively comes from git bash and nix virtual machines
 
4:33 PM
Sudo initiate Friday
 
echo "Amen"
 
hang on, I made a mistake
... and then I went to rm
nah
let's not go there
 
no, don't go there.
 
let's just leave the badly copied files there
they're not harming anyone
 
   Sudo is not a recognized command. Try one of these packages:
      - sudowoodo (34kb)
      - shuldawuldacoulda (700kb)
 
4:35 PM
sudo play Rebecca Black It's Friday
 
@Pimgd git clean -f >: D
@Malachi this kills the chatroom
 
eh
I'mma just go home
 
@DanPantry only because everyone is watching the video
 
before bad worse things happen
 
we'll miss you
 
4:39 PM
someone has put opera on in the office
 
@DanPantry are those real?
@DanPantry turn on some techno
 
@Malachi I want to say no, but I am pretty sure someone has created a package named after pokemon
 
lol
2
 
@DanPantry I got you now. Subtraction of natural numbers is not closed.
 
Thread.Sleep() in C# is weird
`Thread.Sleep(1)` - suspends for 1 millisecond
`Thread.Sleep(0)` - suspends and immediately yields to another equal priority thread, otherwise does not suspend and the CPU will keep on running in the current thread. This means, in a loop, `Thread.Sleep(0)` will eat up an entire core until something else needs doing
TIL
 
4:53 PM
Holy crap this chat is busy today.
 
.....someone remind me how i do it
oh, it worked eventuallty
 
Nope, it was edited, check the history..... chat.stackexchange.com/messages/20468893/history
 
0
Q: Interview Problem I'd like Feedback on

Ben NelsonI recently did a coding problem for an interview that unfortunately led me to not getting the position. So I figured I'd get the code reviewed by other professionals because after asking about the problems with the code I got stonewalled by the organization. Help critique my (apparently) terrible...

 
oh. :(
way to piss on my bonfire. but thank you for reminding me. I was close! D:
 
np.
 
5:10 PM
rolfl is FTFY king.
 
fml, i just spent 6 hours debugging an async database driven data metric app looking for a crash-causing bug....turned out to be a missing icon .png......
 
No, that's a poor assessment of the problem.
The actual problem is poor diagnostic messages that should have made the resolution simpler.
3
 
0
Q: Factory that chooses between factories based on XML element name

Nick UdellI have an implementation of a factory like so: public class CommandActionFactory : IFactory<ICommandAction, XElement> { private readonly IDictionary<string, IFactory<ICommandAction, XElement>> commandActionFactories; public IDictionary<string, IFactory<ICommandAction, XElement>> Command...

 
The cause of the failure is different to the cause of your bug. The missing file is a failure, but the bad diagnostics is a bug
Yay, someone found my C++ answer... . it was getting lonely.
 
5:34 PM
well when you are debugging xaml and the error is infact correctly saying unable to load xaml element, although the action is happening async in a RelayCommand() ina seperate library giving you no further details it kinda sucks.

I even had to bake a debug build and package the pdb files and try to extract the line numbers and method names from the StackTrace class but to no avail. async debugging is a nightmare.
 
5:44 PM
So.... I guess some people on the other side of the world caught wind of Rubberduck.
That's such pure awesome ^. If only they weren't having trouble installing.
 
@RubberDuck speaking of which. My friend Simon also had some problems with it. He added it to the add-ins but it said it could not be loaded. No detailed error-message.
 
@RubberDuck That will be your motivation to fix it I think ;) :D
 
5:59 PM
2
Q: Implement a Shape abstract class

PhrancisTo learn more about OOP, @nhgrif challenged me to implement a Shape abstract class (more details in code remarks below. Here is how I did it. Any and all advice appreciated! Shape.java /* nhgrif says: * Phrancis ready for inheritance/polymorphism? * Given the following abstract class: * * ...

 
@SimonAndréForsberg Really? Hmmm... wonder what's going on.
 
0
Q: X8086 Assembly Port Ouput

DMCGot an assignment to simulate a pelican light system using assembly language and 8 led lights Using port 378 to communicate with the LED's. I do not have access to a LED switch currently and wanted to make sure my code and logic is correct before uploading my assignment as i am not at all confide...

 
6:23 PM
0
Q: Wormhole - A windows shim app written in C with no stdlib

x79My app compiles and seems to work correctly, but this is my first C project so I welcome any criticism. I developed this in Pelles C with no standard lib. Efficiency and optimizations are more important to me than readability or comformity. The parts that I'm particularly concerned about are mark...

 
@Phrancis rolfl is almost certainly right about abstract versus interface. I'm not used to abstract classes. But this was good practice because the next challenge is a 3d interface
 
6:40 PM
0
Q: Assembler for Hack Assembly Language - Take 2

Koray TugayI have been reading this great book and I decided to do the Project in Chapter 5: Writing an Assembler for the Hack Assembly Language. You can find the specification for the Hack Machine Language and the Hack Assembly Language here. I have a working implementation here already. That one took me...

 
@nhgrif Oh shit, 3D sounds fun!
 
You may also try to ask a code review on Code Review. This site is good for asking code final tuning. — mins 56 secs ago
 
7:09 PM
@RubberDuck Have you tested it on 64-bit Office 2013?
 
0
Q: Refactoring a loop through repetitive registers

Edgar SalazarI use NHibernate to search for data in the table Register. It contains monetary registers, incomes and outcomes. Some registers are repetitive, so i have managed to implement a few properties that my C# will check if a determined register is repetitive and loop through it's repetition in order to...

 
I have 32-bit in ATM, but after this semester, I can uninstall and install 64-bit to test it.
 
@Hosch250 I don't have 2013 or a 64 bit install.
We've got some people working on it.
 
OK.
I have their setup, but with 32-bit.
I can try 64-bit later.
I'm in a crush ATM.
@Phrancis Did you get my comment about calculating the area of a triangle last night?
 
@Hogan, i followed your advice and here is my plain code, translated and fully commented: codereview.stackexchange.com/questions/83777/…Edgar Salazar 25 secs ago
 
7:14 PM
@Hosch250 Sure did
 
OK.
Why do I always spell "ratio" "ration"?
 
0
Q: Reduce redundancy from functions

Jrags87I have the following functions that for the most part are utilizing much of the same code (except for the actual message). What are the possibilities for combining / reducing these functions so that there isn't so much redundancy? // ACCOUNT DISABLED FUNCTION function accountDisabled() { if...

 
@Hosch250 I always misspell "static" as "statis" lol
 
This is better suited on codereview.stackexchange.comMatthew 1 min ago
 
o/
@rolfl this should be a mantra on stackoverflow
 
7:31 PM
This may be better suited for codereview.stackexchange.comDrew Dormann 1 min ago
 
I misspell obsolete as obsolute.
 
0
Q: Switch case for menu of pay rates

CarlosBI am trying to make a program that prompts the user a menu of options like this ***************************************************************** Enter the number corresponding to the desired pay rate or action: 1) $8.75/hr 2) $9.33/hr 3) $10.00/hr 4) $11.20/hr 5) quit *************************...

 
@Phrancis how are you calculating triangle perimeter/area?
 
7:46 PM
-2
Q: cin.get() not stopping the program

WhiteEyeTreehere's the incriminated code: #include <iostream> #include <stdlib.h> using namespace std; void pausa() { cin.get(); } void isEven( int x ) { if ( x%2 == 0 ) { cout << x << " e' pari." << endl; pausa(); } else { cout << x << " e' dispari." << endl; pausa(); } } int main() { in...

 
7:57 PM
@CaptainObvious Obviously something is being input and read by cin to end the program.
 
8:09 PM
Oh... I would've expected a right triangle.
 
Area calculation is the same either way, but I don't remember about perimeter.
Unless, of course, you don't know the height.
Or the width.
BTW, I've decided that is off-topic.
 
Looks like this works for any kind of triangle so I thought that would be a good fit
 
A good comparative review, in my opinion, probably has the answer somewhere on SO in a direct X vs. Y question (like the Monitor vs. SemaphoreSlim one we found).
So, I'll just research the root question there.
Talk to you later, I need to write a couple papers.
 
0
Q: PyDOS - My Python Project

Mrfunny744Just joined code review, so please dont disapprove my post. I have a big project called 'PyDOS' and its going very well. Im sort of stuck for ideas and I don't know any ideas. Look at the code - and post your answers of anything that could make it look cleaner - or new ideas I should add. P.S It...

 
8:44 PM
@Phrancis See the edit. I hope it's clearer!
 
@Jamal you should check out that Python 3 question again.
 
9:06 PM
0
Q: Show first n elements of array, and count elements not shown

LandoThis code mimics the "likes" tooltip from Facebook. Given an array with the list of users that liked the content, it shows the first n users and displays a final item with the count of the users not shown. It works as expected, but I'm sure it could be better written. <? if ($count = $this->...

 
9:39 PM
Okay I read this wrong. Indeed it is a code review question. — Gordon 2 mins ago
 
can I make a foreach loop wait 5 seconds before the next iteration? C#
do I have to use a thread wait or something?
 
0
Q: Array and Linked List Implementation of Stack

B-MacI've implemented both as follows. Could someone be kind enough to just play around with various inputs and let me know if there are any bugs. Would be really appreciated. #include <iostream> using namespace std; /***************************************************************************/ cla...

 
@Phrancis - I edited my answer a little. Some formatting, and also an additional point about input validation.
Monking all
 
Monking
 
Monking.
 
9:50 PM
Playing with the abstract class was pretty fun, hoping interfaces will be as well!
 
I like how you guys ignore me when I ask dumb questions, so that I can find the answer by myself....lol
2
I am getting close to posting this code for review
I might leave the curly-braces out of my if statement with a one-line using statement inside....any thoughts?
 
^^ Someone will tell you to always use curly braces
 
and someone will tell that person that they are not needed....lol
 
You could always keep the curly braces on the same line, that way you'll annoy both sides ;D
 
lol
if (emailSent == false)
    using (SmtpClient mailClient = new SmtpClient(_SmtpServer, Convert.ToInt32(_SmtpServerPort)))
            mailClient.Send(emailMessage);
that looks cool!
 
9:58 PM
@Malachi I wanted to answer you, I just don't know C# :D
 
lol
 
I have to say, with C# braces that statement would be what... 4 lines taller?
 
@Phrancis Look into functional interfaces and try a Lambda while you're at it! Happy programming.
 
TTQW!
 
?
 
10:14 PM
0
Q: MS Access to postgresql converter

Nicholas ClarkeI was hoping to get some feedback on the implementation of this class for programmatically converting an access file into a postgresql schema (works by obtaining schema data from the cursor object). import os import json import pyodbc import psycopg2 import time import sys # Refer to https://co...

 
@Heslacher you around?
 
0
Q: New event notification e-mailer

MalachiI created a New Event Emailer. this takes some fun events from a nice SQL query and creates a little HTML message and sends it to all the subscribers of events, when new event types are added we need to be able to tell them that they need to add the events to their subscription if they want to b...

and with that I am outta here for the day, time to ride my motorcycle in this wonderful march weather
 
@Malachi That looks like an accident waiting to happen.
2
 
@rolfl agreed
later
 
0
Q: New event notification e-mailer

MalachiI created a New Event Emailer. this takes some fun events from a nice SQL query and creates a little HTML message and sends it to all the subscribers of events, when new event types are added we need to be able to tell them that they need to add the events to their subscription if they want to b...

 
10:26 PM
@Malachi emailSent == false really ? !emailSent ?
 
@Marc-Andre no no, this is the way to do it: emailSent.ToString().Equals(bool.FalseString, StringComparison.OrdinalIgnoreCase)
2
 
@mjolka Damn I had it wrong from the beginning :P!!
 
@Marc-Andre you could also use emailSent.CompareTo(true) == -1 but it's not as enterprise-ready
 
Morning all
 
morning @Mehrad :) sorry i haven't written back yet, turned out to be a busy weekend
 
10:43 PM
object HelloWorld {

  def main(args: Array[String]): Unit = {
    println("Hello World")
  }
}
There... my first learning in Scala.
Note, object != class.
 
@mjolka all good Mat. As I said it's not urgent or anything. anytime you wish :)
I didn't know it's possible to instantiate an object in the parameter of the method. find it quite interesting syntax :)
 
10:59 PM
@Legato TTQW == Time To Quit Work
 
@rolfl object == singleton
 
I know that .... now! Why I could not get my main class to run.... was it was a class, and not an object.
 
@rolfl @Donald.McLean would be proud :)
Next up, Bejeweled?
 
also, there is codereview.stackexchange.com which posts like this are better suited for. — Jonathan Kuhn 1 min ago
 
solarium:~/Scala/workspace/Learning/src> scalac HelloWorld.scala
solarium:~/Scala/workspace/Learning/src> scala HelloWorld
java.lang.NoSuchMethodException: HelloWorld.main is not static
        at scala.reflect.internal.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:68)
 
11:09 PM
14
Q: Oh ye beloved bejeweled

Simon André ForsbergBefore @bazola asked his recent question we chatted about it for a bit. I figured that I could try implementing something similar myself. As I've heard that Scala has all the advantages of Java but fewer of the disadvantages, I'd figured that I could try Scala. I have implemented checking for b...

I can't believe I even did Scala a bit myself...
there was some nice parts of it, but I found the documentation confusing
waaaaaaaaay too many methods
 
I find other things confusing, like the App trait.
I mean, come on, I can write the class/object like:
object HelloWorld {

  def main(args: Array[String]): Unit = {
    println("Hello World")
  }
}
 
I don't think I even got to traits...
 
Or, I can make it an App, and remove the mainmethod, but then I have bare-code in the body......
 
def aggregate[B](z: ⇒ B)(seqop: (B, A) ⇒ B, combop: (B, B) ⇒ B): B
 
object HelloWorld extends App {
    println("Hello World")
}
^^^ same output.
 
11:12 PM
^^ I don't even know how to read such documentation
interesting
but you can use multiple traits, right? So... multiple-inheritance more or less?
 
Somehow the whole object body becomes the main method body....
 
sort of like a lambda
perhaps that's why it is possible? Only one abstract method or something?
 
object Main extends App {
  Console.println("Hello World: " + (args mkString ", "))
}
 
0
Q: How to yearly upgrade students in new grades/classes in school management system

Shaikh Noman NasirI'm sorry if this question is inappropriate if it doesn't fit here kindly give me specific link where i can get a solution or please answer here! I've been through many solutions on this site but i'm new nothing could help I'm creating basically a fees management system in school I've some confus...

 
> The App trait can be used to quickly turn objects into executable programs.
 
11:14 PM
@rolfl ah, that args mkString ", " part is fun, isn't it? Calling methods without using parenthesis is quite cool
 
Yeah, all methods with 1 argument can be braceless
 
I believe LibGDX supports Scala. Perhaps I should check it out...
although my main problems isn't normally the code, but the freakin' GUI...
 
@Phrancis Gratitude for the breakdown.
 
What, the eclipse-based Scala IDE?
 
@SimonAndréForsberg You recommend LibGDX?
 
11:17 PM
@rolfl LibGDX = game development framework.
 
Ahh, that GUI
 
I'm using IntelliJ... hmm... wonder if the community edition of that even supports Scala.
@Legato Yes, highly recommend it. But I'd also recommend getting good understanding of general Java development as well.
@rolfl now that you mention it, I don't think I was entirely happy with the Eclipse-based Scala IDE...
 
@CaptainObvious I'm not sure about this one... It's answerable and has clear questions, and the code works, but it sounds a bit like ...
 
@SimonAndréForsberg Thanks for that additional caveat. I tend to feel lost about direction/maybe overwhelmed with how many things I'm taking on.
So, Maven, related to general Java development?
 
@Legato Make sure that you understand what is going on with your code. Try to figure out better solutions. Ask CR questions. Post CR answers.
@Legato yes. Maven is Java development.
In other news...
Seems like this week was Simon week ^^
@Mat'sMug I got the newsletter ^^
 
11:21 PM
That, and coffee ^^
 
Yeah, I've been doing that. Thanks! I shall understanding
Totes Simon week, woah.
You guys agree with this?
The placeholder variables increase readability. — Aleksandr Dubinsky 1 min ago
 
@Marc-Andre lol
be back in the morning to fix some stuff....
 
Hello.
 
Looks like you want a code review - codereview.stackexchange.com - As general advice, print out everything, (or use a debugger) — eddyparkinson 34 secs ago
 
@Legato I was surprised that you accepted my answer...
 
11:30 PM
@Duga I don't know what we would do without you.
 
@eddyparkinson No, this does not belong on Code Review. Please read Be careful when recommending Code Review to askers. This code does not work as intended. It doesn't need a Code Review, it needs a debugger. — Simon André Forsberg 31 secs ago
 
@MannyMeng I decided you were right.
@Duga <3
@SimonAndréForsberg You posted as I was writing mine though. /rage
Oh gosh, my starred post is completely missing a word.
 
This is not a CodeReview appropriate question. The OP wants to fix/acquire some desired missing functionality. CodeReview is about reviewing code that works fully as intended. — Legato 1 min ago
Thanks for the info - I removed the code review suggestion — eddyparkinson 28 secs ago
 
@Legato I was?
 
it happens ... ;-) ^^^
 
11:38 PM
Anyone good with Eclipse around?
 
@Phrancis You have @rolfl and me, what more do you need?
2
 
Just looking to take a handful of .java files that are in a generic folder/package and move them to a subfolder/package
 
Select them all, then "Refactor" and move them.
It may help to create the empty package first.
 
@MannyMeng I think so. I really liked both. I cheated and Janos is awesome and gave me an answer that helps me cheat more haha, but you actually provided an implementation, which was what I most wanted out of it.
 
@rolfl OK thank you
 
11:41 PM
@Phrancis select the classes, and press Alt-Shift-T
(in the package explorer, not the navigator... in case it isn't working yet).
 
Ugh Mac lol
 
What you do is you adopt the life.
Just joking, maybe I'm confused why can't you copy the files and just go to directory and paste?
 
@Legato Guess I could, just worried about breaking things
Nvm looks like I got it
Guess you can't have a package within a package huh
 
 
@Phrancis Well you can...
 
11:50 PM
@Duga actually fits for once
@Phrancis Yeah. Nope. Package is basically what you use when pack all the files together for an application, so just one.
 
Just as well use subfolders, just didn't think of that offhand
 
@Phrancis Package are folders. So you can use sub folder, it will create sub package
 
-2
Q: what wrong with this code?

saint_jobif largest is None or value: largest = value if smallest is None or value: smallest = value I a while state with try and except but for some reason. this part of the code is inside the loop, however only catches the last number that i enter. How could I solve that?

 
@CaptainObvious what wrong with this title?
 
It has a question mark!
It's a question!
13
Q: Can we rename "Ask question"?

Simon André ForsbergA recent "question" (will probably be deleted when you click it) made me realize: The "Ask Question" label on Code Review can be a bit misleading here. Code Review questions are expected to contain real, reviewable code. Is it possible to rename the "Ask Question" label to "Post code for review"...

 
11:56 PM
I BROKE STACK EXCHANGE!!
-5
Q: what wrong with this code?

saint_jobif largest is None or value: largest = value if smallest is None or value: smallest = value I a while state with try and except but for some reason. this part of the code is inside the loop, however only catches the last number that i enter. How could I solve that?

0
A: what wrong with this code?

Simon André Forsbergthis is just a test to see if the question really has been closed

@rolfl ^^
 
Working mobile?
 
Nope, I was on desktop
I think it is because I made an edit to the question while it was getting closed
 
There is a grace period, and also the lock is a client-side thing... I believe
 
not yet. how can solve that? — saint_job 35 secs ago
^^ lol
 
58
Q: How was this answer posted after this question was closed?

tombull89Question: lot of .exe folders are created on my windows7 Answer: try that... The question was closed at 11:57:57 (according to the hover-over-"x-mins-ago" bar) and the answer was posted at 12:16:35. It's a fairly lengthy answer, so it's possible that it was started to be written before it was c...

 
11:58 PM
@rolfl That really makes no sense to make the lock a client-side thing... there has to be some server-sided enforcement
Huh. Weird design, but good to know why
 
Took great glee in deleting a simon answer ;-)
 
Now please delete that question before my answer is flagged ;)
 

« first day (675 days earlier)      last day (3356 days later) »