« first day (1007 days earlier)      last day (3022 days later) » 

12:00 AM
RELOAD! There are 1779 unanswered questions (94.2775% answered)
 
0
Q: YAGOP - Yet Another Generic Object Pool

ChrisWueWhile thinking about this question it struck me that one problem of linked data structures always seems to be loss of memory locality and performance could possibly be improved if all allocated nodes are in a contiguous block of memory. So hacked together an object pool implementation in C. The ...

 
Opinion... would a verbose regex interpreter utility class make more sense as instantiated object or static?
I was going for OO at first, but I thought that may just over-complicate things...?
Static just pass it a string and return a regex Pattern and be done with it
 
12:18 AM
@Phrancis I think both have their advantages, depending on the language you write it in.
 
I think it's OK here, but it could easily be turned into a code review question and migrated if you'd like. — Michael Myers ♦ 55 secs ago
 
@Mast It's JAVA
Maybe a good use case to make an inner static class?
 
@Duga I'm not so sure.
 
That's an SO moderator that I just spoke to.
 
and back
 
12:22 AM
0
Q: Checkboxes array to delete images

Ramsy de VosBasically I'm displaying an array of images on a page with checkboxes. The idea is when a user is editing a post and the checkbox is checked, the image will get deleted. Each image also has an order_id and description. I'm pretty new to Ruby and programming and I'm looking for a way to simplify ...

 
@CaptainObvious not working for anything other than throw-away test code involving literals. deleted. I need to walk the expression tree.
 
two hour long ui and meta discussion
 
> @Phrancis ...that too, but what would actually be useful would be the ability to evaluate a DateTime value that's part of the expression tree... in other words, without walking the tree I don't think comparisons will work. Oh crap, they won't work for any non-literal value. Ugh, this isn't working. I'm taking the post down. – Mat's Mug♦ 58 secs ago
 
I'm aware he's a moderator. But I don't think it will turn into a CR question 'easily'. OP doesn't seem interested in quality code.
@Mat'sMug A moderator posting broken code? ^^
Can happen to anyone, tests are important.
 
> Wow just now I realize, that DateTime handling is completely useless for anything other than throw-away test code that uses int literals. – Mat's Mug♦ 9 mins ago
 
12:24 AM
is there a more straightforward way to do this in numpy, that also makes the intention clearer? — seems like a quality question.
 
#DateTimes
 
@200_success I was more referring to how he'd currently set-up his code.
 
