« first day (509 days earlier)      last day (3507 days later) » 

12:04 AM
@RubberDuck By the strictest defintion of "broken", I'd say no.
 
@nhgrif long time no see! Been alright?
 
And it doesn't take knowing Swift. Just read the "problem" description.
 
Often you're right, but I'm always hesitant to vtc as broken when I'm not comfortable with the language.
Has the mug been around? I found bugz.
 
And actually, this question probably isn't very answerable.
Because the real answer to his question is that Swift isn't very good with arrays in loops with default optimizations.
 
0
Q: Mini Binary Tree "library"

CarcigenicateThis is my first attempt at learning binary trees. I'm looking for general feedback on how it could be made cleaner, more idiomatic, or more efficient. data Tree a = ETree | Node (Tree a) (Tree a) a deriving (Show) tInsert :: Ord o => o -> Tree o -> Tree o tInsert x ETree = Node ETree ETree x t...

 
12:21 AM
I'm back
 
Evidently so!
 
I've just edited Anna's answer. D:
 
Parent teacher interviews.... what a night.
 
@Jamal Did you start to learn Java ?
 
0
Q: Reflection in VBA, getting the vbext_ProcKind

RubberDuckThis is a follow up to Extending the VBAExtensibility Library. It turns out that code had a really nasty bug. Anytime vbeProcedure.StartLine got called, I was running the risk of hitting runtime error 35 because CodeModule.ProcStartLine has to be told what kind of procedure it's looking for. Ever...

 
12:27 AM
Project 3 hasn't been assigned yet, so no.
 
Ohhh what did you learn yet ?
 
Inheritance, polymorphism, threads, and UML.
 
Thread in Java or in general ? (And it's probably everything you already know ? )
 
Just Java. I'm already doing general threads in parallel programming.
 
-1
Q: how do you restart the program

Stargazer77i have a program that asks two questions, and does what you ask it how do i have it start again when its finish to asking the questions again?

 
12:41 AM
I feel bad for new users who take all the time to set up their profile on CR, etc. and then post an off-topic question like this @CaptainObvious
 
Same can be said about spammers. :-)
 
@Phrancis yes and no... i mean, on the ask question page it specifically says "The relevant code sections must be included in your question"
 
I feel no pity for spammers.
 
Good point.
 
Of course. But, spammers expect eyeballs, but ideally they'll only be seen by a few people or just one person.
But at least the new users can be educated, although even those questions may be deleted quickly.
 
12:46 AM
maybe that line should be in bold
 
It may not help. Some people just post right away.
 
along with "your code must work correctly; we do not fix broken code"
that's true
 
OP self-deleted.
 
maybe if it was the placeholder text in the question box (only half serious)
 
Why only half serious? Not a terrible idea.
 
12:52 AM
not sure of the level of work required, if that's customisable per SE site, etc
 
0
Q: c++ Vs. Java scanning file run time

phoenixI'm not an expert in programing, and what I did is converting code in java to c++ The code is large, and to give an example, even simple code for scanning file take 60 seconds in c++ while it takes less than seconds in java The data file is a text file has 10k lines, each line contains vector o...

 
@CaptainObvious you're not an expert in grammar either.
There, better.
 
@Jamal this looks wrong to me, can you confirm? std::vector <std::vector<Ss >> Arr;
 
@bazola awake?
 
1:08 AM
> You can use huge salts or many salts or hand-harvested, shade-grown, organic Himalayan pink salt. It doesn’t affect how fast an attacker can try a candidate password, given the hash and the salt from your database.
Nice one @mjolka
 
Lol. Where'd you find that @Phrancis?
 
0
A: Slowdown when swapping between views

nhgrifYour whitespace, both vertical and horizontal, is arbitrary and distracting and needs a lot of work. Xcode automatically inserts 4 spaces when you push tab. It also automatically indents virtually everything for you. Rarely is there ever a need to argue with Xcode's spacing (and Xcode is the o...

 
Salts Will Not Help You: I would disagree with this. If you have a thousand passwords, with salts an attacker can check one password at a time. Without them, they can check a thousand passwords at a time. — tim 6 hours ago
 
@mjolka That's correct. It's a vector of vectors of type Ss.
 
1:22 AM
Ughhh. I should be working on my code since I squished the bug. Too tired. Maybe tomorrow.
 
Get a beer man. You've fixed enough code for a day. :)
 
Exactly. I fixed code when I needed to be writing new code. sigh Beer it is though.
2
 
@Jamal i meant the spacing in particular, i thought it had to be std::vector <std::vector<Ss> > Arr;
@Phrancis i can't take credit for that, it's from the article i linked :)
 
hey @nhgrif
 
@mjolka I don't think it matters, but it is kinda weird. The only thing that makes a difference is the last two closing brackets.
 
1:34 AM
I think I need a beer too...
declare @NumberOfBeats int;
set @NumberOfBeats = (111 * 4);
declare @LengthOfSong time;
set @LengthOfSong = '00:03:21:921';
declare @LengthInSeconds int;
set @LengthInSeconds = (
  select convert(
    int,
    datediff(
      cast(
        (second,
        current_timestamp,
        (current_timestamp + @LengthOfSong))
      ) as time
    )
  )
);
-- select @LengthInSeconds;
-- Result is 202 seconds
select cast(
  ((@NumberOfBeats / @LengthInSeconds) * 60)
as decimal(6,3)
);
> An expression of non-boolean type specified in a context where a condition is expected, near ','.
 
