« first day (653 days earlier)      last day (3370 days later) » 

1:02 PM
You would say that one player should be able to win?
Right now the white men is never being moved, and the white knight is scaring of the two black knights
The black player always has one knight ready to capture the white men if it tries to become a knight
 
monking @all
 
I can only look ahead like 8 turns in my little 2 seconds though ^^
hey @chillworld
 
what's the topic of today?
I just dig a little in jquery
hope I'll never have to do that again ^^
 
jquery is not that bad
JavaScript without JQuery, that's bad.
 
@SimonAndréForsberg 3-4 hr's for edit 2 in this answer :
0
A: How to mask datebox

chillworldIt's very easy for setting a format (I know it's no mask): <datebox format="dd/mm/yyyy"/> You can found it in the datebox documentation. Other solution could be from this blog. Edit : I don't know why you need a mask. If you set the format to dd/mm/yyyy you can do this : 12 loose focus =>...

there are always people who want to make it difficult :)
 
1:13 PM
@ferada A switch statement helps to replace if-elseif constructions... it doesn't solve the line count issue.
Basically, there's just too much going on.
parseLine is a function that should consist of x = parseX, y = parseY, z = parseZ, return new Line(x, y, z) but I don't know how to split it cleanly.
 
@skiwi what IDE do you use normally then?
 
@chillworld IntelliJ IDEA, since 2 months I think, if that long already
 
@Pimgd What is the end result of all your code? I know your question is quite packed so there's no room to show it here, but could you show me a few example inputs + outputs of your code?
 
