« first day (506 days earlier)      last day (3510 days later) » 

2:00 PM
Note that we could potentially review English if we try to review code written in the Shakespeare Programming Language.
 
Please, no more ideas of esoteric languages......
 
Or in.... LOLCODE ?
 
LEL, CODE
 
@rolfl That's not an idea but an actual esoteric language :p
 
Ahrgh, crap.
The Shakespeare Programming Language (SPL) is an esoteric programming language designed by Jon Åslund and Karl Hasselström. Like the Chef programming language, it is designed to make programs appear to be something other than programs; in this case, Shakespearean plays. A character list in the beginning of the program declares a number of stacks, naturally with names like "Romeo" and "Juliet". These characters enter into dialogue with each other in which they manipulate each other's topmost values, push and pop each other, and do I/O. The characters can also ask each other questions which behave...
 
2:02 PM
I fear the day when somebody finds themselves smart enough to ask for a SNUSP review.
 
@rolfl Do you also have actual experience with C POSIX message queues? As I'm hitting something strange
 
@RubberDuck also the TestMethod.EvaluateResults method seemingly defaults to a successful result, I don't like it. I'll edit the post to say that.
 
@skiwi No, I have experience with MQ though, which may have been why I answered your blabbery first time.
 
@rolfl ;)
//fill up farmer request queue to the max
mq_getattr(mq_farmer_request, &attr);
while (attr.mq_curmsgs < attr.mq_maxmsg && msg_num_sent < msg_max)
{
    printf("curmsg %08lx, maxmsg %08lx\n", attr.mq_curmsgs, attr.mq_maxmsg);
    printf("attempting to send msg_num_sent %d, msg_num_received %d\n", msg_num_sent, msg_num_received);
    farmer_request_message.y = msg_num_sent;
    int sent = mq_send(mq_farmer_request, (char*)&farmer_request_message, sizeof(farmer_request_message), 0);
For some reason attr.mq_curmsgs is always zero :|
 
IBM WebSphere MQ is a family of network software products launched by IBM in March 1992. It was previously known as MQSeries, a trademark that IBM rebranded in 2002 to join the suite of WebSphere products. WebSphere MQ, which is often referred to simply as "MQ" by users, is IBM's Message Oriented Middleware offering. It allows independent and potentially non-concurrent applications on a distributed system to communicate with each other. MQ is available on a large number of platforms (both IBM and non-IBM), including z/OS (mainframe), OS/400 (IBM System i or AS/400), Transaction Processing Facility...
 
2:05 PM
And they are being sent, as the worker receives them
 
Are they being handled faster than you are sending them?
 
[Enter Romeo and Juliet]
Romeo:
Speak your mind. You are as worried as the sum of yourself and the
difference between my small smooth hamster and my nose. Speak your
mind!
3
^^ literally LOL
 
@rolfl If I make sure the workers do nothing, then curmsgs is still not increasing... Though it does halt at 64, indicating that the queue is full
Seems like for some reason it cannot write into attr
 
@skiwi Um, you score -1 for not checking return value of mq_getattr.
 
why can't vs2013 open vs2010 projects
 
2:10 PM
same reason VS2008 didn't open VS2005 projects
 
Is that rhetorical? ^^^
because ... MS!
2
 
it actually opens them, and converts them
 
... TT_TT
 
@rolfl Ah yes... of course
 
Installing yet another version of VS then...
 
2:11 PM
C scores -100 for not having automatic exception handling
 
good thing they can all run side-by-side!
 
I don't like all the Speak your mind's in that Shakespear language
 
Whenever I tried to understand lock-free programming, I don't.
 
Must be a bug feature @Mat'sMug!
 
of course it's a feature!
 
2:15 PM
1
Q: jQuery multiple uses of $window.scroll?

jasonbradberryI'm using $window.scroll twice in a jQuery script for different uses. Should I try and combine them? jQuery(document).ready(function($) { // Add class .fixed when .site-header hits top of viewport var distance = $('.site-header').offset().top, $window = $(window); $window.scroll(function(...

 
@Morwenn meh, there's only one form of lock-free programming, and it's simple.... ;-)
 