@Jamal i get "blah.cpp:8:29: error: '>>' should be '> >' within a nested template argument list" using g++ 4.5.2
either way, there seem to be plenty of errors in that code
blah.cpp: In function 'void scanData()':
blah.cpp:14:13: error: 'FileInp' was not declared in this scope
blah.cpp:24:32: error: variable 'std::stringstream data' has initializer but incomplete type
blah.cpp:29:25: error: 'class std::vector<Ss>' has no member named 'a'
blah.cpp:32:25: error: 'class std::vector<Ss>' has no member named 'a'
blah.cpp:32:34: error: 'vLayOut' was not declared in this scope
blah.cpp:35:21: error: 'class std::vector<Ss>' has no member named 'b'
blah.cpp:36:21: error: 'class std::vector<Ss>' has no member named 'c'
and that's after fixing a few of them
 
Yes, they must be separated if the compiler doesn't support C++11.
 
ahh thanks
 
Bearing those errors in mind, this can be closed.
 
Combine bad music to fix, and bad SQL to help try to fix the music... and you got... my life!
 
1:47 AM
I was rambling about what IBM does...... here's a newly announced one:
IBM gets in to air conditioning and power generation, both at the same time: computerworld.com/article/2687236/…
 
1:59 AM
Next thing you know, we'll be creating an extended warranty for it...
It does sound really cool, though.
 