@skiwi I want to try that to but you have to pay for it :(
 
	/**
	 * Represents a single line in a Dialogue for SDT.
	 * Example:
	 * intro:"hi!". {"style":"Him"}
	 * - linenumber would be the line's linenumber
	 * - name would be "intro"
	 * - content would be "hi!"
	 * - excess would be "", ". ", ""
	 * - lineattributes would be an array of one, containing a LineAttribute object, name "style", value "Him"
	 * - lineattriubtesString would be "{"style":"Him"}"
	 * @author Pimgd
	 */
	public class Line {
		/**
		 * Normally, variables are not named by classVariableName, since that's unnecessary (e.g. lineWidth, lineLength).
@SimonAndréForsberg basically it creates a bunch of Line objects
example inputs, well
 
1:22 PM
@chillworld The Community Edition is free
 
@chillworld there is a community version available, which is free
 
I have plenty examples but they're NSFW
 
@Pimgd replace the string data with xxxxxxxxxxxxxx then and show
 
@skiwi @SimonAndréForsberg and also good?
 
@chillworld yes, I'm using community edition and it's good.
 
1:25 PM
@SimonAndréForsberg good to know, now just see if ZK has a plugin for that and I'll ask if I get it at work
 
I think the community edition doesn't support so many plugins as the real version does
 
hmhmhm
...
 
@SimonAndréForsberg it's getting worse :
 
that's pretty hard, actually
 
or they do work very slow or I think it's never going to come
 
1:29 PM
@chillworld I was afraid of that...
@Pimgd what's the problem with it?
 
@SimonAndréForsberg filtering all the nasty is just not that possible right now =D
 
@SimonAndréForsberg almost 5 years for a plugin ^^ I hope they don't pay that guy
 
@Pimgd then I can't help you right now either
 
I'll write 99 bottles of beer on the wall for you
Then we'll have something to work with
 
1:39 PM
Greetings, Programs.
 
-1
Q: HackerEarth Girlfriend's Demand Challenge

arindrajitThe problem description can be found Here. My program is producing outputs that match the sample test cases but when subjected to large integers the program breaks down and I can't figure out the reason. When the data provided by the user is something like , a:=252509054433933447 b:=760713016...

0
Q: Flatten Hierarchical Data with LINQ

BoeseBi got some Model with a hierarchical structure like this Batch (root) Groups (List of groups owned by the Batch) Groupnames (Nameing of the Group in different Languages) Tags (List of Tags owned by the Group) Tagnames (Nameing of the Tag in different Languages) ...

 
Still only 2 votes here?
2
A: Swift 1.2 Singleton Implementation

nhgrifFirst and foremost, printing text to the console is absolutely pointless for an iOS application. It's okay to do it as an easy way to test whether our code is working as intended, but we don't want to mistakenly leave this in the final release build. So, step 1: Follow the instructions in this ...

 
@Donald.McLean Greetings.
 
@Donald.McLean Greetings.
 
I added pictures and everything!
 
1:47 PM
-Implementation from 99-bottles-of-beer.net/language-java-4.html
dialogue_name:"99 bottles of beer on the wall"

initial_settings:{"bottles":99, "s":"s", "callback":""}

-this is a comment

-the start line plays at the start of the dialogue
-the style line-attribute determines how the line is displayed.
start:"[bottlesChorus]" {"style":"Thought"}

-*variable* inserts the value of the variable in the dialogue.
-[blah] plays the line "blah".
-*variable == value* inserts 1 if true, 0 if false.
@SimonAndréForsberg haha.
That's correct input.
Now what can happen is someone forgets a : or a " or a [ and then you have Syntax errors
 
and what's the output that your program produces for that?
 
I don't have an interpreter for you, but...
so I guess I'll be the interpreter
ah
@SimonAndréForsberg it creates objects, so that's pretty hard
if you fed it the first line,
new Line(1, "-Implementation from http", "-Implementation from http://www.99-bottles-of-beer.net/language-java-4.html", {"//www.99-bottles-of-beer.net/language-java-4.html"}, "//www.99-bottles-of-beer.net/language-java-4.html", {"", "", ""}, {}, "");
it would split at :
determine "-Implementation from http" to be the line name
and treat the rest as content string
 
but that line is a comment, isn't it?
 
Yeah
But SDT doesn't have comments.
 
so why does your program have?
 
1:55 PM
It's community convention that lines starting with a - are comment
But SDT doesn't treat them that way...
And if you have something like this
 
-intro:"blah" {"mood":"someinvalidmood"}
it will crash on loading the dialogue
that's the only reason I parse comments
 
because it treats -intro as the line name?
 
yeah
for that comment line that would crash SDT, it makes a line object with...
public function Line(number:uint, lineName:String, rawLine:String, lineContent:Array, lineContentString:String, lineExcess:Array, lineAttributes:Array, lineAttributesString:String)
lineName = "-intro"
rawLine = "-intro:\"blah\" {\"mood\":\"someinvalidmood\"}"
lineContent = new Array("\"blah\"")
lineContentString = "\"blah\""
lineExcess = new Array("", " ", "")
lineAttributes = new Array(new LineAttribute("\"mood\"", "\"someinvalidmood\""))
lineAttributesString = "{\"mood\":\"someinvalidmood\"}"
@SimonAndréForsberg like that.
The reason I include all the " everywhere is because if someone forgets them I wanna know someone forgot them
hmhmhm if it helps I can implement toString() for Line and print out the contents of each line for the 99 bottles of beer dialogue when I get home
I don't have a AS3 compiler that accepts classes here
latest version of the checker is www.fastswf.com/bMp2fBE
 
2:09 PM
@SimonAndréForsberg without the comment filter, the checker has this to say about the 99 bottles of beer dialogue:
Line Usage - Major: Line 1 is unused!
Line 1: -Implementation from 99-bottles-of-beer.net/language-java-4.html

Syntax - Minor: Excess characters (.) after line attributes on line 13. This indicates a syntax error.
Line 13: -[blah] plays the line "blah".

Line Usage - Major: Line 13 is unused!
Line 13: -[blah] plays the line "blah".

Syntax - Minor: Excess characters (, you can set values to variables.) after line attributes on line 18. This indicates a syntax error.
Line 18: -via the complex line-attribute "set", you can set values to variables.
 
You might want to check codereview.stackexchange.com they are open for reviewing working code. But check their help center first about the quality guidelines for posts. If you just dump code there you'll be downvoted... — rene 1 min ago
 
for that 1 line that would crash the game, even with the comment filter turned on, it gives this:
Severe issues MUST be fixed before releasing your dialogue, or your dialogue will crash and fail to load.
Syntax - Severe: Illegal value (someinvalidmood) for attribute (mood) on line 1.
Illegal values for the mood-attribute will crash SDT's Dialogue system. This issue has to be fixed before SDT will be able to interpret your dialogue correctly.
"But this line is commented!" SDT doesn't care about that, the lines still get parsed and SDT will still crash.
The allowed values for the attribute mood are: Normal,Angry,Happy,xxxxx
 
0
Q: Restrictive stupid shell

Ole JørgensenI'm attempting to create a replacement shell for /bin/bash, that only permits commands defined by a read only config file. These commands will be run by absolute paths, and take no arguments. I'm not an experienced C programmer, so I kindly ask for your comments and feedback. I'm especially conce...

 
@SimonAndréForsberg I guess that if you want to understand the algorithm it helps to look at the 6 examples I wrote in the comments of the code
hmhmmh maybe I should rewrite it somehow, instead of asking here...?
Noooooo
my bold text died
 
2:27 PM
0
Q: prestashop: get final product category

StratboyIn general, in prestashop there are no funcions to really have the final (the one with highest level_depth) category of a product based on id_product, so I extended the Product class and added this simple static method: public static function get_product_category($id_product, $id_lang = null){ ...

 
hmm, seems like I can fix my bold text by changing font sizes from 1.3em to 1.29em
that's... strange.
11px font on buttons, it breaks
11.01px font on buttons, I can see again.
 
ya... .01 px-
wat?
 
I have un-broken my bold text =D
Except question votes.
Those are still bork atm.
anyway, time to continue working, instead of talking about my horrific 620-line parsing function
 
2:53 PM
@Pimgd I didn't really understand much of your 6 examples in the code. It was a bit unclear how they were structured, and what the result was.
 
=/
 
0
Q: C# Custom TcpListener

Ash SimpsonHey I have only been coding C# for a short time and I can't say Im an expert but I am rather enjoying it. I wonderd if you could see any way I could improve my code it is a C# TcpListener and wonderd if you could help me improove it in any way? using System; using System.Net; using System.Net.So...

 
It's basically parser progress in how much it has consumed
 
@Pimgd these are the examples, right?
//contentString:
//1|"Hi!"
//2|"Hello"
//3|"pls"
//4|"held"
//5|"Testing!"
//6|Arial
 
err
//1|intro:"Hi!" {"style":"Him"}
//2|general : "Hello"
//3|help"me"{"next":"pls"}
//4|held:Let go!{"held":"true"}
//5|under_line"Testing!"
//6|font:Arial
it's these ones, at the start
eventually I split a contentString out of source
 
2:56 PM
then what are the other ones?
it is very unclear what is an example and what is not
 
progress updates...?
Anything prefixed with //#| is an example
so
//1|intro:"Hi!" {"style":"Him"}
    //2|general : "Hello"
    //3|help"me"{"next":"pls"}
    //4|held:Let go!{"held":"true"}
    //5|under_line"Testing!"
    //6|font:Arial
    var source:String = lineText;
    var nameEnd:uint = 0;
    if (source.indexOf(":") != -1 || source.indexOf("\"") != -1) {
        //valid for all 6 examples.
        //Needs : or " to be a line. Otherwise it's not parsable.
        if (source.indexOf(":") != -1) {
            nameEnd = source.indexOf(":");
        } else {
what it does here is snip off the line's name and put it in lineName
//1|:"Hi!" {"style":"Him"}
    //2|: "Hello"
    //3|:"pls"}
    //4|:Let go!{"held":"true"}
    //5|"Testing!"
    //6|:Arial
    var contentStart:int = 0;
    if (source.indexOf(":") == 0) {
        source = source.substring(1);
        //1|"Hi!" {"style":"Him"}
        //2| "Hello"
        //3|"pls"}
        //4|Let go!{"held":"true"}
        //6|Arial
        contentStart = source.indexOf("\"");
    }
    if (contentStart >= 0 && lineName != "initial_settings") {
        lineExcess[0] = source.substr(0, contentStart);
then it determines excess characters between the lineName and the start of the content lineName:"content"
initial_settings is special because it doesn't have content
it strips the : and any other excess characters and places it at the start of the contentString.
    //1|"Hi!" {"style":"Him"}
    //2|"Hello"
    //3|"pls"}
    //4|"held":"true"}
    //5|"Testing!"
    //6|Arial
    var contentString:String = "";
    if (source.indexOf("\"") == 0 && source.indexOf("\"", 1) != -1 && lineName != "initial_settings") {
        contentString = source.substr(0, source.indexOf("\"", 1) + 1);
        source = source.substr(source.indexOf("\"", 1) + 1);
    }
    //source:
    //1| {"style":"Him"}
    //2|
    //3|}
    //4|:"true"}
    //5|
    //6|Arial

    //contentString:
it then cuts out the content string by looking for the next double quote.
Skipping initial_settings, of course
after that...
it parses the contentString...
    while (contentString != "") {
        if (contentParseMode == "Normal") {
            //The problem: 4 functions give 4 values. Which function gives the lowest positive value?
            var checkArray:Array = new Array();
            checkArray.push([contentString.indexOf("Б"), "Б"]);
            checkArray.push([contentString.indexOf("%"), "%"]);
            checkArray.push([contentString.indexOf("*"), "*"]);
            checkArray.push([contentString.indexOf("["), "["]);
            checkArray.sortOn([0], [Array.NUMERIC]);
parsing of the contentString happens in segments
 
checkArray.push([contentString.indexOf("Б"), "Б"]);
checkArray.push([contentString.indexOf("%"), "%"]);
checkArray.push([contentString.indexOf("*"), "*"]);
checkArray.push([contentString.indexOf("["), "["]);
that's the four special ones I need to look for
//When parsing a contentString, you're treating everything as normal string until...
//Б - change to delayString (new normal string, keep until different character)
//% - change to special char (new normal string, parse next 2 chars, keep that as pattern, then parse until pattern is broken)
//* - change to VariableInsertion/VariableSubstitution (Treat as Insertion until YOU/ME/YOUR/MY/FINISHES is detected)
//[ - change to Trigger
a delayString is a character that SDT can't print, but does take time to print.
It's abused by the community as a way to introduce a short pause.
 
Hmmmm why didn't that one box?
 
%... well,
 
3:09 PM
There are two parts of this question. One is it fails on large input, which is a gray area, but okay in my mind. The other is requesting for a review of the algorithm which is definitely on topic. I'm voting to re-open based on the assumption that the code does work as intended for smaller inputs. — RubberDuck 2 mins ago
 
the nastyness of SDT dialogues is boundless
and one of the things is does it url decode any lines
 
Mods might want to keep an eye on that ^^ and clean up the comments if it's reopened.
 
I have it in there because I want to validate any url-encoded tokens.
The * starts a variableinsertion...
bottlesChorus:"*bottles* bottle*s* of beer on the wall, *bottles* bottle*s* of beer, [bottlesGone*bottles == 0*]" {"style":"Speak"}
As seen here - it inserts the value into the dialogue
there's a special case for YOU/ME/YOUR/MY/FINISHES, because those insert system values instead (specifically, names and name's and a ... score counter...)
and [ signals start of a trigger
triggers are used for actions [LOOK_UP] and for selecting the next line to play [intro2]
after that...
var attributeStart:int = 0;
    var hasAttributes:Boolean = false;
    if (source.indexOf("{") != -1) {
        hasAttributes = true;
        attributeStart = source.indexOf("{");
        lineExcess[1] = source.substr(0, source.indexOf("{"));
    }
    //source:
    //1|{"style":"Him"}
    //2|
    //3|}
    //4|:"true"}
    //5|
    //6|
it determines the excess characters between the end of the content and the start of lineattributes
lineName:"content" {"line":"attribute"}
The excess here is that one space
This is useful for cases where people have accidentally misplaced a ".
lineName:"con"tent" {"line":"attribute"}
would give tent" as excess
    //Parse attributeString
    lineAttributesString = attributeString;
    var attributeParseMode:String = "Start"; //Oh no Pim, more stringly-typed coding! What are you doing?! I'm trying to make things work, that's what I'm doing.
    var attributeName:String = "";
    var attributeValue:Object; //LineAttributes can be multiple variable references.
    var attributeName2:String = "";
    var attributeValue2:String = "";
    while (attributeString != "") {
        //I really should have included an initial_settings line in my examples.
then you get another unholy mess =/
It's a json parser.
Seriously.
line attributes is just json.
I didn't realize it at the time
but it starts with {, then, for each variable(" + a name + " + : + a value), separated by ,
ending with }.
 
values are either numeric 0 1000 -1000
or strings... "blah"
or objects of themselves.
 
3:18 PM
I have been considering suggesting a JSON library for you
 
lineExcess[2] = source;
line = new Line(lineNumber, lineName, rawLine, lineContent, lineContentString, lineExcess, lineAttributes, lineAttributesString);
return line;
 
I think using a json library could reduce the code a lot
 
then it puts what's left in lineExcess
in case someone screws up a bracket or so
{"haha":{"I":"screwed"}},"up":"yeah"}
would give you ,"up":"yeah"} as excess
@SimonAndréForsberg I honestly hadn't thought of using a json library
 
then it's honestly time to think about that
 
there's a number of problem with using one but I think I could get around with
for instance, "blah":0 and "blah":"0" are not the same.
 
3:22 PM
true
 
the first one is treated as "= 0", the second is treated as "+0"
 
in your code or with json?
 
in SDT's messed up dialogue system
hmmh and after that it's done parsing
having determined the lineName, lineContent and lineAttributes
... I have a feeling I could probably split it into those parts, actually.
feels good to have someone to talk to about this for once
 
quack, quack.
 
it's bad to live together with your code for several months
4
You might get to know it really well, but neither of you ends up looking clean
hmmhm
so it has 2 large blobs, right?
One for the line content
and one for the line attributes
is there some sort of parsing structure I could use to deal with line content parsing?
Right now I have a while loop with basically string-modes
 
3:30 PM
I haven't read through your code that much yet
 
it's the part that does these things
//Parse contentString
//When parsing a contentString, you're treating everything as normal string until...
//Б - change to delayString (new normal string, keep until different character)
//% - change to special char (new normal string, parse next 2 chars, keep that as pattern, then parse until pattern is broken)
//* - change to VariableInsertion/VariableSubstitution (Treat as Insertion until YOU/ME/YOUR/MY/FINISHES is detected)
//[ - change to Trigger
hmmmhmhmhmhmhmhmhmhmhmh
 
@MarcusMüller it is not "codereview stuff" if the logic needs fixing to work properly. — jonrsharpe 15 secs ago
this is codereview stuff. Also, BlackJack seems to be homework no.1 these days... — Marcus Müller 1 min ago
 
Thinking about working hard to clean up my own crap tonight based off this conversation, then edit my self answer with all the changes,
then make a followup where I have a lot more characters to spend on explaining what it has to parse and then slapping the 500 points on there
 
@jonrsharpe If someone hands me a good couple of lines of code to guess his logic from, it's firstly a problem of code reviewing, and might be a logic issue after that. — Marcus Müller 49 secs ago
@MarcusMüller By saying that it is code review stuff you imply that the question belongs on the Code Review Stack Exchange site. This would be closed as off-topic there because the code is not working as intended. /Code Review regular. — Simon André Forsberg 51 secs ago
 
yep
0
A: Parsing a Dialogue Script - fixing my 620 line mess

PimgdDuplication if (contentString.charAt(0) == "%" && contentString.indexOf("%2A") != 0) { contentParseMode = "SpecialChar"; } else if (contentString.charAt(0) == "[") { contentParseMode = "Trigger"; } else if (contentString.charAt(0) == "*" || content...

writing my own selfie is the way to go
 
3:47 PM
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comjonrsharpe 1 min ago
Sorry, I didn't realize that there was a specific stack exchange website for code review. Should've known better. — Jordan Pool 55 secs ago
 
1
Q: "Attaching an entity of type T failed because another entity of the same type already has the same primary key value"

Jeroen VannevelI have a Language model defined as such: public class Language { [JsonProperty("iso_639_1")] public string Iso { get; set; } [JsonProperty("name")] public string Name { get; set; } public override bool Equals(object obj) { if (!(obj is Language)) { ...

EF experts in the house?
 
gotta go, back in 3-4 hours
 
Thanks to Simon, I'll refactor this code tonight using my selfie. I'll post a followup after that with a lot more explanation - not to worry about the bounty, however, because that will just move on to the followup question! — Pimgd 6 mins ago
 
0
Q: Simplified if return suggestion from Android Studio

AlvaroSantistebanI have this very simple method: private boolean isTheParticipantTalking(ParticipantID participantId){ if(mCurrentParticipant != null) { return participantId.equals(mCurrentParticipant.getId()); } return false; // no one is talking } I receive a warning stating that I can si...

 
4:09 PM
so can someone tell me why answers are limited to 30k chars as well
how am I supposed to review my own code like this
 
0
Q: Grouping An Array of Strings into Anagrams

T. RexOk, so this code works perfectly, however, I've not coded in java for a long time, so I'm worried about breaking java conventions, but even more important, I would appreciate any comments on making this more efficient in terms of computation time. What this program does is to take an arbitrary a...

 
@arindrajit- care to join me in chat to discuss your question on Code Review
(when you get here, please 'ping' me by typing @rolfl and sending that....
Finally, we should discuss this question in chat - The 2nd Monitorrolfl ♦ 9 secs ago
 
4:32 PM
1
Q: Converting xy coordinates to theta without discontinutities

TLWThis one is, or rather, should be, fairly simple. I have a list of tuples of XY positions, and am trying to pull out angles relative to the origin from it. However, unlike atan2 / friends, I want it to be continuous, in other words not wrapping. I know (and am assuming) that the differences betwe...

 
4:44 PM
@Pimgd You could split your answer into two answers, perhaps addressing different topics/sections of the question
 
@Pimgd You hit the 30k limit on an answer?!
 
Why doesn't SE delete deleted questions/answers and old chat logs to save space instead?
 
@Hosch250 The log gets cleaned up every now and then. Deleted questions and chat logs have to be kept for a while for moderation purposes, from my understanding.
 
OK.
I've got Reviewer.
Now I need to answer a couple more questions and get Sportsmanship.
DVLR.
@Phrancis You still here?
 
-1
Q: C# Running a function every second

Ash SimpsonHello can someone review my timer class that runs some code every second please? the void its calling (runCode) is just a void with some code in it... http://i.imgur.com/UR6ktp1.png thanks!

 
4:56 PM
@Hosch250 Yup
 
Can you help me with a Twitter question?
 
I can certainly try
 
I keep getting emails from Twitter that Account A is following me.
Twice it has been the same account, and once it was not.
 
It's normal to get emails with new followers (though it can be disabled via Twitter preferences)
 
But when I check my account, they aren't following me.
That is the part I'm wondering about.
I have one new follower, and I didn't get an email about them.
I have gotten three emails, and they were false alarms.
 
4:59 PM
I'd rule it to a possible hiccup, although if it continues you may want to contact Twitter about it. I've not ran into that before.
 
OK.
I'm checking the email headers now.
 
BTW, be sure to let me know what your Twitter is once it's all good, I'll be sure and follow :)
 
Didn't you already?
It is Hosch250.
But, I'm am changing it to Learn OneNote.
I'm not a social media person - my app is though.
 
Ah ok, yes I did follow @Hosch250
I got a OneNote question: Does it work well on iOS devices?
 
Never tried.
My mom won't use it.
I've tried to get her to use Office, but she just uses iWork.
Then, I have to help solve a problem every few months because iWork's AI starts re-formating her documents.
AhhhHa!
It is C# Corner messing around.
 
5:06 PM
@Hosch250 Never used iWork. TBH, I do very little office-like work on the Mac
 
C# Corner has followed me twice and (presumably) unfollowed me immediately.
The other guy is the manager at C# Corner.
@CsharpCorner
 
> iWork for iCloud beta works with Microsoft Office.

It’s easy to work with Microsoft Word, Excel, and PowerPoint files. Just drag them to the Document Manager and make your edits, then share them in iWork, Office, or PDF formats via iCloud Mail.
Might need to try iWorks. I have Office for Mac but I find it lacking compared to the Windows version.
I mostly use the Mac for music and coding, OneNote might be a good way to keep all those projects organized though
 
For code inspections and code reviews, please post to CodeReview@StackExchange.com — Thomas Matthews 1 min ago
 
I think it might be a scam.
I compared two legit emails and one of their emails, and the two legit ones were slightly more similar.
Not sure though.
 
5:23 PM
Maybe you're just reading too much into it
 
Maybe.
Maybe they are just playing around with me
 
0
Q: Started working with OOP JavaScript - binding events in constructor?

rmorrinI am trying to get familiar with OOP JavaScript, in particular working with the prototype pattern and would love some pointers/suggestions on how to improve my code. I think I have understood the basics well, and have been able create class instances successfully. I am however, a little unsure ...

 
5:57 PM
You may get further on codereview.stackexchange.com for "make this [working code] nicer" type questions. — Drew Dormann 26 secs ago
 
0
Q: Is there a good convention for naming a function as both plural and singular

ThomasReggiIf you have a function that can take both cat (as a string) and cats(as anarrayofstrings`) like this: function makeCatOrCats(cats){ if(typeof cats == "string) cats = [cats] console.log("work with the array of cats, even if there's one") } Is there some convention that allows for naming the...

 
Off topic? No language tag...
 
Ok. Fair enough. Though I would not be able to use it due to code review issues. Defining a macro parameter that shall not be used would not go through, unfortunately. :( — Valeri Atamaniouk 34 secs ago
 
It's a good question to ask, in theory... But not necessarily here.
 
0
Q: Fetching ALL data set from API iterating via response data

ThomasReggiDoes this make sense? How would you achieve the same thing, with cleaner code? function retrieveBatch(offset){ var opts = {} opts.limit = 100 if(offset) opts.offset = offset return new Promise(function(resolve, reject) { chargebee.subscription .list(opts) .request(function(er...

0
Q: Efficient Strip Special Characters

azngunit81I have a private function in PHP that takes a given URL string and just leave the Alpha or numeric and certain punctuation left. I need the stripping of string due to having it match against ElasticSearch and ElasticSearch doesn't take it too kindly for special characters when it comes to exact m...

 
6:13 PM
And what is your question? Your code works, if you are asking us to critique this then that's too broad a subject for Stack Overflow. You can post working code on Code Review Stack Exchange to ask for improvements. — Martijn Pieters 1 min ago
 
0
Q: Float Images When Inside Floated Elements

TohuwThe code below is demonstrative of the problem. Don't read too much into the superfluous styles and widths, but they serve the example. I want to float the images to the left of the h2 and section elements, but this won't be solved as simply as a float, because of the way the aside containers wo...

 
6:32 PM
0
Q: Testing input validation and an AJAX request with Javascript and QUnit

user2201041I have a simple web page. The user enters the name and rank of a soldier and hits submit. If the input is invalid, an appropriate error message gets displayed. Otherwise, it adds the soldier to a database and adds it to a list of current Soldiers via AJAX request. Here's my Javascript for that: ...

0
Q: Extract an attribute value from XML using XSLT

Simon3389520I have got some XML produced by a Google Search Appliance: <GSP> <RES> <R N="1"> <U>http://www.url.com/</U> <UE>http://www.url.com/</UE> <T>Page title</T> <RK>10</RK> <CRAWLDATE>16 Feb 2015</CRAWLDATE> <ENT_SOURCE>######</ENT_SOURCE> <FS NAME="date" VALUE="2015-02-04"/> <MT N="pu...

 
7:00 PM
> Man, I wish google chat supported markdown.
 
Welcome to Code Review! I'm not sure this question is on-topic for this site yet. Per your question, "I get the error: Attempted to wrap undefined property undefined as function" is that what you are expecting to happen, or an unexpected error? — Phrancis 21 secs ago
 
7:17 PM
Thank you for this answer! Everything make sense, but I was wondering if it would be okay if I could post my code so yuo could take a look at it and tell me if I'm doing it in an efficient way. Or is that more fit for CodeReview? I have worked on it and I feel like I removed the N + 1 queries problem because I eagerly load the ActiveRecord associations within the class. — Sam Parsons 5 secs ago
@SamParsons If your code works now and you'd like to have it reviewed for improvements, then Code Review is definitely the right site for that. However, make sure you include all the code in your question. — Phrancis 55 secs ago
Guess you're right, it's something for codereview. Or if you definitely know, that the code is doing n+1, you could ask, why It happens, then it would fit stackoverflow Format. Either way, feel free to post it, i enjoy solving AR query problemsw — dre-hh 1 min ago
 
1
Q: Is my Ping Pong code laid out correctly and is it efficient?

aPyDeveloperI am learning C++ and SFML so I want to know if I am laying my code out neatly and if my code efficient. Thanks for helping! #include <SFML/Graphics.hpp> #include "ResourcePath.hpp" #include <iostream> class Paddel { int speed = 3; sf::Vector2f border; sf::Vector2f size; sf::V...

 
Plz provide a working project on github, additionally to the code review post. No Ui needed, just some seed data and the sql query. — dre-hh just now
 
7:34 PM
0
Q: Smart pointer mark II - my answer to C++ 11 shared_ptr

arcomberI am writing this smart pointer as a learning exercise. Any feedback would be most appreciated. Any flaws? Have I missed any test cases? smart_pointer.hpp: #ifndef SMARTPOINTER_HPP_ #define SMARTPOINTER_HPP_ #include <iostream> template<typename T> class sp { public: sp(T* ptr) : ptr_(pt...

 
8:01 PM
Fuuu internet at home is dead
 
0
Q: Simple calculator using eval

MhmdThe following code is for a calculator made in ruby, I find that this way saves much time than having to build this calculator from scratch, especially that I want it to support BEMDAS operations. However, I'm feeling that it is inefficient because I'm using eval, and I think this could be danger...

 
8:24 PM
@rolfl I got some information for you!
2*3*7 is the second sphenic number. 0x2A is also the number of partitions of 10.

Given 27 same-size cubes whose nominal values progress from 1 to 27, a 3×3×3 magic cube can be constructed such that every row, column, and corridor, and every diagonal passing through the center, is composed of 3 cubes whose sum of values is 42.
0b101010 is a Størmer number and a super-multiperfect number. It is a rep-digit in base 4. It is the atomic number of molybdenum. The Gutenberg Bible had 42 lines per page. On Jeopardy, Watson had 42 threads in its avatar. The board game Risk has 42 territories. +42 was the country calling code for Czechoslovakia.
 
hmmmmm
 
Once again, happy birthday ;)
 
That's a lot of 42 ... ;) and not a single mention of THHGTTG ....
 
I thought you knew that one already ;)
was that Watson thing your idea btw? :)
 
oh hey, happy birthday @rolfl!
 
8:31 PM
Nope, watson predates my time at IBM.
Thanks @janos - it's a long weekend... today's not my actual birthday, but I was basically offline over the weekend... so my first visit back.
 
hopefully it wasn't on Friday the 13th
 
Talking about 42, that is the answer to life, the universe, and everything (according to The Hitchhiker's Guide to the Galaxy).
Of course it isn't, really.
 
no way
 
42 (forty-two) is the natural number immediately following 41 and directly preceding 43. The number has received considerable attention in popular culture as a result of its central appearance in The Hitchhiker's Guide to the Galaxy as the "Answer to The Ultimate Question of Life, the Universe, and Everything". == Mathematics == Forty-two is a pronic number and an abundant number; its prime factorization 2 · 3 · 7 makes it the second sphenic number and also the second of the form { 2 · 3 · r }. As with all sphenic numbers of this form, the aliquot sum is abundant by 12. 42 is also the sec...
 
but what's the question?
 
8:38 PM
What is the answer to life, the universe, and everything?
I guess if rolfl is ever to be a genuis, it will be this year ;)
 
There's too many numbers in this chatroom
cut it out
 
The evils of eval
(Very punnish with adjusted pronunciation.)
0
A: Simple calculator using eval

Hosch250I do not know Ruby, but from my Python knowledge, it is not good to use eval in a real program. When you use eval, it executes the code directly, so accidental/experimental input can have unwanted results, or even destroy the system. Also, this has the potential for a hacker who has limited acc...

BBL
 
21 mins ago, by rolfl
That's a lot of 42 ... ;) and not a single mention of THHGTTG ....
 
@Hosch250 damn it, you revealed the secret of where my information comes from.
 
8:53 PM
As for a working GitHub project, would it be necessary for me to provide that? As it will be complicated to set up the seeds file, and I think you should be able to determine if I'm processing the data in an efficient way by looking at the CodeReview post. — Sam Parsons just now
 
0
Q: Ruby on Rails - Computing Overall Averages in my Web Application

Sam ParsonsI'm a senior Comp. Sci. major working on a senior design project for our faculty. The name of this project is "Gradebook", and it is responsible for allowing instructors to record grades for students and for students to check their grades in a class. This project is written in Ruby on Rails, and ...

 
@Duga I got that one
@CaptainObvious Wish there were more people coming from SO with well-written questions like that!
 
9:10 PM
0
Q: MazeSolver BFS in Scala

dxh// http://ideone.com/KIwrpc import scala.collection.immutable.Queue object MazeSolver { type Grid[A] = Array[Array[A]] type Indices = (Int, Int) type Opt2[A] = Option[Option[A]] type IndexGrid = Grid[Opt2[Indices]] type Predicate[A] = A => Boolean def validAndTrave...

 
Hello.
 
Hey.
 
What's up?
 
Nothing but 42.
And exams/discussions/videos for school.
 
@Hosch250 Huh?
 
9:18 PM
Scroll up a bit - you'll see.
 
@MannyMeng Not much, just refactoring some ugly HTML
 
@Phrancis I see.
 
Whoa.
This semester is already 1/3 done.
Leaving for a while - have a test to take.
 
9:32 PM
yay internet works again
also my brother (studying to be electrical engineer) has to program for his courses
he is a firm believer that less lines is better
That's good and well
until we start seeing lines as standardDeviation = sqrt((pow((askedValue1-average),2)+pow((askedValue2-average),2)+pow((askedValue3‌​-average),2)+pow((askedValue4-average),2)+pow((askedValue5-average),2))/5);
4
 
o.o
 
-1
Q: Guessing Number Game - No print statement and program doesn't start over

Brandi HunterI am having issues with this Guessing game. So far the program executes almost well enough, however, if the user inputs the correct number it doesn't print the print statement. Nor does the program start over again. #This program will generate a random number between 1 and 100. #It will then a...

 
welp I have "cleaned" it a bit but it's still 590 lines
time to play for today
 

« first day (653 days earlier)      last day (3370 days later) »