« first day (553 days earlier)      last day (3466 days later) » 

12:01 AM
@Morwenn I like the ambiance of that Have A Nice Life song, dark and abstract, no traditional chord progression. Very moody
Have you heard this @Morwenn ? A fair bit more electronica, but I feel it conveys some of that dark ambiance, kind of an outer space emptiness sound.
(I actually have that on vinyl record, pretty sweet)
 
12:14 AM
0
Q: Is this a good way to implement a tile map from a text file?

TwiggyI'm working on a small final fantasy type game. I have this for a tile map. I was just wondering if this is a good way to do this or if anyone has any suggestions, I would love to read them. import com.stardust.main.gfx.Assets; import java.awt.Graphics; import java.awt.image.BufferedImage; impo...

 
 
1 hour later…
1:30 AM
2
A: IBDesignable UICheckbox

nhgrifIn playing around with this, I noticed a few things I didn't particularly like: This picture represents the first problem. Setting the background color fills in the entire rectangle, but should probably only fill in the circle. We can fix this as such: Add a private variable to hold the v...

 
1:52 AM
Second question incoming.
 
2:06 AM
@Phrancis I have access to IE9 only
 
2:18 AM
COBOL? Really?
 
hi
i had a query in java
a design issue
can i ask>
 
3:01 AM
0
A: Get build date and time in Swift

nhgrifCreate a new Objective-C file in your project, and when Xcode asks, say yes to creating the bridging header. In this new Objective-C file, add the following the the .h file: NSString *compileDate(); NSString *compileTime(); And in the .m implement these functions: NSString *compileDate() { ...

Step 1 is fixing your indentation so that someone besides the compiler can make sense of your code. — nhgrif 32 secs ago
 
3:30 AM
0
Q: My take at ProjectEuler #17

ambitious_roi I tried to tackle #17 problem on project euler: If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters w...

 
4:16 AM
0
Q: Berserk Vuln Implementation

Sam SchaferThis is an implementation of the Berserk vulnerability (for research purposes) that should work per python documentation, but does not. Could someone help me fix it? #!/usr/bin/python import hashlib import math N = "c5ddc7decb1beede4ebb96742e4279eb120b9c8b44472c0d0bb39da95a10cf72b630dbea181...

0
Q: HTML Tree Parsing in Perl

morissetteI finally converted my horrific HTML regex parsing: if ( $info =~ / Platform\sType<\/td>\n\s+<td><b>(.*?)<\/b>(.*?)<\/td>.* Codeset<\/td>\n\s+<td><b><i>(.*?)<\/i>.* Status<\/td>\n\s+<td>\n\s+<div(?:.*?)">(.*?)<\/div><br>.* Instance\sID<\/td>\n\s+<td>(.*?)<\/td>.* Instance...

 
4:27 AM
0
Q: Make a map using a splay tree

doctordoderIn my data structures and algorithms class, we were introduced to the splay tree, a BST with the additional property that recently accessed elements are quick to access (because they stay at the top of the tree until a different element is accessed). I know that std::map uses a BST; I heard it's...

 
5:06 AM
-1
Q: Adding line breaks

mayven<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>For Loop</title> <script language="JavaScript" ...

 
 
2 hours later…
7:11 AM
0
Q: Dependency Injection in PHP MVC Framework

Abhishek SahaMy question might bring negative votes because i have not attached any code here. but i have no option other than to ask this. I recently developed a PHP Framework. Their is still few things left out of which below 2 are the main ones. Dependency Injection Namespacing The Framework code can b...

0
Q: Filling a cumulative array in Swift

MazyodI have a "cumulative" lookup array for a custom collection view layout. The idea is that I have an array of rectangles, each with an index. The index is not unique. I need to create a lookup table, such that given a cell index, it returns the accumulated height of all rects lower than that inde...

 
7:47 AM
I admire the average response time on CR... I posted on other SE sites and this has been unanswered and unvoted for 2 days, and this unanswered since Oct 31... Kudos, Code Reviewers!!
 
monking
 
Monking @janos
 
hey @Phrancis
my feature request on CR is unanswered to this day
but I think that's understandable
 
0
Q: Sudoku Solver Timing in C

VishalHere is the code : #include<stdio.h> #include<stdlib.h> void printd(int A[4][4]) { int i,j; for(i=0;i<4;i++) { for(j=0;j<4;j++) { printf("%d", A[i][j]); } printf("\n"); } printf("\n"); return; } int check(int A[4][4]) { int i,j,k,a,b,c,state=1,temp=1; ...

 
Ah I see; yeah I think it's understandable. I presume I should be more patient myself.
                        }
                    }
                }
            }
        }
    }
    return state;
        }
        return 0;
}
Big O... must suck.
 