`2000 degrees is cool?
 
Only metaphorically
e.g., digital watches are cool, but the sun is also cool.
 
2:20 AM
I'm pretty sure codereview.stackexchange.com/questions/63817/… is invalid code, but can someone else take a look? In particular, Arr is of type std::vector<std::vector<Ss>> but it's being accessed as Arr[idx].a... And a lot of other things are off about both the Java and C++ code >.<
 
Yeah, it should probably be closed.
 
2:35 AM
Alright. Just wanted to make sure I wasn't losing my mind :p
 
2:50 AM
This seems... reasonable?
<?php
$index = 1;
$lastIndex = 100;
$fizzWord = 'Fizz';
$fizzNumber = 3;
$buzzWord = 'Buzz';
$buzzNumber = 5;
// check for duplicate numbers
if ($fizzNumber == $buzzNumber) {
	echo 'Please select different number for Fizz and Buzz';
}
// run the algorithm
else {
	for ($index = 1; $index <= $lastIndex; $index++) {
		  if ($index % $fizzNumber == 0 && $index % $buzzNumber == 0) {
		  echo $fizzWord . $buzzWord;
		}
		elseif ($index % $fizzNumber == 0) {
			echo $fizzWord;
		}
		elseif ($index % $buzzNumber == 0) {
 
@skiwi what do you think of the Collatz in Java8 now?
hmmm.... edit time.
@Phrancis Looks legit
Any reason for the same-value exlusion though?
 
Yeah... Sanity?
 
sanity will be maintained even without the exclusion ... it produces the right result.
 
That's true
Users could be insane, doesn't mean the program should compensate for it... ?
 
@Phrancis $index = 1; ... for ($index = 1;
 
2:56 AM
Yeah, I forgot to fix that ^^"
 
you could also introduce a new variable, $fizzBuzzWord = $fizzWord . $buzzWord
 
TTGTB .. night all.
 
This is... better... I guess:
 
@Phrancis also might want to check that $fizzNumber, $buzzNumber != 0
 
0
Q: Poly class C++ code

NeaI'm looking for some assistance on an exercise for my C++ programming class. Unfortunately, I was rather ill the previous week an was unable to attend class, meaning I have only been able to use the textbook as a resource. I have done my best to complete the exercises, but, both because of my abs...

 
3:02 AM
<?php
$index = 1;
$lastIndex = 100;
$fizzWord = 'Fizz';
$fizzNumber = 3;
$buzzWord = 'Buzz';
$buzzNumber = 5;
// check for duplicate numbers
if ($fizzNumber == $buzzNumber) {
	echo "You have selected the same value for Fizz and Buzz. Your output is as follows:<br>\n";
}
else {
	echo "Your ouput is as follows:<br>\n";
}
// run the algorithm
for ($index = 1; $index <= $lastIndex; $index++) {
	if ($index % $fizzNumber == 0 && $index % $buzzNumber == 0) {
		echo $fizzWord . $buzzWord;
	}
	elseif ($index % $fizzNumber == 0) {
Oh, good idea @mjolka - avoid a "divide zero by X error"
<?php
$index = 1;
$lastIndex = 100;
$fizzWord = 'Fizz';
$fizzNumber = 0;
$buzzWord = 'Buzz';
$buzzNumber = 5;
// check for zero values
if ($fizzNumber == 0 || $buzzNumber == 0) {
	echo "Please enter non-zero value for both Fizz and Buzz numbers.<br>\n";
	break;
}
// check for duplicate number values
elseif ($fizzNumber == $buzzNumber) {
	echo "You have selected the same value for Fizz and Buzz. Your output is as follows:<br>\n";
}
else {
	echo "Your ouput is as follows:<br>\n";
}
// run the algorithm
Hmm
> Please enter non-zero value for both Fizz and Buzz numbers.
E_ERROR : type 1 -- Cannot break/continue 1 level -- at line 11
Any smart way to eliminate the 2nd line, generated by PHP? (apparently)
 
@Phrancis you can't break outside a loop or switch
 
Do you know a better way to do this? If I don't break; I get something like this:
> Please enter non-zero value for both Fizz and Buzz numbers.
E_WARNING : type 2 -- Division by zero -- at line 22
E_WARNING : type 2 -- Division by zero -- at line 25
Fizz
E_WARNING : type 2 -- Division by zero -- at line 22
E_WARNING : type 2 -- Division by zero -- at line 25
Fizz
 
return?
 
BEAUTIFUL!
Dog I wish I understood this stuff better. Thanks @mjolka
 
np :)
you'll get there
 
3:18 AM
Should one return; in all if statements in PHP?
 
it depends, return will end the execution of the current function or script, so if that's the desired behaviour then yeah
 
Makes sense, sort of (to me)... I'm curious as to what a program returns to. But maybe that's a bit deeper than I'm ready for now
 
actually there's some disagreement on using return in global scope here php.net/manual/en/function.return.php (i don't write php, so idk)
 
$fizzNumber = 0;
should that be $fizzNumber = 3;
 
Yeah, normally. Just testing out error-catching
 
3:24 AM
Ah ... makes sense
 
This is what I have so far @JamesKhoury
<?php
$index = 1;
$lastIndex = 100;
$fizzWord = 'Fizz';
$fizzNumber = 3;
$buzzWord = 'Buzz';
$buzzNumber = 5;
// check for zero values
if ($fizzNumber == 0 || $buzzNumber == 0) {
	echo "Please enter non-zero value for both Fizz and Buzz numbers.<br>\n";
	return;
}
// check for duplicate number values
elseif ($fizzNumber == $buzzNumber) {
	echo "You have selected the same value for Fizz and Buzz. Your output is as follows:<br>\n";
	return;
}
else {
	echo "Your ouput is as follows:<br>\n";
}
// run the algorithm
 
Hi @all!
@Phrancis my php skills are sub-par at best
 
That makes 2 of us :)
 
@JamesKhoury noooo wayyy
this is going to be a long day i.imgur.com/TRuJ7Ag.png
 
3:36 AM
Ouch
Whoops, FizzBuzz over 100K numbers is a bit slow.
 
@Phrancis I think thats normal?
 
0
Q: Error-handling in Django model-adding form

felixphewI am writing a book database, and ultimately a library system, in Django. When a book is created without a title set, the ISBN will be used to automatically fetch book data from WorldCat I have just created a form to add new books to the database, but it has no real error-handling. Also, as I am ...

 
I guess it is, @JamesKhoury
 
3:58 AM
this answer needs more upvotes codereview.stackexchange.com/a/63822/44723
 
4:35 AM
<html>
<code>
<?php
$index = 1;
$lastIndex = 100;
$fizzWord = 'Fizz';
$fizzNumber = 3;
$buzzWord = 'Buzz';
$buzzNumber = 5;

// check for zero values
// exit program if any value is zero
if ($fizzNumber == 0 || $buzzNumber == 0) {
	echo "Please enter non-zero value for both Fizz and Buzz numbers.<br>\n";
	return;
}

// check for duplicate number values
// but continue on even if duplicates are found
if ($fizzNumber == $buzzNumber) {
	echo "You have selected the same value for Fizz and Buzz. Your output is as follows:<br>\n";
 
-1
Q: how to take 2 varibles average and return the larger one

Mark GuidoneThis is my code so far, i keep getting "first" when the answer is "second" var first = ( [100,80], [100,100]); function compare(a,b) { sum = 0; for(var i=0; i<a.length;i++) { sum += first[i]; avg1 = (sum/len); } sum2 = 0; for(i=0;i<b.length;i++){ su...

 
Best I got so far. Still quite the newb.
 
@Phrancis for ($index; ?
 
What about?
 
it looks weird. i think you want either for ($index = 1; ...) or for (; ...)
 
4:44 AM
If I was to be very verbose I would have written: for ($index = $index; ...)
What is the better/simpler syntax?
 
declare it as close to use as possible, so remove the line $index = 1 and just use for ($index = 1; ...)
 
for ($index = 1;...) reassigns the value of the variable (I think?)
 
yes, but you're not using it anywhere else
 
Oh.
Is it better to declare a variable mid-script, as opposed to the beginning?
 
(i don't know php's scoping rules, but...) i think in general, declare a variable as close as possible to its first use
 
4:48 AM
-1
Q: How to make this a more simpler version? i.e. more beautiful for my proofessor

Mark Guidonegive the avarage of the 2 arrays, and the spit out the larger of the 2. This is what i have var first = ( [100,80], [100,100]); function compare(a,b) { sum = 0; for(var i=0; i<a.length;i++) { sum += first[i]; avg1 = (sum/len); } sum2 = 0; for(i=0;i<b.length;i++)...

 
How to make this a more simpler title? i.e. more beautiful for Code Review people
 
Three bad questions in just two days. Time to take action.
 
At least they're all sporting Ottawa "Senators" hockey jerseys... that counts for something, right... right? :) Chicago Blackhawks jerseys.
 
i need friqing help okay! — Mark Guidone 37 secs ago
 
That's not a very good start. But it seems clear that he's just here for the answers.
 
5:01 AM
Monking
My guess he is just late for his homework and has no idea what he is doing if (false) {}
 
wow, i missed that if (false)
 
Obviously. I guess I'm not used to these same situations. Anyway, they fair game for deletion now.
 
His indentation seems all over the place, for one...
sum & sum2 seems odd compared to avg1 & avg2 ...
Is it standard to call a variable i?
 
@Phrancis No, standard is to call a variable jzlH2E3lhuzr99jnjy
4
It is more readable
 
shit, gotta go rewrite a lot of code...
 
5:11 AM
I should stick with SQL...
Sep 19 at 18:01, by Phrancis
<?php
// I might regret this
echo 'Hello, World!';
?>
 
@Heslacher what if you have, say, a nested loop? what's the standard for the inner loop variable?
 
@mjolka You won't want to know this.
@Phrancis
<?php
// I might regret this
$jzlH2E3lhuzr99jnjy = 'Hello, World!';
echo $jzlH2E3lhuzr99jnjy;
?>
 
for (int jzlH2E3lhuzr99jnjy; jzlH2E3lhuzr99jnjy < n; jzlH2E3lhuzr99jnjy++) {
    for (int jzlH2E3lhuzr99jnjz; jzlH2E3lhuzr99jnjz < m; jzlH2E3lhuzr99jnjz++) {
        sum += matrix[jzlH2E3lhuzr99jnjy][jzlH2E3lhuzr99jnjz];
    }
}
 
I guess I have been warned.
 
@mjolka I like this. Asking questions where you already know the answer.
 
5:15 AM
it just seemed logical
 
5:26 AM
@mjolka New profile picture ?
 
> Substance over Style
Well, damn
 
@JaDogg yeah, i hoped it would inspire me to study graph algorithms. it didn't.
 
haha :D
 
0
Q: Is the way using `Regexp` what i use the best to select the date from the string?

3gwebtrainI have a string with date details with time. But I would like to show the day information alone. for that, I use the regexp to select the date. can any one tell me the regexp, what is used is the correct one? if any better practice, let me know... thanks in advance! here is my string: 2014-09...

 
5:43 AM
Mark, This is what we call broken code, Because it doesn't do what you want it to do, And probably written in frustration and anger. Come back when you have working code, written by yourself, achieving what you want, and you understand what it does enough to explain it line by line (at least 70% is understood). — JaDogg 56 secs ago
@mjolka there are some good algorithm courses in coursera.org
 
@JaDogg thanks :) i'm actually taking algs4 on coursera at the moment
 
@mjolka Nice. me too, I'm wayyy behind schedule however
 
@JaDogg oh cool! i've done the first two programming assignments, but that's all. hard to find time after work. where are you up to?
 
@mjolka only first one done,
@mjolka First one, it's the Percolation thing right ? got 100% after 4 tries
 
5:59 AM
yeah, percolation is the first
then queues
 
Thanks @Santa
 
Monking
 
Monking @skiwi
 
MONKING -- and TTGTB
 
TTGTW :)
 
6:11 AM
How to star more LOLs : attract new users to 2nd Monitor, After few minutes (due to heavy sarcasm in 2nd Monitor),they will post LOL, star it. Muwahaha
2
 
6:38 AM
@JaDogg LOL
@rolfl Your attempt is quite nice, though it still looks hackish (due to using Java 8) and does it need in-memory storage? Or is the Spliterator there to prevent that?
So I made spaghetti a week or two ago, and now I'm trying to fix it
 
6:56 AM
0
Q: Shortening my code for this game

Ami RuksharI have made this small game called 'Guess the word, save yourself'. I want to make the code shorter. But how can I do that? Please see the code and give suggestions. I will greatly appreciate it. Also how can I improve the display to make it seem more attractive? http://pastebin.com/dnWnYc4g Th...

 
pastebin.com/9e9A8YNh I made it a few weeks ago
 
@CaptainObvious off-topic, and makes me think we really should change the placeholder text in the ask a question box
 
@JaDogg Not exactly me, the me from 2 weeks ago wrote that
 
nvm misunderstanding
 
@JaDogg: Although I did not intentionally reject your suggested edit, I would've done so anyway. As per policy, the OP must be the one to embed the code.
 
7:04 AM
@Jamal ah, nice
 
I need to slap my old self, I already made replacement code for that, which is way cleaner:
public Stream<List<Word>> findWordsByLevenshteinDistance(final String targetWord, final UnaryOperator<String> mapper, final String delimiter) {
    LevenshteinDistance levenshteinDistance = new LevenshteinDistance();
    return getAllTextlines()
        .flatMap(textline -> textline.getAllWordNGrams().stream())
        .sorted(Comparator.comparingInt(wordList ->
            levenshteinDistance.calculate(mapper.apply(
                String.join(delimiter,
                    wordList.stream()
                .map(Word::getWord)
I still feel it needs one more level of abstraction at the bottom part, but for that I first need to figure out what I was doing there
 
how can I improve the display to make it seem more attractive? -> That's asking for a new feature, not on topic for code review SE. — JaDogg 33 secs ago
@skiwi what's faster streams or for loops ?
 
@JaDogg Streams can do things more concicely
public Stream<List<Word>> findWordsByLevenshteinDistance(final String targetWord, final UnaryOperator<String> mapper, final String delimiter) {
    LevenshteinDistance levenshteinDistance = new LevenshteinDistance();
    return getAllTextlines()
        .flatMap(textline -> textline.getAllWordNGrams().stream())
        .sorted(Comparator.comparingInt(wordList -> {
            String mappedWord = mapper.apply(Word.mapListToString(wordList, delimiter));
            return levenshteinDistance.calculate(mappedWord, targetWord);
Refactored a bunch ;)
Now I can understand it
 
monking
 
7:16 AM
@mjolka disagree... this will have the same problem as the "How to Ask" section, but it will vanish as soon as you type the first letters.
 
-1
Q: Request for placeholder text in the question textarea

mjolkaAfter seeing a few off-topic questions today, I thought it might help to add placeholder text to the question texarea. The question page currently looks like this: "How To Ask" is easy to miss or gloss over, and has emphasis on the wrong part ("code from projects you are working on for peer r...

 
Okay let's make this simple... We only review code. We require this code to be written by you and accomplish the task it was crafted for. We also do not help with implementing new features or asking design questions. Please take a tour and read our help center. — Vogel612 12 secs ago
facepalm...
 
-1
Q: Is it better to set the Javascript selectedIndex property using server side python or client side javascript?

Frank I have a web architecture question. Is it better to set the Javascript selectedIndex property using server side python or client side javascript? Once I find this question's answer, how might I dynamically set the Javascript selectedIndex property so that cgi.FieldStorage() retains the corr...

 
7:38 AM
-1
Q: C++ memset() memory overflow

overshadowI am new to C++. Can any C++ expert tell me would this causing buffer overflow? Sample Code: MyObject op; memset(&op, 0, sizeof(MyObject)); On my view it is ok to be this since the limit is the size of the object type itself but there is a security tools cause this as a buffer overflow. If i...

 
dammit Captain, you are slow as hell!
 
@Vogel612 I don't imagine it'll fix the problem, but if it stops even a few off-topic questions I'd say it's worth it
 
More and more things I make start to work in the first try
 
It's a (possibly small) one-time cost to save the community potentially a lot of time
 
the "I AM INVICIBLE!!!" feeling, @skiwi ?
 
7:46 AM
@Christoph Yes
Meanwhile the Github API keeps changing itself without a new version number or anything, so my bots keep breaking
 
7:59 AM
0
Q: line-endings detection

coinI would like to detect which is the line-endings type of a file. I wrote this function: open my $fh, '<afile.txt'; seteol($fh); Here the eol detection subroutine: sub seteol { my $fh = shift; my $byte; my $i = 0; while (sysread($fh, $byte, 1)) { if($byte eq "\...

 
8:24 AM
> In addition, the protocol for accessing elements via a Spliterator is designed to impose smaller per-element overhead than Iterator, and to avoid the inherent race involved in having separate methods for hasNext() and next().
 
0
Q: Select grand child in array knockout

PochenI'm trying to select a grand child from an array in an array. If it was c# I would have wrote something like below SubSteps.Select(item => item.First(subitem => subitem == 1)).First(); I have a code that works, but I'm not sure it is the best way to do it: ko.utils.arrayFirst(ko.utils.arrayF...

 
Does this outright say that a Spliterator is better than an Iterator?
 
@skiwi no it's just saying, that hasNext() is additional overhead...
 
@rolfl codereview.stackexchange.com/a/63787/32231 I am wondering why you are using a Spliterator over an Iterator here
 
0
Q: C++ function composition

davidhighWhat is a good way to compose std::function objects in C++? I tried the following, and it seems to work well: template<typename ... Fs> struct compose_impl { compose_impl(Fs&& ... fs) : functionTuple(std::forward_as_tuple(fs ...)) {} template<std::size_t> struct int2type{}; template<

 
8:31 AM
I'm wondering something crazy though
Is it possible to implement a yield-like operator (in the form of a method) in Java 8 using streams that is late-binding with using a single thread?
 
@skiwi confusion ensues
 
For that I imagine a Runnable block with yield(...) methods, but after every yield you need to stop executing that block of code
I figure what I want to do should be possible in C, but not sure about Java
 
@skiwi couldn't you just yield by event??
 
Not sure what you mean with by event?
I want to see if this of C# yoda.arachsys.com/csharp/csharp2/iterators.html can be implemented in Java
but wondering if it in C# uses only one thread, or if the runtime uses a 2nd thread to be able to continue/pause the code that generates the yield statements
 
new Runnable () {
     @Override
     public void run() {
          value = calculateNextValue();
          Event yieldEvent = new Event() {{
                eventArgs = value;
          }};
          yieldEvent.enqueue();
   }
 
8:42 AM
"yield" is a mild form of co-routines. There are a variety of methods to implement these on top of a language that doesn't support them, but few are elegant. You could for example use a blocking queue with a capacity of one element to communicate between the generator and the consumer, similar to channels in Go.
 
@Vogel612 That creates memory storage, that is something I want to avoid... Whenever a virtual next() method is called, then the code should progress
@amon I see... but I was thinking about doing it without extra threads and with no memory storage
If you could execute code from line X of method Z until line Y of method Z, then it would be possible, but I really wonder whether that is possible in Java
 
0
Q: Looking good practices WCF Service Implementation

KiquenetI have WCF Service using .NET 4.0. I have similar methods, similar code and I want use good patterns for improvement the code for get high level quality. I want reuse code, using Action maybe, improves exception handling, ... is it possible? Interface [FaultContract(typeof(MyCompany.VSIntegra...

 
You can always rewrite your code in continuation passing style, and return the next step at each execution. I.e. yield "foo"; yield "bar" would become "csp = () -> new Yield("foo", () -> new Yield("bar", null));` – when you invoke the function, you get a pair of yield value and the function to call for the next value. It's very powerful, but incredibly annoying.
In functional programming, continuation-passing style (CPS) is a style of programming in which control is passed explicitly in the form of a continuation. Gerald Jay Sussman and Guy L. Steele, Jr. coined the phrase in AI Memo 349 (1975), which sets out the first version of the Scheme programming language. John C. Reynolds gives a detailed account of the numerous discoveries of continuations. A function written in continuation-passing style takes an extra argument: an explicit "continuation" i.e. a function of one argument. When the CPS function has computed its result value, it "returns" it by...
 