@rolfl I made a mistake...
 
the only lock-free programming is to use a single thread.
 
I only check the attributes before I enter the loop
 
duh ;-)
 
write a function for it, add it to the if statement, of course ;-)
 
What's the preferred idiom for checking it every time?
The do while doesn't seem to fit
 
@rolfl No, atomic data types are quite easy to understand.
 
atomic operations are not lock free.
just lock-hidden.
 
But I don't think that there is enough coffee in the World to fully understand lock-free programming.
6
 
2:18 PM
So I installed VS2010
And the package/folder names for the source code are in chinese
will this even compile
 
@Morwenn C++ or Java?
 
I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, I hate C, ...
5
 
C++. I wouldn't try to understand a concept in a language I barely know.
 
@skiwi I C
 
I would so love to be programming in C++ now and I think I could even survive that
C++ has automatic exception handling... right?
 
2:20 PM
Yes: if an exception if thrown and not caught, the program automatically aborts.
 
@Morwenn the C++ atomics appear to have the same basic concept as Java, which probably means it is dangerous to draw parallels..... but....
 
@Morwenn Good
 
it comes down to understanding how the language imposes a memory model.
 
Where's Paint in Ubuntu?... Oh
 
@rolfl std::atomic types may be implemented without locks. Only std::atomic_flag is guaranteed to always be lock-free actually.
 
2:21 PM
The sematics of C++ atomics imply that all operatons coded before the atomic operation are guaranteed to have completed before the operation.
 
It cannot be that hard to safe a screenshot on Ubuntu to disk
 
@rolfl It depends.
 
In the context of that thread..... really?
 
If you specify that the operation is executed with std::memory_order_relaxed, you may have surprises.
 
Oh... great.
 
2:23 PM
When you know that you don't need the order of the operations to be respected, it can be useful.
 
Otherwise, it implies that all cache-lines for all cores that currently reference that atomic are synchronized when the atomic runs.
 
Also, std::atomic has a method is_lock_free whose name is explicit enough :p
 
I think I'll spend all my stars today if things go on this way
3
 
@Morwenn That's sweet, but I don't know of any architecture that can implement cache-line synchronization and not keep it lock free.
 
CR chat is the milky way of chat rooms
8
 
2:26 PM
 
@rolfl I don't know either. But I don't know much about cache and architectures.
 
By definition, if the atomic is in two cache-lines, it has to be synchronized, which implies exclusive access at least while the memory is compared.
 
My print screen doesn't work in the Ubuntu VM :(
 
The locking may be happening internally in the microcode of the CPU, but there is still locking.
 
35% installed... 50% installed... 40%, 20%, 5%, 0%. Installer encountered an unexpected error... O_o
6
 
2:28 PM
Even atomic operations proposed (and now disabled) by Intel, and the transactional memory implemented in IBM Power, relies on locking at some point.
 
Well, let's talk about this in 10 years when I will begin to grasp the very bases of that topic.
 