8:03 AM
yeah
 
Also that return 0; indentation must be off somewhere... it makes no sense...?
 
indentation is a mess in this post
 
 
2 hours later…
10:03 AM
0
Q: Extremely simple stack implementation using a vector

recursivePointerPlease review my extremely simple Stack. template<class T> class Stack { public: Stack() = default; Stack(std::initializer_list<T> i) :n{} { for (auto& x : i) { elem.push_back(x); ++n; } } Stack(const Stack<T>&) = default; Stack(Stack<T>&&

 
10:27 AM
0
Q: {STB} Spot the Bug: simple segmented Sieve of Eratosthenes for sieving up to 2^64-1

DarthGizkaTo make a point in another topic, here's one take of the 'simplest possible sieve' that can sieve up to 2^64; the idea being to make things so brutally simple that we can trust the thing to be right and can use it to verify other, more complicated implementations. The code here works perfectly f...

 
@CaptainObvious I wonder if this is on-topic ...
 
10:49 AM
0
Q: Merging Overlapping Intervals

Nic YoungA while back I was asked the following question in a phone interview, and to be honest it stumped me. After many long nights of rolling the problem around in my head I think I came up with a decent solution The Question: Given a list of intervals like: [(5, 7), (11, 116), (3, 6), (10, 1...

 
11:19 AM
I highly recommend a meta on this proposal. While I'm interested in the concept of this as a community-challenge of sorts, it's broken code. You know this code isn't ready for review. — RubberDuck 55 secs ago
I don't know about that ^. Like, at all... I VTC'd until it can be discussed.
I don't think it belongs here. Maybe there's room on PGG for a new , but this doesn't belong here.
 
11:37 AM
0
Q: Equal heights in pure JS, removing send for loop

pixeltoothI'm pushing myself to learn pure JavaScript, so this morning I wrote a equal heights script in jQuery and then converted it to JavaScript - It works but I'm using two for loops. Is there a better more efficient way to write this code, maybe finding away to remove the second for loop? I've create...

 
Hey @DarthGizka how are you?
 
@ RubberDuck and rofl: most posters are using Code Review as a 'debugger service' for crappy, broken code but my post is not doing that. Also, there's no danger that the two bugs that are subject of the 'STB' will confuse naive readers looking for code to copy, since the fixes are bound to get posted one way or another. Also, a lot of sieve code that gets posted here and on StackOverflow is of exceedingly poor quality.
Hey, I'm fine.
Needed some time to figure out how this works... Haven't chatted in a decade or so.
 
Hey there.
 
It's all good. =)
 
I think that - apart from the two small bugs - the code is worthy of Code Review...
 
11:46 AM
I'm just concerned a bit. I understand what you're doing and it's interesting, but our rule of thumb is that the code must work the to best of the OP's knowledge.
 
Hey, it works up to 10^19 and beyond. Find me something better and I concede your point... :-)
 
^^^ that. Any question where the asker knows something is broken, is automatically closed.
 
If you're aware of bugs in it, I don't think it measures up to that.
 
But you are right, I'm tainted by the knowledge of the two bugs.
 
Also, your question restricts what the answers can be
Regardless, any 'decision' about this should be made on Meta, not chat.
 
11:48 AM
What stinks, is that if you weren't aware of the bugs, we would consider it on topic and hopefully someone would point it out in a review.
@rolfl Agreed.
 
No, even then, it's missing code, and so on. It's incomplete.
 
Do we have to post complete programs?
 
Just wanted to let @DarthGizka know that we're reasonable people @rolfl. =)
 
@DarthGizka Not necessarily, but whaere is function 'bit', and what is CHAR_BIT?
 
I get it. I like you. And I see that you're between a rock and a hard place.
What if I made a complete, runnable program and put it on pastebin?
 
11:49 AM
Actually, it's not so much a rock/hard place thing.
Code Review is about improving working code.
Stack Overflow is about fixing broken code.
Programming puzzles and Code Golf is about making games out of code.
It is likely that either SO or PPCG would be a better site for your question.
 
OK, can it be moved then?
 
I am 99.9% sure that any question saying 'spot the bug' would be off-topic here.
Yes, it can be moved, but, PPCG has a process for asking questions, and SO would close it automatically as 'unclear'.
 
Or an exception be made just this once, with plenty of big warning signs? I can remove the STB tag from the subject.
 
No exceptions on Code Review....
 
And the "Spot the Bug"
 
11:52 AM
I think it could be an interesting "game". I would recommend a proposal meta on Code Golf.
But without discussion, those guys would probably close it too.
 
I can ask the moderators on other sites if they see a future for this...
 
For the time being, could we unlock the post and change the subject to something innocuous?
 
Here's how you ask a question on PPCG: meta.codegolf.stackexchange.com/questions/2140/…
 
OK, I'll read up on Code Golf and the meta thing.
Also, I wasn't quite ready for a bona fide proposal, which is why I put the proposal in a comment. To see whether people are actually interested...
The frequence probably would be very high, but I guess every once in a while everyone comes across a bug of suitable calibre.
Oops, "frequency would not be very high"
 
Unfortunately, you are wrong. The frequency of people posting 'spot the bug' questions is very, very high
 
11:59 AM
@rolfl All of SO....
 
They just post them as 'spot the bug, please', and don't put a big sign on it saying "+50 to spot the bug", and don't put the question forward as a game.
No, I mean here on CR too.
We close about 60% of all questions as 'spot the bug'.
 
I meant high-quality STBs of educational (puzzle-ational) value, which is why I added the bounty thing
 
Do we really close that many questions?? Wow.
@DarthGizka I think that's what makes it different and interesting. Unfortunately, CR isn't the right place.
 
I think with riddle-givers having to stake bounty on their posts, that would keep out the trash.
 
There's nothing built in to enforce that though...
 
12:02 PM
It's not that. It's just the wrong place.
 
Yep, put people seeing an STB without a bounty would simply not be interested.
The bounty draws people's eyes and ensures quality. Make it a minimum +100, whatever.
Thanks, people. I'll think about making a proposal on Meta, with emphasis on having to stake bounty. For now I've got to go offline, shopping and stuff. Cheerio!
 
You seem to be missing the point here though. What you are doing is something like: going to a water-color painting convention and saying... I have this piece of marble I would like to carve in to a statue-of-david. Here's $1000000 for you to put down all your water-colors, and pick up a chisel.
4
 
Wouldn't people enjoy reviewing some non-crappy code for a change, plus knowing that the solution will be revealed shortly? Like Gotcha of the Week, elsewhere... (was it Herb Sutter? forgot)
 
Any people in the room. I have a silly question.
 
By definition, questions saying: my code has a bug, where is it? <--- that's a crappy question
8
But, the place for this is on meta... so I look forward to the post there.
Also, the other mods will be able to get in on it when they wake up ;-)
and the whole community.
 
12:11 PM
@RubberDuck yes yes yes I'm relevant
 
@JeroenVannevel Awesome thanks.
 
Whatcha wanna know? ASP.NET MVC? T4? Generics? LINQ?
I've got a bit of everything
 
I have a question about inheritence.
I have a private method in a class. I would like to extract it to a base class, but still only allow it to be called privately. What's the correct scope to do that?
 
protected
 
Thank you very much.
 
12:14 PM
Hah, that viral question about replacing two words got me the string tag badge
I'm now a string master
 
The is strong with this one.
 
12:28 PM
0
Q: create a palindrome by deleting only 1 character from existing string

PradeepI am trying to delete a character from existing string to create a palindrome. If the string formed after deletion is not a palindrome, then print NO If the existing string is already a palindrome , then print YES This is what i have written, and it works for certain test cases can someone provid...

 
1:01 PM
@Phrancis That's pretty good, I really like the atmosphere in this one :)
 
1:24 PM
@JeroenVannevel which question is that?
 
47
Q: How can I replace two strings in a way that one does not end up replacing the other?

Pikamander2Let's say that I have the following code: String word1 = "bar"; String word2 = "foo"; String story = "Once upon a time, there was a foo and a bar." story = story.replace("foo", word1); story = story.replace("bar", word2); After this code runs, the value of story will be "Once upon a time, ther...

 
it's awesome to go viral :)
too bad it's so rare (for me at least)
 
yeah same, this is only my second viral answer in my 2 year lifespan
 
hmm, @mjolka is in on this one too
it's nice to see familiar faces on other SE sites
 
I put the question here on chat back when it still had 0 votes
sometimes it pays to see most question within seconds after they're posted!
 
 
2 hours later…
3:24 PM
0
Q: Android: proper way to wait end of a service and singleton design

Accollativothis is my first question here, I was not sure if it's more appropriate here or in the stackoverflow area. My code works fine, I would like to know if I chose the best strategy to implement my code, or if It can written better (more fast, more clear, best use of design pattern, etc). In my andr...

 
3:45 PM
0
Q: Creating drilldown series for highcharts using underscore.js

Daniel G. R.I have got an array with object where each object contains information about school and business area like this: [ {School : "School name 1", Business Area: {lookupValue: "Business area 1"}}, {School : "School name 2", Business Area: {lookupValue: "Business area 2"}}, {School : "School ...

 
4:01 PM
0
Q: Table View disappears in auto / adaptive layout

bunglenutterI have a simple master-detail storyboard like so: Which results in this table view (selecting cells leads to detail view): However when I change the size classes option at the bottom to play around with iPhone-specific stuff, the table view disappears from view in the storyboard and doesn't...

 
4:45 PM
0
Q: Efficiently using ZeroMQ sockets in Java?

WebbyI am working on multithreading project and I am using ZeroMQ socket to send the data as a byte array. Below is my example which works fine but opting for code review to see whether it can be improved by adding a wrapper class for using ZeroMQ socket as some sort of socket manager? public class ...

0
Q: Efficiently serialize big JSON using GSON?

WebbyI have a very huge GSON coming from a URL which I am trying to serialize it on the fly as shown below with the code and it works ok. private static final Type listOfMetricsType = new TypeToken<List<HostClientMetrics>>() { private static List<HostClientMetrics> loadMetrics(String url) { List<...

 
Hi everybody!
Need help with following question
0
Q: django-rest-framework add SerializerMethodField to Serializer dynamically

outoftimeI have a lot of similar fields that shout by created in similar way. from rest_framework import serializers class UserSerializer(serializers.ModelSerializer): is_friend = serializers.SerializerMethodField('get_is_friend') # ... def get_is_friend(self, obj): user = self.cont...

 
5:06 PM
0
A: How to call an Objective C class method in Swift

nhgrif I mean: BUT WHY? That's what we're left asking. Matt's answer is correct in that renaming the method will fix the problem, but we're still left asking why. The answer is because Swift actually remaps convenience methods to constructors. So while we'd have to call the method like this in O...

 
5:38 PM
@nhgrif Worst OP ever
Complaining about every answer because they're "loopholes"
it's a bloody puzzle site
 
hi
 
I was entertained by that answer though.
Hmm. So, Swift got rid of ObjC's ?: operator. And then later added in a ?? operator.
2
A: Defining a simple function-calling operator

nhgrifThis coding style is confusing. Let's unravel the line of code in question: self.currentDog >>> getWalks >>> getWalkAtIndex >>> setUpCell What's happening here? To make sense of this, we essentially have to read this backwards. What are we doing? We're setting up a cell. With what informa...

 
6:19 PM
@JeroenVannevel Answering Java 8 question seemed to help for mine going "viral"
Though it's a case where they get like an upvote every few days consistently, so not sure if you can really talk about viral
 
1
A: Swift optionals OptionalValue

nhgrifThe best option in this specific case is probably, as DPlusV suggest in the first line of his answer: var screenRect: CGRect = self.window!.bounds This will crash if self.window is nil, but given that in this specific scenario, we're in didFinishLaunching, if self.window is somehow nil, we've ...

 
0
Q: Is this web service synchronized correctly?

W.K.SI'm new to both concurrency programming and Go. I've written a small server side script that gets the title and ratings of a book for a given ISBN. I've to optimise performance by using a cache and I've also added a check to ensure that two requests for the same book do not get sent to the Good...

 
 
1 hour later…
7:43 PM
0
Q: Newton Raphson for logistic regression

NealI did code for Newton Raphson for logistic regression. Unfortunately I tried many data there is no convergence. there is a mistake I do not know where is it. Can anyone help to figure out what is the problem. First the data is y=c(rep(0,60),rep(1,55)) X=sample(c(0,1),size=3450,replace=T) Z=t(...

 
7:57 PM
0
Q: A python script for automatically extract an archive file in a subfolder

qedA python script for automatically extract an archive file in a subfolder: #!/usr/bin/env python3 // sub7z.py import subprocess import re import os, sys, pathlib class Counter: counter = 0 def getCount(self): self.counter = self.counter + 1 return self.counter class Z...

 
@CaptainObvious Who the hell decided that it is legal (or forced) to put parameter variable types behind variable names?
 
0
Q: Circuit-Swap mechanism on going (BMP->PPM)

EdeniaReffering other "Stack Exchange" Sources, I've been told that the only way of swapping BGR to RGB involves buffering. While this isn't true, I could just perofrm a quick C-SA algorithm on fseek or bmp buffer byte offsets. I wrote a fast implementation of fwrite, that swaps the first byte with the...

 
@skiwi That's how Swift does it. And Visual Basic. And probably other languages.
let intVariable: Int = 3 <-- Swift
Dim IntVariable as Int = 3 <-- VB (I think)
 
@nhgrif At least the syntax there still makes sense
Same holds for VB
But intVariable int is just clear madness to me
 
The : makes all the difference?
 
8:12 PM
@nhgrif Together with the let
 
0
Q: Javascript does a thing

OmerFarukI have a javascript code but i'm non-javascript guy.This code take id and gives url. For exampe for this id lWA2pjMjpBs it gives http://dl8.downloader.info/dym_down.php?id=1ee49b508e4780975007a958dacec586 Here is the javascript code: $(document).ready(function(){var Complete=false;var URL=doc...

 
You can pronounce and comprehend it easily
 
Worst. Title. Ever.
4
 
There's also var intVariable: Int
 
@rolfl around? Could you hop in the TCG room when you have a min?
 
8:14 PM
let being a constant declaration and var being variable.
0
A: Why use typeof() instead of the object type when avoiding block retain cycles?

nhgrifThe typeof() macro allows a few things. First of all, personally, I've created a code snippet with this sort of thing. Instead of having to type out: __weak MyClass *weakSelf = self; each and every time I want to set this up, substituting MyClass for the appropriate class, I can instead just...

0
A: Adjusting height/width of UIWebview in Swift

nhgrifThis can be prevented by adding some auto-layout constraints so that your web view will always take up the same portion of the screen no matter the device it runs on. With the web view selected in interface builder, open up the constraints menu and add the appropriate constraints: Note that I...

 
8:38 PM
0
Q: Where do I go wrong handling thread interruptions in this code?

fgeThis code is code written on a whim to help $someindividual asking for such a thing on $somechatmedium; what is needed is a way, in Java, to provide an Iterator over Path objects which must only be directories, recursively, and where the number of returned instance number in some sufficient quant...

0
Q: A python script for counting lines of an compressed file

qedA python script for counting lines of an compressed file: #!/usr/bin/env python3 import gzip, bz2, zipfile, os, sys def openZip(zfile): f = zipfile.ZipFile(zfile) firstFile = f.filelist[0].filename if firstFile.endswith("/"): raise Exception("This zip file contains a direct...

 
Three letter names...
wat..
 
9:20 PM
0
Q: JSON conversion to single quotes?

Juan Camilo OsorioThe JSON standard uses double quotes for key names and string values, such as the following: {"one":1,"two":"two"} However, the current project I am working on requires JSON-encoded objects to use single quotes instead of double quotes. (In this case {'one':1,'two':'two'}). Right now, there is...

 
9:36 PM
I am very tempted to buy the book « From mathematics to generic programming » by A. Stepanov. It looks very interesting.
But first I need money (well, a job)...
 
9:53 PM
0
Q: Possible improvements script that receives, formats and data persists

Rafael SoufrazThe code snippet below, receives data from a form, formats and inserts into the database. This code snippet is located in a controller and the insertion is done in a 'repository' to manipulate data that entity laravel in my project. Wonder if there are improvements to be made in this code for a g...

 
 
1 hour later…
10:56 PM
I feel like writing a piece of code that breaks every convention and post it.
 
11:09 PM
-1
Q: Python, Number Generators

CamilI am just dabbing by toes in the basics of python and for a simple text game I plan to make, I was just wondering how you could get a random number output by (random.randrange(1, 10) could be used to activate a part of a function. So if it output "1" it would output a set of dialogue correspondi...

0
Q: Efficiently serialize big JSON using GSON

WebbyI have a very huge GSON coming from a URL which I am trying to serialize it on the fly as shown below with the working code. private static final Type listOfMetricsType = new TypeToken<List<HostClientMetrics>>() {}.getType(); private static List<HostClientMetrics> loadMetrics(String url) { ...

 

« first day (553 days earlier)      last day (3466 days later) »