@amon I'm not so sure if that would work... or I don't understand
 
yeah, it's probably overkill. CSP is a mechanism to hack arbitrary control flow into a language that has lambdas. It can be used to implement generators, exception systems, loops, …. However, its better to let the compiler use CPS internally than manually writing code in this style.
 
9:00 AM
1
Q: Ideas On Making This For Loop Faster - And Perhaps A Little Shorter?

fizI'm still relatively knew to c++ and I've written a program that could do with being a bit shorter and faster. Any tips, ideas, links or hints at what I should look at would be greatly appreciated. I use this same set of for loops many times to cycle through the whole tree of values. I'll use th...

 
example code...
comments and cv's please ....
 
9:35 AM
Hey there @php_nub_qq
 
Close voted as not real code. — JaDogg 36 secs ago
 
@Vogel612 Hello, sir.
 
@php_nub_qq now I am feeling old....
 
It's just a form of respect :D
 
@Vogel612 can you check the above question " Ideas On Making This For Loop Faster ... "
 
9:45 AM
Just had a 30 minute discussion about finding a name for a particular thing
 
Hey guys, I was wondering, where would be a good place to ask for Database structure :?
 
@JaDogg ermagherd eternal comment...
//FOOD
@php_nub_qq check Database Administrators
but please read their on-topic help first ;)
 