my coffee is cold >:(
-4
A: Risk battle simulator v2

Barry CarterThis doesn't really answer your question (and my code below may not even be correct), but you're effectively computing a recursive function, so something like this should work: int main() { int attackers, defenders, i, j; cout << "Enter number of attackers: "; cin >> attackers; cout <

 
-1
Q: Simple Javascript Vector

user96739var Vector = function(x, y) { if (!(this instanceof Vector)) { return new Vector(x, y); } this.x = x || 0; this.y = y || 0; this.clone = function() { return new Vector(this.x, this.y); } this.getLength = function() { return Math.sqrt(Math.pow...

 
@Mast well I did test it.. just not nearly enough
 
12:33 AM
Sounds familiar :-)
 
Crap, I need to learn expression trees in 24 hours.
 
@CaptainObvious Code dump, UWYA'd.
 
fires up VPN
 
@Mast you ought to leave a comment as well
 
I did
 
12:40 AM
@Quill Too tired.
 
12:51 AM
Ugh, my hopes for verbose regex in Java just got squashed. Java doesn't support multi-line Strings :|
deletes classes
 
@Phrancis Can't you use Pattern.Comments?
 
huh?
 
And use those in combination with "first part" + "second part"?
 
0
Q: Two and a sub strings

LegatoChallenge: Given two strings, A and B. Find if there is a substring that appears in both A and B. Specifications: Several test cases will be given to you in a single file. The first line of the input will contain a single integer T, the number of test cases. Then there will b...

 
@Phrancis, It seems like java should support something along the lines of:
Pattern p = Pattern.compile(
    "(\\d+)     # Group of numbers \n" +
    "([a-z]*)   # Group of lowercase letters\n"
    , Pattern.COMMENTS);
 
1:05 AM
I don't think it does though
 
If you feel like it you could of course split it into even more lines, and add more comments if you feel like it. For example it could be wise to allow start and end group on separate lines, which would make source control and changes display rather easily as they would trigger line changes
I haven't tested this exact version, but do try it. It should be legal (or very close to it)... :-)
 
0
Q: A simple drag and draw HTML5 canvas.

dwjohnstonI've written a quick directive that provides two features: Clicking on an empty area of the canvas will allow a 'drag and draw' function Clicking on a an existing rectangle on the canvas will allow a 'drag and drop' function. The primary thing I would like feedback on is whether my method fo...

0
Q: Evaluate whether string is in alphabetical order or reverse alphabetical order

Jae BradleyPurpose This problem comes from this question on the dailyprogrammer subreddit. Basically, the task is to write an implementation that identifies if the characters in a String are in Alphabetical order (A to Z) Reverse Alphabetical order (Z to A) Neither Alphabetical nor Reverse Alphabetical...

 
The key is to include \n in the pattern string, and use Pattern.COMMENTS.
 
That's great, but it's still not supporting multi-line... may as well do this
    String pattern2S =
        "([A-Za-z]+)" + //mandatory firstName
        "\\s+" +        //mandatory whitespace
        "([A-Z]\\.)?" + //optional initial
        "\\s+" +        //whitespace
        "([A-Za-z]+)";  //mandatory lastName
 
1:13 AM
Which multiline do you want? The multiline as in commenting, or matching in multiline texts? The latter achieved by using Pattern.MULTILINE?
 
Well you know how in Python you can do...
my_var = """hey look ma
i'm on multiple lines"""
Yeah, Java can't do that
 
@Phrancis Not exactly as that, you'll have to use string concatenation of sorts, but I do believe those would be optimised away by the compiler, so it is just a little extra to write. But if the main goal is to get clearer, understandable, editable (, source controllable) regex's, I'd say that using the "... # ... \n" + ".... # ... \n" and Pattern.COMMENTS would be the way to go
 
Ok thanks for the tips
 
When doing version controls, the changes would read a lot easier than single character changes which most likely will be garbled with other similar changes in the surrounding characters. Most diff-tools I've seen are not good at display inline changes (and definitively not within regexs)
 
Seems very few things are actually good with regex
 
1:23 AM
See stackoverflow.com/a/878704/1548472, with first comment backing my statement on this construct being optimised by compiler
 
1
Q: Note Management Program

SkyGood night everyone. I spent the last week or so building this pretty cool note management program written with JavaFX. . Buttons are the method used to switch b/w open documents, and the "notes" are converted to HTML documents using a simple syntax: Everything after HEADING on a single line is...

 
Regex is a beast, and it has its uses. It's a useful tool to have in your tool belt, and to write well documented regex or understandable regex is close to an art form. Sadly mostly tweak it around just enough to make it do what they think is the task at hand, and never look at it again...
 
^^ I get that feeling too
Write it once, never try to change it again, which is --maintainability IMO
 
@Phrancis So true... But using something like Pattern.COMMENTS might induce some maintainability into regex's. But you'll also most likely get some comments stating that it looks ugly, or ..., or whatever.
 
I guess if your code has a lot of regex it should probably be written in a language that supports verbose directly... or, read the verbose regex from a text file
 
1:35 AM
Reading it from file feels like it would be slower, in most cases, but as they say: "if life serves you lemons, make lemonade".
Or in other words, make the best out of it, and in the Java case I think that would be the string concatenation variant with Pattern.COMMENTS.
 
Yeah I'd want to stay away from reading a file as much as it can be helped, because then you have to account for all sorts of other things too (file missing, renamed, etc.)
 
It could possibly be handled by some configuration tool, and having dedicated configuration files with the regex's, which loaded them at startup (possibly in a worker thread of sorts). But that would usually put some distance between the regex and the code using it, and usually the regex benefits from being close to the code using it.
 
Very true
 
I once saw code where they had classes like: Search, SearchPart, ResultPart, FilterPart, and so on... At one level this kind of looked interesting, but it hid away all of the business logic into non-meaningful type named classes. The same can very easily be done with regex, so that is another tip in the night to try to give the pattern meaningful names indicating what the patterns are helping you to achieve instead of just calling it something like myPattern or similar
Oh well... TTGTB
 
1:59 AM
-1
Q: C++ Random String Generator

Archie GertsmanI decided to make a random string generator for fun, and it works for the most part. Since I'm an armature at programming, I thought I wold post the code to get some feedback on it, and hopefully improve any bad habits. #include <iostream> #include <string> #include <ctime> typedef unsigned int...

 
@holroy good night!
 
user image
3
 
That's awesome.
 
possible answer invalidation by Archie Gertsman on question by Archie Gertsman: codereview.stackexchange.com/posts/118949/revisions
If the code is working and you just want suggestions for improvement, you should post at codereview.stackexchange.com. Otherwise, you need to specify exactly what the problem is that you want solved. — chepner 48 secs ago
 
Seems more like a code review question than a common problem whose resolution could benefit anyone other than the asker. — oscilatingcretin 37 secs ago
 
Waiting at airport for plane to Vegas.
 
possible answer invalidation by Archie Gertsman on question by Archie Gertsman: codereview.stackexchange.com/posts/118949/revisions
 
3:54 AM
@Quill Juke my box :)
Cool song
 
0
Q: Take a list, make it a palindrome (too many cases?)

wegryisPalindrome :: (Eq a) => [a] -> Bool isPalindrome (x: []) = True isPalindrome (x : xs) = let equalEnds = (tail xs) == [x] theMiddle = take (length xs - 1) xs theRest = isPalindrome theMiddle in equalEnds && theRest i...

 
4:10 AM
0
Q: Lower the volume of my computer over time in Python

thumbtackthiefI wrote a program to gradually lower the volume of my computer when I go to sleep so I can fall asleep with TV or music on. This was my first time using argparse and I feel like there should be a cleaner way to deal with default values of optional arguments. Any other feedback of course also we...

 
@Quill Nice song. I think I've discovered a new favorite musical group.
 
4:21 AM
I have one of their other songs in my library and I didn't even notice
 
I need help from people who listen to emo
There used to be this big group that had a very popular song
in the music video there was a young boy taking care of his father
driving him around town and stuff
father had a lifeless look in his eyes
any ideas?
 
do you remember what year it came out (around about)?
 
Probably around 2000?
 
THAT'S THE ONE
muchas gracias
 
4:29 AM
sounds a bit like radiohead. pretty deadpan singing
 
You don't know it?
This was huge back in the day
Olden times
how did you find it if you don't know the song?
 
magic
 
All my searches brought me to MCR - black parade
 
back in the days when microsoft was still on top of the tech world
 
low blow
 
4:32 AM
give it a decade
i always preferred female vocalists for those kind of songs: youtube.com/watch?v=T0N5YblvT1c
 
That's hardly emo though
this is.. country or whatever
 
What is wrong with std::to_string()? Also this may suit better on codereview. — Constantin 42 secs ago
 
meh
 
@JeroenVannevel this is getting seriously awesome:
            var lambdaExpression = (LambdaExpression)expression;
            lambdaExpression = (LambdaExpression)Evaluator.PartialEval(lambdaExpression);

            var visitor = new FilterVisitor<TEntity>(lambdaExpression);
            var values = visitor.Values.ToList();
 
I have no idea what I'm looking at
 
4:43 AM
part of my new ToFilterExpression extension method
 
Which is part of .NET and what is self-written?
 
I copied a bunch of classes from MSDN and implemented an expression visitor
LambdaExpression is the only .NET BCL class there
 
what does this code do then?
 
I'm getting values populated with metadata containing the property's name and mapped table/field, the operator I'm supporting, and the evaluated value
so this:
 
6 hours ago, by Quill
trying to build conditional strings? are you crazy
 
4:47 AM
                var poNumber = "123456";
                var result = repository.Select(x => x.Number == poNumber);
I'm able to turn into PONUMBER = "123456"
basically what I was trying to do before, but the right way now
 
you're not insane anymore?
 
How are PartialEval and FilterVisitor implemented to do that?
 
I think the OP needs a code review. Head to codereview.stackexchange.com and yes, it's ok for learning but perhaps not so for production code. — legends2k 13 secs ago
 
I'm not sure I got FilterVisitor working right though... I need to figure out a way to tell what operator is being used between each value I'm getting
 
4:54 AM
@Mat'sMug Did I understand correctly that the values you are getting are code as string?
 
@Phrancis I'm turning an expresssion tree into a string, yes
 
Zak
monking @all
 
Hi, @Zak
 
@Mat'sMug Some pieces of the code made me think that you might be turning these into SQL queries, though I'm probably wrong
 
hi!
@Phrancis it's almost exactly that
just the where clause though
 
4:57 AM
Define "almost"?
Ah ok
 
it's not exactly SQL, it's a 3rd-party API that requires a string filter
 
@Zak yo
@Mat'sMug it's probably a pretty shitty api then
 
lol, you have no idea
I'm pretty happy with my wrapping
 
something tells me you're gonna have a smile on your face later on when you type "TTQW"
and then you'll dance out to your car
 
lol, it's midnight here
 
5:01 AM
Look, recipe, if I knew how much was gonna taste good, I wouldn't need you.
3
 
^^
 
I'm VPN'ing over to my office laptop
 
what. go to bed
 
@RMunroe LMAO
 
-1
Q: writing in td using javascript

siva phanindra DaggubatiI have accessed a table data,td, element using getelementbyid in JavaScript. Some tags here document. getElementById("demo").innerHTML="hello"; The problem is this, I am seeing the string hello in the td cell.But it is vanishing soon after the script is over.What is the solution.

 
5:18 AM
almost there
dang, how do I pick up the operator between the two parts of the expression...
 
0
Q: Command called 'sprinkle'

Parham DoustdarI have a command called sprinkle. I'm not going to explain anything about it, because I want whoever that reviews the code to also tell me how much of the command documentation they understood. Here is what I need help with: Is the documentation good enough? Is it too verbose? Does the constan...

 
HURRAY! IT WORKS!
well, sort of
I can't have the Values return a list of expression metadata.. I need the visitor to actually generate the string I'm looking for
 
> I'm not going to explain anything about it
 
otherwise I get { "OR", "AND", "foo = A", "foo = B" }
hmm wait, I need a stack. ...or a queue? no, a stack.
crap
 
5:35 AM
 
yup, RT'd that earlier this week ;-)
 
sounds like your code needs a cr
 
soon as it works
 
> GITarHeroMasterMode
5
 
is that RD's repo?
 
5:43 AM
No, thank heaven!
 
lol
 
why would you ever need that many branches
 
Hehe, I have 56 commits since the first of the year. @Mat'sMug comes in second with 4.
 
have I told you how awesome a contributor you are lately?
 
Yes.
I sometimes feel guilty because, for example, just now I did two merge PR's. One to fix the bug and another to unit test it.
I forgot about the unit test until after I'd merged the first.
That makes my contributions seem higher than they really are.
 
5:49 AM
meh
 
I need to hurry up and make a project worth working on
@Hosch250 56 in a month
that's like two every day
 
I did a bunch in a row when I reinstated the unit tests.
 
gah, so close
"PONUMBER = 123456 AND ORDEREDON >= YYYY01DD OR PONUMBER LIKE \"%123\""
 
C#QL
 
-2
Q: Solution to king kohima problem in python

Ravinder BaidI have tried this code in python can one tell me is this the right solution for king kohima's problem def binary(i): r=str(0) while(i): x=str(i%2) if(x=='1' and r[-1]=='1'): return None else: r=r+str(x) i=i/2 return r m=3 l=...

 
5:53 AM
"PONUMBER = 123456 AND ORDEREDON >= 20160105 OR PONUMBER LIKE \"%123\""
Victory!
 
Testing Rubberduck commit by commit: github.com/rubberduck-vba/Rubberduck/issues/889
All but one section of unit tests reinstated, and 9 new features tested.
4 of the 9 are refactorings, and those get very large test suites and usually involve several bug fixes, so it is more work than it sounds.
We have 549 unit tests enabled, and the main project is 31% covered.
Just 7 of those unit tests fail, and two of those are just so we remember them - the actual fail is in the resolver.
I should probably change them back to Inconclusive.
 
nice
 
FYI I just un-deleted this:
4
Q: Something like a LINQ provider

Mat's MugOk, before you ask: yes, I need to do this. Sort of. I'm wrapping a 3rd-party API for data access, and I can't use an ORM, so I'm implementing this kind of thing: public interface IRepository<TEntity> where TEntity : class, new() { /// <summary> /// Projects all entities that match spec...

Protip: you might want to reword your post to clarify that then ;-) — Mat's Mug ♦ 9 secs ago
 
> var po = repository.Single(x => x.Number == "123456");
shouldn't that be more like linq
 
6:05 AM
it's not linq
 
var po = repository.Where(x => x.Number == "123456").Single();
 
it's like linq
 
@Quill What? That isn't the linq style.
 
        public override IEnumerable<PurchaseOrderHeader> Select(Expression<Func<PurchaseOrderHeader, bool>> filter)
        {
            var searchFilter = filter.ToFilterExpression();
            _headersView.Browse(searchFilter, true);

            if (!_headersView.GoTop())
            {
                yield break;
            }

            do
            {
                yield return ReadEntity();
            }
            while (_headersView.GoNext());
        }
^^ this is the implementation
 
You would use repository.Single().
 
6:07 AM
totally not an ORM
 
For your technique, you might as well just check the Count.
 
yet the API makes it feel like LINQ-to-SQL
    public override PurchaseOrderHeader Single(Expression<Func<PurchaseOrderHeader, bool>> filter)
    {
        var result = Select(filter).ToList();
        return result.Single();
    }
^^ throws an InvalidOperationException if there's not exactly 1 record matching the filter
 
TTGTB.
 
@Hosch250 night
 
later!
 
6:37 AM
> public class StringCharactersInAlphabeticalOrderEvaluatorImpl implements StringCharactersInAlphabeticalOrderEvaluator
That's just the first line.
 
lovely :)
 
If your code is working and you are just looking for improvement, have a look at codereview.stackexchange.com . Questions like these are usually off-topic here on StackOverflow — T3 H40 29 secs ago
 
0
Q: Wrapping the Sage300 View API with... a Repository

Mat's MugRelated: Something like a LINQ provider I needed to work with the Sage300 View API. I had never worked with it, but my first impression has been that the API is stringly-typed, and makes you write very procedural and repetitive code. So I decided to make my life easier, and wrap it with a fam...

 
I'm out
hmm... should I have refrained from identifying the 3rd-party API in question?
 
Zak
6:55 AM
@Mat'sMug GO TO BED :p
 
7:35 AM
hey guys guess what
I've got a NULL baby, and I'll SQL UPDATE your name
 
7:52 AM
@Quill Nudge nudge, don't you think I've thought about that already? It's on my TODO-list.
Unfortunately, my TODO-list is about as big as @skiwi's list of open tabs.
5
 
8:17 AM
0
Q: The final local variable unreaad cannot be assigned, since it is defined in an enclosing type

Gourav Sharmapublic String readmsg(String uid, String fid, String pid) { // public final String unreaad; final String unreaad; String urll = "http://xxxxxxxxxxxxxx.com/api/read_unread_msg_api.php?sender_id="; String url = urll + uid + "&reciver_id=" + fid + "&property_id=" + pid; Log.d(...

 
8:37 AM
0
Q: creating rbac in php

Rudi Cahyanhow to make creating rbac in php ? Give me an example, please I need a simple example to complete my project, in my project I need role base access control settings that can be accessed and updated by admin

 
@SimonForsberg Are you sure? Nothing is as big as @skiwi's list of open tabs.
@CaptainObvious No code, no clue.
@Quill That's a misleading username.
 
9:00 AM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Implementing a (small) full-text search in Ruby
 
9:18 AM
Gaaaaaaaah.... I've implemented a library for a layout in our work project, turns out that library is buggy as shit and the owner of the library won't fix any bug and is instead relying on PRs...
I guess that's the downside of OSS.
 
pretty much
they do enough for people to use it, and then they step back and say "do it for me"
 
9:46 AM
0
Q: Parallelizing an algorithm with OpenMP using a dynamic work queue

alcedineI'm looking for comments on the design, correctness and performance (not so much style) of a dynamic work queue for OpenMP worker threads. I have an algorithm that can be thought of in terms of some number of work items (how many is not known beforehand), each of which is executed and may then s...

0
Q: Random word display on LCD using Arduino Uno

moonisi m a beginner in coding as well as arduino.. I am working on a project for college in which i am attaching two LCD's to single arduino uno... the lcd's have to display random words from the words list. when i attach one lcd to arduino LiquidCrystal lcd(7, 8, 9, 10, 11 , 12) it works perfectly b...

 
I'm totally out of project ideas... awesome
 
Implement a splitter that works in Angular, lol
 
wat
 
This splitter is the one I'm using in our work project and it's so buggy
Click collapse, then uncollapse, to see what I mean
The bottom section should expand back to 30% but instead it expands to the size of the splitter (the default size).. if you set min-size on it, it works, but then you can't resize the section any smaller than min-size, which defeats the purpose of the library
Worst thing is it works perfectly fine with older versions of the library
 
10:02 AM
hmm, I have a working plugin like that in my solution for work
surely there's other solutions
 
10:25 AM
0
Q: Make a command line application with parameter

Charly RochI made a command line application which uses parameters. So I try to make a system like the linux command. So I have 4 parameters, initialized to a default value, used if wrong or none parameter are given. The user can modify those parameter by calling associate options "-options". public sta...

0
Q: This sample code using pivot table - SqlServer is okay?

nandox--Using Dinamic Pivot Example --Drop temp table if object_id('tempdb..#pvt_temp') is not null drop table #pvt_temp --Create temp table begin try create table #pvt_temp ( cLinID int, cLinDescr nvarchar(MAX), cColID int, cColDescr nvarchar(MAX)...

 
10:50 AM
Monking
 
monking
 
@Quill Go do some other stuff, the ideas will come back soon enough
 
> back
 
0
Q: List of Files in any Folder - Scala

Prabhat KashyapI have written a code to count the number of files in a folder and if there are any folder inside folder it will count the files in that folder too. import java.io.File class GetFileCount { def getFilesCount(dir: String):Int = { val file = new File(dir) require(file.exists() && file.is...

 
I don't think they were ever there
 
10:53 AM
Obviously the solution is to become a game developer,
 
Play games, see you need help in playing them, code the help, profit
 
I've got several ideas that cannot be done ever because I don't have that much spare time
 
@Pimgd I actually have the unity installer running right now
 
I mean, its easy, you start as a stupid teenage kid, declare you want to make your own mmo, and poof gone is 10 years
 
lol
 
10:55 AM
It's time to check if I can find any info on linearizing a dependency tree
@Pimgd Don't you need something like dedication fo rthat?
 
I'm content with ragequitting mmos, I couldn't make one
 
Unless you're sensible enough to stop before that / recruit some help to make sure your tech stack is still new when you release
@skiwi Dedication? Nah, it's just tinkering on the component parts
like, building inventory management systems
 
one of the projects I was doing at work was pretty cool so I might get permission to OSS it and maybe work it when I don't have anything better to do
 
a lot of time can go into that if you look at the mechanics and not at the story or the goal or what the game is supposed to be
 
Monking
 
10:57 AM
Literally "I want to make an RPG, and an RPG has..."
will keep you occupied for a long, long, long time
 
@DanPantry monking again
 
Basically, if you have too much spare time, take an old project (doesn't have to be yours) and get second system effect/syndrome
 

« first day (1007 days earlier)      last day (3022 days later) »