Threads optimistically operate on the values before the sync, and then just in the background notify other threads that the value changed.... and if the value changed during the transactional moment, the transaction is rolled back, and replayed with the revised (sync'd) value
The cache line has to be sync'd before the operation if modified, and then again if there's a roll-back,
 
I sometimes wonder how we got here.
Oh right, I remember: for economic reasons. RAM is expensive.
 
Actually, for this one, it's CPU's are slow.
So, have many of them.... but then, oh crap, we have multiple copies of things in memory in different cores.
 
And then we need more CPUs to make sure other CPUs work.
 
2:33 PM
@rolfl Should it here after processResult() not add a new request, in order to ensure that it is as full as possible? (Queue was full: You take one, then if you add one, then it's as full as possible?)
 
Let me revise the earlier suggested loop slightly......
 
welp this time it got to 61%, that's an improvement
 
while (true) {
    while (requestQueue is not full) {
        peek on response queue,
        if (has response) {
             handle response
        } else {
             add Request
         }
    }
    result res = resultQueue.take();
    processResult();
}
 
@Pimgd It's just a rand(0, 99) inclusive both ends to indicate how far you get into installation...
 
where peek is non-blocking, take is blocking.
 
2:37 PM
@rolfl Hmm... I just made a different structure, it might do the same but then differently:
while (true) {
    while (requestQueue is not full) {
        add Request
    }
    result res = resultQueue.take();
    processResult();
    if (need to send more messages) {
        add Request
    }
}
 
That last 'if' is covered on the next-go-around of the loop, right?
 
Shit, I think it works.
@rolfl Hmm... is it?
 
Well, if the queue is not full, add a request....
 
Now only if this code would still be readable, then I'd be happy
 
all you do is force a request on to the queue.... when you (think you) know there's at least one space.
 
2:40 PM
Yeah, I think it's covered
 
The reason I suggested the change I did is as follows:
 
Nope, don't remove that if
 
You have to prioritize something.... either the request submit, or the response-handle.
the code you have prioritizes the request submit, it will keep submitting as long as there's space.
 
@rolfl But in that case you start draining the requests, they want that the queue is filled at all times except on start-up and on end of the program
@rolfl That's part of the assignment yes, so I have to follow that
 
which means that, if you have very fast (or many) workers, you could be filling up the result queue and never handle them.
 
2:43 PM
@rolfl That's a point...
 
If you 'peek' for a result (non-blocking) in the loop as well, then you clear that queue if there is something, and add if there is nothing.
 
@rolfl Well, the request queue will be filled to the max then, because workers cannot handle them anymore, and some workers will be blocking because they cannot add to the result queue, and then the farmer will get into the state where it starts processing the results and then everything can continue again
 
This switches the primary concern to having an empty response queue.
 
@rolfl If you want to see what is possible with C++ atomics, you could read the doc of std::memory_order. That's quite interesting.
 
The "problem" in this assignment is that both having a full request queue and an empty response queue are "primary concerns", that seems to conflict
Even though right now I am after setup processing one response, then sending another request... That feels linear to me
 
3:00 PM
if anyone has some extra votes to give out, see if my answers qualify to receive some of them please.... codereview.stackexchange.com/search?q=user:18427+[javascript]
when I do try catch, and email the error, can I just leave it at that or do I need to do something else to make sure it doesn't lock up on the users machine?
Tumbleweed badges are still being awarded....... ugh!
 
@Malachi That's what I was saying this morning.
 
it's crazy!
going to start pimping these questions!
1
Q: AngularJS factory, return object to be used again in factory

Paolo BernasconiI'm trying to create a wrapper / factory around the cordova media plugin, which requires you to create a new Media object, and then use it again to pause, stop, play, etc it. The factory + link to actual code: .factory('$cordovaMedia', ['$q', function ($q) { return { newMedia: function (src)...

only 14 people are awarding Bounties on other peoples questions..... codereview.stackexchange.com/help/badges/32/altruist
 
Well, I don't even award bounties on my own questions.
 
lol
is there a SEDE query that shows us how close we are to getting MortarBoard, Epic and Legendary badges?
11
A: Calculate balance wages

MalachiFormatting formatting inside your foreach should be indented This: foreach (Earning e in earningList) { // Sum all earnings... var totalEarnings = earningList[i].AmountForEPF + earningList[i].OverTimeAmount + earningList[i].IncentiveAllowance + earningList[i].SpecialA...

 
3:20 PM
0
Q: Assigning UIImageWithData to array

user3474489I am having a problem, I query facebook api for the profile urls. They get received no problem. I then assign a string to the url (profilePhotoUrl). I log profilePhotoUrl and the correct amount of url's are returned. Then in the tableView section I convert the string to a url, and call async to...

 
Well, it must not have been too harsh. The OP seemed grateful for my review.
 
@rolfl (or others), this is what I meant by ugly C... github.com/skiwi2/2INC0-Interprocess-Communication/blob/master/…
I'm a bit short on time, but I am tempted to implement this in Java
 
That's not ugly C. That's plain old POSIX C99.
 
If I keep chipping away at the Scala backlog, maybe in two or three months I'll finally break 3k rep.
 
@Morwenn Well... I call it ugly
 
3:32 PM
@skiwi Something like:
import java.util.concurrent.ArrayBlockingQueue;


public class FarmerWorker {

    private final class Worker implements Runnable {

        private long count = 0;
        private long waits = 0;
        private long delays = 0;
        private final int id;

        public Worker(int id) {
            super();
            this.id = id;
        }

        @Override
        public void run() {
            while (true) {
                try {
                    String val = requests.take();
                    count++;
 
@skiwi Real ugly C is much worse.
 
@rolfl You made that pretty quickly
 
Try to please, that's all.
 
0
Q: Performing a background task and managing battery notifications for Android

Kala JI'm just starting out for the first time in Android Development and my code is a giant mess. Here are my attempts so far. I've included it in a pastebin. Feel free to ask me if you would like to see the views or something else. Here's my code on SO: //Main Activity.java package com.example...

 
farm.hammerTime, LOL.
2
 
3:38 PM
Wrote it quickly, not the best naming conventions ;-)
 
You didn't write that in 10 min, did you?
 
and... it is actually buggy..... the println's containing the stats are not synchronized.... hmmm
maybe 20 minutes?
 
Did you start implementing before I told about it then?
 
I was messing with numbers for a bit as well, like 16 threads with queue size of 1.
 
Yeah, it was in our assignment as well and on the online checking system to do that
 
3:41 PM
No, I started..... after a chat with my neighbour, which was after this message:
53 mins ago, by skiwi
Even though right now I am after setup processing one response, then sending another request... That feels linear to me
 
Okay :P
 
So, it was probably about 30 minutes ago I started, but also I had some dead time in there in regards to this.... like I am doing multiple things here ;)
got work chat, other chats, and I've had a banana, and got a drink of water... ;-)
(and I am serious about the banana).
3
(not just a monkey thing).
 
A real banana?
 
yes, with a skin and all (but I did not eat the skin).
3
 
@rolfl That's an awesome message without context!
2
I think it was a great assignment and all, but I hated it.
 
3:46 PM
For the record, I could keep the response queue almost empty, but I could not get the request queue to be full....
 
0
Q: Extension methods for safely firing events

Nick UdellI wrote a set of extension methods for the EventHandler class that add the method Fire, which raises the event after creating a local reference for thread safety, and checking to make sure the event had subscribers. public static class EventExtensions { /// <summary> /// Raises an event ...

 
@rolfl I had the request queue full constantly, but the response queue almost empty
 
I think my workers had to do more work, were running too fast... hmmm. I can fix that.
 
If you have spare time, you should try out the code on github.com/skiwi2/2INC0-Interprocess-Communication
 
Overloading Methods FTW
 
3:55 PM
0
Q: Speed up anagram method in Ruby

JohnsonI'm working on a project to find anagrams of words. My goal is to figure out the longest anagrams out there. I took a look at my code and it works but is woefully inefficient. I thought CodeReview would be the perfect place to ask this. I have two arrays, each containing a length of long words. ...

0
Q: PHP framework building: MySQL Connection and query class

andrewniteI am building a PHP framework and would like to get some feedback on a few different sections of the project so far. I consider myself still a neophyte in PHP so I would like to ask if I'm going about completing these different tasks in an efficient and or correct way. This section is of the MyS...

 
4:25 PM
/**
* Close DB connection
*
* @param void
* @return void
*/
public function Close(){
    $this->connection->close();
}
ORLY??
 
@Phrancis Yes, next time it might be implemented as opening, so you need to read the docs!
 
Right.
 
@Phrancis Don't beat up JavaDocs.
JavaDocs are not comments.
 
Oh.
 
Oh, that's not javadoc....
that's not Java.
 
4:26 PM
phpdoc
 
don't bash phpdoc.
 
Is that a real thing?
 
well it documents the public API
 
PHPDoc is an adaptation of Javadoc for the PHP programming language. It is still an informal standard for commenting PHP code, but it is in the progress of being formalized. It allows external document generators like phpDocumentor to generate documentation of APIs and helps some IDEs such as Zend Studio, NetBeans, JetBrains PhpStorm, ActiveState Komodo Edit and IDE, PHPEdit and Aptana Studio to interpret variable types and other ambiguities in the loosely typed language and to provide improved code completion, type hinting and debugging. PHPDoc supports documentation of both object-oriented and...
OK you're right, no more bashing :p
 
LOL
4
 
4:28 PM
@Phrancis - compare:
with
In a sense, it is self-documenting code ;-) (the documentation is inside the code).
Look for two asterisks after a / like /** ..... to introduce JavaDoc.
 
Best would be to just have a tool that accurately creates documentation for your methods, without you having to do anything
 
@skiwi you go ahead and write it...
 
@Vogel612 Fun fun... it would be horrible
 
Guess why it's not written yet..
 
Nice. PHPDoc has an @magic tag!
 
4:49 PM
@Phrancis What the fuck is that?
(Very blatantly put)
 
I'm happy, I managed to reimplement an equivalent of boost::transform_iterator and have it perform empty base class optimization.
 
@skiwi looks like a BrainFuck Application in C?
 
In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it. Generally polyglots are written in a combination of C (which allows redefinition of tokens with a preprocessor) and a scripting language such as Lisp, Perl or sh. == Methods == The two most commonly used techniques for constructing a polyglot program are to make liberal use of languages which use different characters for comments and to redefine various token...
This one is labeled "A polyglot in 16 different languages" the link is at the bottom
 
bad indentations.....
 
I made a 100 on my first parallel programming project! :D On the other hand, it still involved serial code...
2
 
4:58 PM
xD
I will be going. See you later everybody :)
 
0
Q: Time complexity of anagram solution

B.oofI have written code to return anagrams from a list of words. I'm a newbie in time complexity analysis so pardon my ignorance if this is a blatantly obvious question. Am I right in thinking this is in O(n log n) time, since it's just performing a quicksort and the rest is done in O(1) time because...

 
Happy birthday @SimonAndréForsberg!
6
 
5:14 PM
0
Q: Noughts and Crosses WPF app

Everless Drop 41I've been learning c# and was looking for some feedback on my latest project. It's a standard Noughts and Crosses game. Two people are required to play (no AI yet). MainWindow.xaml.cs = https://onedrive.live.com/?cid=41ecf632a7b5f8cc&id=41ECF632A7B5F8CC%2127233&ithint=file,cs&authkey=!APkX7NZY...

0
Q: ComponentManager - Entity-Component-System architecture in C++

VeritasLately I've been working on a small C++ Entity-Component-System framework. Like most other ECS frameworks the internal data is presented as a table where an entity is a simple row index and each Component type maps to a column index. In contrast to many other C++ ECS frameworks that usually map...

 
@Mat'sMug Thank you :)
@skiwi Use a for-loop to print it instead and you'll like it more.
 
Happy birthday!!
 
System.out.println("Happy Birthday, Simon!");
3
 
I'm already out of stars D:
 
RSA
 
5:21 PM
Thank you thank you ^^
Or, I mean... cout << "Thank you!" << std::endl;
 
Switch the angle brackets. ;-)
 
Or would that be std::cout as well?
Darn
 
<?php
$name = '@SimonAndréForsberg';
echo "Happy birthday, $name!";
?>
2
 
yes it would, and we'd use '\n' instead of std::endl
@SimonAndréForsberg
 
std::cout << "Thank you!\n";
 
5:23 PM
Hm... how do you say it in LOLCODE?
 
@Jamal ask @Mat'sMug
Although I'm more looking forward to the Shakespeare version ;)
 
HAI 1.2
CAN HAS STDIO?
VISIBLE "THX!"
KTHXBYE
6
 
@Christoph Thank God! had a feeling it would be quite tiresome to concatenate std::endl all the time.
(Although.... is it technically "concatenation"? isn't it some kind of streaming?)
 
<< is a free operator function, you can use it to set formatting flags as well.
 
@Christoph you are supposed to specify the version after HAI
--> HAI 1.2
 
5:26 PM
@Vogel612 thanks for pointing that out, I'll fix that
uh...can't. it's too late
 
<nitpick>Indent your statements, too</nitpick>
 
I got it
 
@Vogel612 I suck at chat formatting, you're asking for too much
this actually turned out way better than I feared
 
s/VISIBLE "THX!"/VISIBLE "LOL!OMG!THX!UROCK"/
3
 
5:33 PM
@SimonAndréForsberg Advanced language structurews and C, haha
Happy birthday @SimonAndréForsberg!
 
@skiwi I'm quite sure it supports simple for-loops though :)
Thanks @skiwi
 
If it wasn't for him having his birthday, he'd congratulate himself in Brainfuck!
 
@skiwi TS ^
 
[-]>[-]<>++++++++[<+++++++++>-]<.-------.+++++++++++++++.
.+++++++++.>+++++++[<-------->-]<-.>+++++[<+++++++>-]<-.
+++++++.+++++++++.++.------------.----.---.>++++[<++++++>-]<.
>+++++[<--------->-]<.------------.>++++[<++++++++>-]<.>+++[<++++++>-]<+.>+++[<+++++++>-]<+.++++.++.-.>+++++[<--------->-]<.>+++++[<+++++++++>-]<.----------.++++++++++++++.>++++++++++[<++++++++++++>-]<-.>+++++++++[<------------------>-]<-.
>+++++[<++++++++>-]<+.+++.+.-----------------.+++.+++++++++++++.-----------.>+++++++[<---------->-]<.
3
 
aaaand he already prepared it..
 
5:39 PM
@Vogel612 there are actually some "Text-to-brainfuck" converters available
I'm not that crazy
 
but you're coming close?
 
No, not that close really... I think... and hope...
 
What am I watching...
 
@skiwi "nL Live on Twitch.tv - WWE 12 Glitch of the Year"
 
@SimonAndréForsberg Oh thanks!
 
5:43 PM
Glad I could help
 
0
Q: Reduce Execution time in loops

TheDarkKnightI am trying to solve the below mentioned problem from HackerEarth http://www.hackerearth.com/problem/algorithm/vaishnav-and-pizzas/ Below is my code for the same, Although the results are fine, the code takes extraordinarily long time to run execute. I am pretty sure the problem is because of t...

 
6:01 PM
-1
Q: Having issue keeping variable value in code

JakeI am trying to create a thread acts as a timer, which can be interacted from the command line. However, I cannot get the time variable value to stay after I set it: it seems to be resetting to 0. My relevant section is this: long time; public void start() { time = (System.currentTimeMilli...

 
English Version --> Happy Birthday, @Simon!
and another Javascript answer codereview.stackexchange.com/a/63594/18427
time to figure out how to Create a custom Testing Exception for Throwing.
 
<?php
$a = 5;
$b = 5;
$a = $a + 10;
$b += 10;
echo "a equals $a.<br>";
echo "b equals $b."
?>
Any preference as to whether a or b is better?
 
@Phrancis I like += better
And because my name is Simon and it's my birthday I can say: Simon says, use +=
3
 
It's nice shorthand
Was just curious if it made things more ambiguous though.
 
it's so common and used in so many languages that most programmers know what it means
 
6:17 PM
OK
 
anyone else want to comment and review this question? I left a really simple comment as an answer....
8
Q: Implementing a cancellable "infinite" loop

millimooseI'm making a Windows service that watches a directory for new files to process them. I hit a race condition between the file copying going on and me trying to process it. Going by a SO answer I wrote the following wait-and-retry method to make sure I can work with the file: public static void W...

a lot of Big Hitter Answers on this question, codereview.stackexchange.com/q/63283/18427
 
Nicely worded @Malachi
 
6:34 PM
will this work the way I anticipate it will???
    class TestException : Exception
    {
        private string _message;

        public TestException(string testMessage)
        {
            this._message = testMessage;
        }
    }
I want to Throw an exception with a custom message, to test the E-mail sender on errors....
 
shouldn't the message be passed to the base Exception type?
 
I want to be able to throw an exception but give it a custom message...
does that make sense?
 
0
Q: How to handle state in Angular?

EasilyBaffledI am working on a project in Angular where I have a number of similar data objects. When you click on anyone of them it's state and amount of data shown will change. All of the objects start in the minimal state, when you click on one it becomes medium. From a medium you can click on the button t...

 
you mean I should have : base(message following that
 
yes - pass your custom message to the base constructor :)
 
6:36 PM
like
        private string _message;

        public TestException(string testMessage) : base (testMessage)
        {
            this._message = testMessage;
        }
 
yup.. well you don't need the private field, it's in the base class!
 
and then I just get rid of everything in the middle too?
 
yup
 
man these things are pretty easy...
Thanks @Mat'sMug
 
hence, kick anyone throwing the Exception base type.
 
6:40 PM
Custom Exceptions FTW
 
@Malachi If you want to pass additional information in your exception, you can add private members, but they won't be considered in the stack trace.
So if they are private and you have no methods/properties to use them it's pretty useless
 
I just want a simple customizable string to be sent as the .ToString of the Exception....
I am a different issue at the moment, I changed frameworks on this windows service and have to make sure everything is communicating correctly.
 
The code in the ToString of Exception base class already returns a message of this format ExceptionName : Message. Is this okay for what you want?
+ the stack trace
If you only want the message, then your exception should override the ToString method and return the message!
 
6:55 PM
the stack trace and the message will be fine, I want to test that the emailer is going to work on exceptions when they are caught and that the service will continue to run (which could be a bad thing if it sends it to me over and over again....lol
but that is why I am testing to figure out what all I need to code into this windows service.
I forgot to build the setup project....lol
 
@TopinFrassi and inner exception!
 
Hmm, in C, can you create an executable message queue? By having it file attribs 0777 and storing program code in it?
 
@Mat'sMug I read the Exception's code diagonally so I missed it, that's the kind of things that happen when I'm 30 minutes away from being home, trying my new playstation 4.
2
So yeah, inner exception too! :p
 
0
Q: Best way to insert multiple rows in MySQL

php_nub_qqI am building a store. When a user decides to make a purchase I need to store it in the database ( you don't say? Duh! ) but since the purchase might be of more than 1 item I'm wondering which way is the best to insert multiple rows, here are my 3 options. The input is $input = array( 'user...

 
7:10 PM
@CaptainObvious primarily opinion-based?
In other words, is there really a best?
 
@Phrancis I think you are right, he's not asking for review, but for opinions about the best solution. Though he/she has implemented 3 options, could they go for review? Maybe then the OP'd be able to decide which is the best?
 
I would hold the off-topic trigger on that one
 
Simon says "hold the off-topic trigger on that one"
although that asker has a history of borderline off-topic posts
but a cute little avatar though
 
^^ that
 
but a fake little avatar though
 
7:23 PM
I think you will get primarily opinion-based answers as every programmer you ask will have their own preference. — Phrancis 17 secs ago
 
@SimonAndréForsberg Oops.. But may I ask, why wouldn't the question be closed? And, while I'm at it, can I retract a close vote?
I got my answer to the second question
 
What closure reason did you initially think was applicable?
 
Well, I would've thought "Primarly opinion based" or "requires code to be reviewed". But now that I'm thinking about it I'm not sure they apply to the situation.
I'm sort of unexperimented with all these votes, but I believe I got to take a guess sometimes in order to get the experience to use them correctly
 
Sometimes they are difficult judgement calls.
 
Yeah, I believe I'll get used to it. Same goes for edits review, I always skip them since I'm not sure wether or not they're good
I got to go, good evening everyone!
 
7:35 PM
I was going to VTC but Simon said to hold off, so I did. Based on 200's answer, I still want to VTC but waiting to see what happens.
 
Hi php_nub_qq!
 
@200_success Hello sir
 
Hi there @php_nub_qq
 
What's your use case for adjusting quantities after entries have been made?
Do you have users returning food to the store for a refund?
 
Well what I'm actually building is a simple game for my own sake
and users feed food to their pets
when a food is eaten it is no longer usable
and obviously needs to be removed from the database
 
7:38 PM
"Obviously?"
 
Yes?
 
Have you considered instead of using an Eaten boolean value?
 
Or how about if you only ever insert rows to represent transactions?
When SUM(quantity) equals the available stock, it means the food is gone.
 
@Phrancis well what is the point of keeping practically unusable rows in my database
@200_success I'm not quite sure I understand, yet again :(
 
Tell me more, with concrete examples. What kinds of foods are there, for example?
(The exact food types probably aren't relevant; I just want to make the discussion as relevant as possible for you.)
 
7:46 PM
Well I have 2 tables, users and foods. Foods table contains information about the food - id, name, nutritional value, cost etc. The table which joins them is the users_foods table with columns user_id and food_id. When a user purchases new food from the store, it gets added in the users_foods table with his user_id and the food_id he purchased. Then on login all of the foods he possesses are loaded in his session where quantity is defined by COUNT(user_id) in the users_foods table.
 
OK. Does the store ever get replenished by deliveries?
 
then when a user is to feed his pet, for example, with food_id 2, I delete from users_foods where food-id = 2 limit 1
well the store has basically inifnite quantities for now
infinite*
 
This one's evil...
97
Q: How can I accept the Microsoft EULA agreement for ttf-mscorefonts-installer?

MagicAfter a recent update, ttf-mscorefonts-installer prompted me to accept its license agreement. For some reason my terminal will not allow me to accept, or for some reason I am pressing the wrong hotkey... I've tried every letter on the keyboard and Enter among others... I'm sure there is a...

 
I see. So your user_foods table basically represents each user's pantry.
Suppose you represent purchases as positive quantities, and feeding the food to a pet as negative quantities?
 
0
Q: Count number of ways to paint a fence with N posts using K colors

thomasA friend sent me this question, and I'd love somebody to review this and give his opinion - Is this algorithm accurate? Could it be implemented in a better way? Anything really un-pythonic that I did there? def find_combinations(n, colours): combos_list = [] for i in range(1, n+1): ...

 
7:51 PM
Then the current situation would be given by SELECT user_id, food_id, SUM(quantity) FROM user_food_purchase GROUP BY user_id, food_id;
 
You mean, instead of deleting when a food is used, to add a row with negative value?
 
Right.
 
But what is the point?
Then rows will build up and the table will grow very big in time
 
You could also clean up all relevant rows whenever a quantity reaches 0, but it's up to you whether you think it's worth it.
It's not really any worse to do SUM() rather than the COUNT() that you currently have.
 
That is exactly what I told you in the comments section that is just giving me that feeling that I'm not writing clean code.
 
7:53 PM
Databases can easily handle more rows than you could possibly care about.
 
my installer says it works, but I can't find the service to start it, or attach to it......
 
That is a relief, but I really don't see why I should store excess information that I don't need
And build cleaners when I can just simply delete the row upon usage
 
Like I said, if you really wanted to, you could have a clean-up trigger whenever an item is depleted.
 
if you are keeping a record of things you don't want to delete a row
 
Exactly, but I'm not keeping any records and I'm not using this for any statistics
It is just used to represent the user's current items
 
7:55 PM
Alternatively, you could have a user_food.quantity column and just make PHP UPDATE it in increments up or down as needed.
 
hold it in a session variable then
 
But I find that... less clean
 
I have a feeling that you have a bad DB schema....
 
@Malachi that is essentially what I'm doing, but when the user goes away, I need to store that somewhere
I explained my schema a couple of minutes ago, I'll refresh you
Well I have 2 tables, users and foods. Foods table contains information about the food - id, name, nutritional value, cost etc. The table which joins them is the users_foods table with columns user_id and food_id. When a user purchases new food from the store, it gets added in the users_foods table with his user_id and the food_id he purchased. Then on login all of the foods he possesses are loaded in his session where quantity is defined by COUNT(user_id) in the users_foods table.
 
0
Q: Ruby Repository Pattern

Ahmet KAPIKIRANI am trying to teach myself about repository pattern in ruby. Could you please review my code. adapter.rb module Adapter class Main def prebuild(obj) @table_name = obj.table_name.to_s variables = obj.instance_variables @values = [] @keys = [] variables.rejec...

 
7:58 PM
Actually, quite the opposite.
php_nub_qq is only interested in the current supply level.
 
thinking and typing is a hard thing to do
 
… and is storing it as such.
 
it should be a column in the user table
 
I'm recommending keeping a transaction log instead.
 

« first day (506 days earlier)      last day (3510 days later) »