Yes that's where I headed :D thanks!
 
@php_nub_qq who's the girl in your profile picture ?
 
0
Q: Iteration of password hashing in PHP [follow-up]

ThomasKThis is a follow-up question to Iteration of password hashing in PHP I've gone trough a lot of documentations and stuff to get a feel for this hashing jungle, and done some adjustments to my code along the way. PBKDF2 seemed like a good fit, so that's wath I went for. Also, It's important to kn...

 
9:47 AM
@JaDogg No idea, she's been sitting there for a good year and a half ( almost )
I'd also like to know :D
 
hehe
 
My Netbeans decided it forgot how to fix import statements somehow... wat
Reboot: It works again... wat
 
10:21 AM
What would be better...?
 
@skiwi don't ask....
 
Have a class `FieldDataSet` implement `Set` and use inheritance and then add methods to it, or...
have a `FieldDataSetUtils` class that simply operates on a `Set`?
 
@skiwi ermagherd context..
also FieldDataSetUtils sounds like FieldDataSets.
 
I want to group methods operating on a certain set with a set
or perhaps I'll do it differently
 
@skiwi Because you can't easily turn the Iterator in to a stream? At least, I can't find a way
 
10:25 AM
But it is not late-binding... which is bad
Or is it?
Does it really iterates first through all source elements if not late-binding? If so, then it will never work with an infinite stream?
Monking btw
 
'not' Late binding does not imply a full traversal and Monking too.
Adding an extra layer of object is not ideal, and the only thing you really save is not creating the try-split method.
 
It's not ideal indeed
 
Spliterator is ugly to implement.... but, if you have a look at my last suggestion, creating the collatz sequence with:
 
0
Q: Javadoc with no description text

NeilGhoshIs it a good practice to keep the parameter and return annotation in the javadoc in an Interface class when there is no description and the variables names are self descriptive ? /** * @param key * @return */ public PayRecord getPayRecord (Key<PayRecord> key); These are generated I think by...

0
Q: jQuery and CSS3 slideshow

web-tikiI have built a slideshow using jQuery and CSS3. jQuery is used to trigger class changes (.slide1, .slide2 ...) on the slide container (#slideshow) and CSS3 is used to handle the transition animations between slides according to these classes. My main concern is about the jQuery script. I feel i...

 
LongStream collatz = LongStreamUtil.inclusiveStream(seed,
         n -> n % 2 == 0 ? n / 2 : (n * 3 + 1),
         t -> t == 1);
^^^ that is neat.
 
10:32 AM
@Override
public boolean tryAdvance(LongConsumer action) {
    if (action == null) throw new NullPointerException();
    if (it.hasNext()) {
        action.accept(it.nextLong());
        return true;
    }
    return false;
}
So yeah it really just wraps
@rolfl It looks like sorcery to me though, but understandable sorcery
 
Also, managing the hasNext() on an iterator version would be hard too.
 
Too many numbers and characters, so it looks like math to me, so I am scared
4
@rolfl I think you can only really do that with pre-calculating in the has-next, and then checking whether it equals 1 or not, store it and return the result in next
Lunch!
 
Yes, you can do that, but the bonus of the spliterator is that the 'hasNext and next are contained in one method (tryAdvance).
which simplifies the logic a lot.
 
@rolfl I'll need to check that again...
Hence I am still wondering if Spliterator is superior to Iterator
 
11:05 AM
@rolfl Ah yes, I see it now, it's really nice
Would you recommend spliterators over iterators though?
 
@skiwi 8.0.1 update is good, they fixed for loop to stream bug and javafx controller generation bug
 
@JaDogg What's the loop to stream bug, the excessive suggestions?
 
11:39 AM
0
Q: How could I redefine actionsQuery to have it without using "this"?

tesicgI'm new in AngularJS and need to get rid of "this" in the code below: CashdeskActionSearchApp.controller("ListController", function ($scope, $location, Actions, ActionsMisc, ActionDates, ActionPlaces, CounterAgents, Cities, Users, Cashdesks, AsyncTask) { // Filter structure $scope.action...

 
@skiwi yeah that one didn't use to work on Netbeans 8
 
@JaDogg I turned off those convert for loop to stream suggestions the moment I saw them ;)
 
haha
 
I love that I now actually understand what my code is doing.
3
 
The C one or the Java one?
 
11:50 AM
The Java code here... I made an older version of this program about half a year ago
 
bash patched everyone?
(mine is ... now).
 
I'm on Windows ;)
Finally found the term I was looking for... stackoverflow.com/questions/9591561/… "Cartesian product of a list of lists", not the easiest term to find
 
12:16 PM
0
Q: Bash script for getting geolocation (lat, long and coutry code)

agtoeverThe requirement: get the geolocation in a bash shell I have a bash script, where I need to get the user's geolocation (latitude, longitude and country code). If a GPS device is present, I use gpspipe. But a lot of laptops/computers don't have GPS devices (yet). I need the location as accurate as ...

 
0
A: Reading and Parsing JSON from a Game Server

nhgrifA good starting point for any question regarding Objective-C will always be the official Apple documentation on the subject, and in this case, more specifically, we want this page: Reading from Input Streams. There are a few things about reading from input streams that you miss here. First, we...

 
12:31 PM
1
Q: Optimizing a loop for catalogue manipulation

DalekI have a catalogue of 56000 objects and I want to replace some columns with new values for instance replace NaN with -99 and 0 for specific columns (as you can see in the following code). Then I need to compute a value for some columns with a function which is called get_ebv_from_map and subtrac...

 
12:50 PM
0
Q: Are (public) nested classes allowed in this situation?

KippieI'm currently working on a web appliation, in which many of the variables have to be configurable. The current set-up is that most of these things are located inside the appSettings, and are then read out through getters inside our Settings class. namespace Application { public static class S...

Should this be closed for Primarly opinion based? Or... not?
7 hours ago, by JaDogg
How to star more LOLs : attract new users to 2nd Monitor, After few minutes (due to heavy sarcasm in 2nd Monitor),they will post LOL, star it. Muwahaha
lol
 
@TopinFrassi Maybe, but it's definitely example code.
 
0
Q: Are (public) nested classes allowed in this situation?

KippieI'm currently working on a web appliation, in which many of the variables have to be configurable. The current set-up is that most of these things are located inside the appSettings, and are then read out through getters inside our Settings class. namespace Application { public static class S...

 
Wow when I mention someone now it shows his avatar !
3
 
Thanks @RubberDuck
 
1:02 PM
Greetings, Programs.
 
Greeting @Donald.McLean.
 
@RubberDuck With the weather we're having here ATM, I almost wish I was a rubber duck.
 
It's nice here. Getting chilly, but sunny at least.
 
Is there a Java library that can do static analysis for examples when you annotate a class with @Immutable, that it checks if say methods returning maps or lists are indeed immutable?
 
We've had an inch of rain in the last 9 hours.
 
1:10 PM
@Donald.McLean Oh wow! Get the rowboat ready. You might need it.
 
Ooh, we have a ChromeCast to play with now once I'm home :)
2
 
@skiwi NICE!
 
1:36 PM
0
Q: Is my language easy/hard enough? How badly is it designed?

Ismael MiguelI am thinking about making a language somewhat based on some kind of macros. My intention is for it to be in the middle: not easy but not hard to learn and how bad it is. I will use it to produce Javascript and PHP code. Somewhat looks like PHP OP code on some tiny points. Here is an example ...

 
Hello, World!
 
hi @Phrancis
( I really like to see all those shiny avatar now :D )
 
1:47 PM
@CaptainObvious Ummmmmmm not sure what to do with that. Is that on topic??
 
0
Q: Google Maps Overlay Uses lots of RAM

Michael ShamashI am using a GMSURLTileLayer to get a tile from a website (png) and then render it over my map, but the more I move around, the more RAM is used and my iPad eventually runs out of memory and crashes. #import "WXMapViewController.h" #import "SWRevealViewController.h" @implementation WXMapViewCon...

 
@RubberDuck my question is... is that real language or pseudo/example code?
 
it's not real code, it's opinion based, and very broad
what standard should we hold the code to?
it should be closed
 
Let it be known that this new avatar display does not look/work very good in IE8. Any way to turn it off?
 
0
Q: Are requests for review of language design on topic?

RubberDuckThis is the question that prompts this meta: Is my language easy/hard enough? How badly is it designed?. There was another question a while back, but I can't seem to find it right now... So, this question is requesting that we review the code for ease of use, but it's not really asking for a r...

@Phrancis I would say that without an accessible compiler, it's hypothetical, but for some reason I'm hesitant to cast a close vote.
 
2:05 PM
I would think this may be better fit for Programmers, but I'm not sure what they would even do with it... But if it's hypothetical code, I don't think there is much code review that can be done... but, just my 2¢...
 
3
Q: Are requests for review of language design on topic?

RubberDuckThis is the question that prompts this meta: Is my language easy/hard enough? How badly is it designed?. There was another question a while back, but I can't seem to find it right now... So, this question is requesting that we review the code for ease of use, but it's not really asking for a r...

 
2
Q: Merging lines of an array

JaybeI've got an array like this => this is a result from a Google analytics request. I asked for the amount of visits for the last three months. $statPerMonth array (size=2) '08' => // The month (August) array (size=34) 0 => array (size=3) 0 => string '08' (length=...

 
2:21 PM
@RubberDuck this meta Programmers question has interesting points related to your meta question...
5
Q: Language discussions

DeadMGI've got a question about a language feature for some hypothetical language I've been thinking about implementing. It's sweet, but rather complex, especially on the implementation side, and I'd like to know if it's genuinely workable, both in terms of whether anyone could wrap their minds around ...

 
@Phrancis So, as it is, that question is definitely not on topic for programmers.
good to know.
 
Is there a List-variant in which I can efficiently append items at the front and at the end?
 
I don't know that it's on topic for any SE site... but I'll wait for someone more experienced to pitch in on your meta question
 
0
Q: Using a condition in a vectorized operation

DatamanI was wondering how to vectorize the following code instead of using the for-loop and still be able to check for a condition. # n is a numpy array which keeps the 'number of trials' parameter for the binomial distribution # p is a numpy array which keeps the 'probability of success' parameter fo...

 
@skiwi ChromeCast is awesome! I can cast to my Playstation 3, netflix if it is open on Playstation
try to ping someone, they updated chat I think, it is cool!!!
 
2:35 PM
user image
2
 
2 hours ago, by Marc-Andre
Wow when I mention someone now it shows his avatar !
 
I don't like it much on this crappy browser ;p
 
We should observe a minute of silence for the crappy browser of @Phrancis
6
 
It's not real code, and it's not even asking for a review of the code given, but for how to build a language, that is off-topic for this site — Malachi 8 secs ago
@Phrancis that is perfect with your avatar, you should post on Meta about the issue
 
@Malachi get that to meta, too... just a little better formulated.
 
2:41 PM
on it right now
 
He should report the bug only if he's on a supported browser
 
OTSTD
Out To See The Ducks
2
See you later.
 
0
A: Are requests for review of language design on topic?

MalachiThe Question in Question is very Off-Topic for Code Review. OP is not asking to review the code that is given, and the code that is given is not set in stone either, it is not static so it can change based on the answers received. The question is more leaning to "How do I create a Language tha...

 
0
Q: Counting the number of character occurrences

user9993I've written some code that uses a SortedDictionary to count the number of occurrences of a character in a string. How can I improve this code? What should I be doing differently? Any advice at all would be helpful. static void Main(string[] args) { string longText = @"The quick...

 
I'll see about trying to update IE before reporting a bug. I would think at least SE should support IE... 11?
Don't know why I didn't think about that before
 
2:49 PM
IE 11 is supported!
106
Q: Which browsers are officially supported? And what else do I need?

EarlzI know that the Stack Overflow system is designed well enough that you can have read-only access even in Lynx. But what are the official browsers that the team supports that can use every feature of the site? And what do the browsers need to do so? Return to FAQ index

10
Q: Show profile picture in chat autocomplete

Kasra RahjerdiOn the same note as this request to show profile pictures when drilling down to a specific user in search, it'd be swell if the chat @ autocomplete could show a tiny profile picture next to each person's name. It'd also be neat if the superping menu had this too. An alternative for fixing my ...

 
@Malachi Good points. Amon also had a pretty good answer.
5
A: Are requests for review of language design on topic?

amonWe review real-world code and make suggestions for improvement. We could review example code, but have decided not to: if code is not supposed to run, how can it get better at doing nothing? Furthermore, it's very hard to review code if we can't run it to test our suggestions. Therefore, pseudoc...

 
@RubberDuck I was just reading that.
 

« first day (509 days earlier)      last day (3507 days later) »