« first day (556 days earlier)      last day (3467 days later) » 

12:04 AM
-1
Q: Largest String, adding 1 character at a time - trying to find find efficient algorithm

Tai HirabayashiHere is the prompt: input: ["interest", "care", "pin", "pint", "car", "trace"... ] start at the 3 letter words: pin, car pin -> pint car -> race -> trace Find the largest word that you can find. For each word you can rearrange it in any way and add one character to find a match. Ex in this ca...

 
12:55 AM
Hey where's my fanatic badge :(
 
@JaDogg May I present you with: Fanatic 101 (yes, you're the 101st fanatic on CR).
 
 
1 hour later…
2:16 AM
Why has Code Review been so negative as of late?
2
-1
Q: Make a dict class from scratch in Python

Brandon JerzHere's the API my teacher assigned: and here is what I came up with: class MyMap: def __init__(self,size=10): self.size = size self.internal_list = [None] * size def _getHash(string,size): total = 0 for ch in string: total += ord(ch) ...

 
2:29 AM
0
Q: Calculation Error in findLowest() and findHighest()

user3363156I am taking a beginners C++ course and I am struggling with an assignment right now. The assignment was: A particular talent competition has 5 judges, each of whom awards a score between 0 and 10 to each performer. Write a program that uses these rules to calculate and display a contestant’s ...

 
3:13 AM
0
Q: How to make my busy controller easier to manage?

smernyI have a controller that has gotten a little out of hand. This is my first AngularJS project and I am using it as a learning experience... but I feel like I am doing some things wrong. This controller is used for resetting data on a weekly basis. There are "foos" of which 10 random foos are sele...

0
Q: Dynamic nested form way using Rails

itxFirst, I have read some tutorials, some questions, watched a railscast episode and implemented a nested "about" form. But I can't find what I need. To the point, I have 2 models (project and component); a project has many components, a component belongs_to a project. Attributes of model : proj...

 
3:47 AM
@rolfl it's okay. I just wanted you to take a look into my CR question whenever you are free but it's ok if you are busy
 
 
2 hours later…
5:18 AM
0
Q: ReactJS - Efficient way to pass 'classType' (props or set state) + general code organization

newbieI'm trying to build a multiple-choice quiz using ReactJS. When the 'Submit' button is clicked, I want to give immediate feedback by changing the text 'input' color (green/red). Right now, it feels like I'm duplicating code in handleSubmit and render section. Is there a better way to pass classT...

0
Q: Producer/Consumer programs

hosch250I am studying mutual exclusion in college, and we just covered the producer/consumer problem. The class does not involve writing code, but I decided to implement a bounded buffer version of this problem. I have never written a multi-threaded program before, nor have I written a program with mut...

 
5:40 AM
0
Q: Time Limit Exceeded for Code Chef problem Rendezvous

NivedhaI am trying to solve a problem Rendezvous in code chef. I have created a sample input text using the code below from __future__ import print_function import random import sys def rendezvous_test(T=25,N=10000, file=None): print(T, file=file) for _ in range(T): C = random.randrang...

 
5:58 AM
Monking @all
 
6:23 AM
0
Q: AngularJS Login Check?

grasshopperI have states that have a requiredlogin object set as a true. then I have angular listen on stateChangeStart but things end up pretty ugly. Here is a state that requires a login. I think this actually pretty good, simple. .state('dashboard', url: '/dashboard', templateUrl: 'partials/dashboa...

 
6:41 AM
0
Q: Modifying Classes

pythoncoderdef __init__(self, firstName, lastName, city, average): """Construct an Applicant object""" self.firstName = firstName self.lastName = lastName self.city = city self.average = average def getFullName(self): "returns the full name of the applicant in the format 'lastNa...

 
7:21 AM
0
Q: Simple evaluator of Scheme-like expressions in Haskell

Richard CookThis is my first nontrivial Haskell program: module Main where import qualified Data.Map as Map type Env = Map.Map String Expression data Expression = Constant Integer | Variable String | Add Expression Expression | Multiply Expression Expression | Let [(String, Expression)] Expressi...

 
7:35 AM
0
Q: Parameters in functions

Migara GunarathneFollowing program is a basic function program.In the function declaration,the function parameters are int x and int y. My problem is if there are different parameters in the function definition( int p and int i) ,then this program works perfectly.No compile errors.Also if the declaration paramet...

 
Finally... UTF-8 vs utf-8 bug has been solved
An internal web service wasn't accepting utf-8 (smallcase) for some reason... Had to use a temporary proxy server to rewrite it to UTF-8
 
7:56 AM
0
Q: This program gives an error

Migara GunarathneI am a beginner to programing.when I compile this code it gives me an error. I found a solution it says use the strcpy command.But Can I assign "migara" to char name[100] without using strcpy? #include<stdio.h> struct mystruct{ char name[100]; }; int main(){ mystruct abcd; abcd.name="migara"...

 
Does anyone possibly know if (on my laptop) 80+ Hard Faults per second on 4 GB memory is worrying when it is practically idle?
I'll do a memtest either way when I'm home this afternoon
 
We're starting to get more crap, and the enabling of question-bans networkwide came at a pretty good time.
 
@skiwi No idea
If this code is working Why should I post this code? I do not want to post this question if this code is working. — Migara Gunarathne 6 mins ago
 
8:24 AM
1
Q: Sudoku Solver - Recursive Solve

CSUndergradAny ideas to make my code a bit more clean and efficient? Any criticism is appreciated. I don't like that I'm calling my lengthy DeepCopy method so many times, but the BinaryFormatter approach is much much slower. I haven't come up with a better approach than doing a deep copy of the entire Sudo...

 
A google cardboard and a Coverity tshirr
This conference is already paying off
Damn it, the Azure stand is empty and I can definitely see a bunch of posters
I need more goodies
2
I want to kiss whoever came up with the idea of doing this in cinemas
Bigass screen, lots of room and great seats
 
9:08 AM
0
Q: Loading views for different devices

Katana24I'm currently in the process of developing a mobile orientated website for my company. Because this application has to work on screens ranging from Mobile to Tablet Landscape I was wondering if what I'm doing is considered good practice. Essentially I have two <div> tags in a typical HTML page. ...

 
9:45 AM
0
Q: Secure authentication using JavaScript module pattern and an AJAXified modal window

Chase RiesThis code is not live, but for brevity I'll write as though it is. When a user clicks any element with the class name js-modalOpen, for example: <span class="js-modalOpen" data-modal="signup">Sign up</span> A modal appears. The contents of that modal's dialog are determined by data-modal. All...

0
Q: Getting IOException while connecting to SOLR server from Spring Web Services

Kuldeep JatwaI have been struggling to find a solution to this problem which I have tried to explain here. Would really appreciate some ideas that I could try, to fix this. We have Spring Web Services with Microsoft SQL Server as back end. We have been working on SQL to SOLR migration project, where we are r...

0
Q: C# TCP communication

YoavI have a class that I use to communicate with some hardware equipment( a step motor to be precised): public class HdCommunicator : IDisposable { private TcpClient client; public HdCommunicator(TcpClient _client) { client = _client; //create and start the listener ...

 
Holy shi- Worldbuilding has 100% answered
3
 
-2
Q: The type or namespace name 'Ports' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)

shikha shrivastvaI am working on developing a windows store app on my windows 8.1 system,64 bit (I need to deploy this app on my windows surface pro 3 tablet), technology being used is C#. I need to communicate through the RS-232 port. For this I am using the SerialPort class which falls under the namespace Syste...

0
Q: App to give cigarettes through the day, check for code reliability

SartherisI have this app, that gives you cigarettes through the day, with equal intervals from one another. So these are some important variables: wakeUp - is the time, when you wake up in the day, and if the user has specified that he sleeps 8 hours, than the wake hours are 16, and the cigarettes must be...

 
That's just insane
 
10:03 AM
0
Q: Import and Export of animation keys in Maya

yanI have written up this importing and exporting of animation keys, though it is working but I would like to gather any feedback/advice as I am still pretty much a noob in coding import maya.cmds as cmds from PyQt4.QtCore import * from PyQt4.QtGui import * class mainWindow(QDialog): def __in...

 
monking
 
Monking @janos
 
hey @Heslacher
out of curiosity, why can't we see the reopen count on this one:
2
Q: Improving equal spacing between elements in layout

YarhI am trying to make a nice set of items, which are equally spaced from each other. On example below, I set buttons between empty textview. Every button and text view has height = 0dip and weight=1. And it looks pretty nice. However, is there a way to make it better or more efficient? <LinearLay...

 
Maybe it is cleared ? Have no idea.
 
10:34 AM
Reopen votes have expired due to age.
 
0
Q: How to optimise extraction of numbers from currency string

Sir Ben BenjiI have the following code; whereas currency and views are in reality many JSON objects from an SAP export, that I can not rely upon to be in the same format. That is why I'm regexing over these inputs. My code looks clumsy to me, can it be improved? var currency = "20.002,03 €"; // sometimes thi...

 
I didn't know reopen votes can expire, and that I cannot vote on them again
This would be good to explain on the help page codereview.stackexchange.com/help/reopen-questions
I think this question got incorrectly closed by users who don't know Android well
The layout can be improved (often by a lot) by using styles
It's already in @Malachi's answer now
It's a fine question and it should be reopened (though I have nothing else to add anymore)
 
-4
Q: The type or namespace name 'Ports' does not exist in the namespace 'System.IO'

shikha shrivastvaI am working on developing a windows store app on my windows 8.1 system,64 bit (I need to deploy this app on my windows surface pro 3 tablet), technology being used is C#. I need to communicate through the RS-232 port. For this I am using the SerialPort class which falls under the namespace Syste...

Should be deleted.
 
10:50 AM
^^^ yes
 
11:01 AM
0
Q: Having two abstract (static inner) classes within the interface they implement

Leonid SemyonovIs it wrong? Should I have these 2 classes in separate files? public interface InternetDependentFlow { void onInternetIsAvailable(); void onInternetIsNotAvailable(); public static abstract class InternetIsAvailable implements InternetDependentFlow { @Override public ...

 
11:16 AM
oooooh
sourcetree update
I hope they fixed my bug
that I didn't report
but still.
 
wishful thinking :)
 
11:46 AM
Thank you so much! Are there plans to integrate a Crypto Currency donation system into this site? :) — Sir Ben Benji 2 mins ago
hmmm, and that could be my wishful thinking right there!
 
Anyone wants to do me a quick little favor?
 
Maybe
 
@Pimgd if you didn't report it, how can you expect them to have fixed it?
@Heslacher Just wondering what you see if you go to play.google.com/store/apps/…
 
"Not found"
 
OK, thanks
I'm testing Google's testing functions.
 
11:53 AM
Ping me if you need more testing of your testing Google's testing fuctions ;-)
 
@Heslacher what do you see now? I've moved the APK to production, not sure if google registers that immediately though
 
Same
 
alright, then maybe in a couple of hours you will see it. I hope.
 
if I recall correctly it can take a few hours
not more than 6
 
@janos yes, it took a whole bunch of hours yesterday when I uploaded the beta APK. I thought this could go faster though, as it's just a push from Beta to Production.
 
12:04 PM
0
Q: Exporting modules in NodeJS using Express 4.10.1

deleepaI came across a situation when using the 'export' feature of NodeJS to create modules that I don't fully understand. This is what the code looks like: server.js // ---- Routes --- // var express = require("express"); var app = express(); var login = require("./login"); app.use("/", login); ...

 
I wish I could use the markdown editing features of CR while editing stuff on GitHub
C-k, C-q, cmd-l, ...
 
C-q? cmd-I? What does they do?
 
C-q puts in blockquote
cmd-l (small "L") is for adding links easily, with [1]: ... style references
this latter is what I miss the most, very useful on CR
in windows it's probably alt-L
highlight the text you want as the link label, press alt-L, paste the link
 
I write [text](link) style whenever I make a link
 
I used to, but that clutters my text
 
12:09 PM
I guess it's a matter of preference :)
took me a while to get it right. I used to be quite confused about [link](text), (text)[link] and (link)[text]
 
Huh, learned something new: Expanded Hover Cards
Monking all.
 
@SimonAndréForsberg you see, with [text][1] there's no confusion, [1][text] would clearly make no sense
hi @rolfl
 
@rolfl I've known about that for a long while, but I rarely actually see it in action.
@janos but once you learn it, there's also no confusion anymore :)
 
0
Q: Give equal items in list a unique number if items > 1

RobertI made a functionality, but I not happy with the quantity of the code. The end result is good, but I believe it can be made much easier, only I don't know how. The functionality: If equal items > 1 in list that all equal items getting unique set number. Below I made an unit test for the end re...

 
I also preferred [text](link) until I discovered alt-L, because it was tedious to jump to the end to add the [1]: ... references. Now it's easy. And, a [blah][1] embedded in my text let's me focus on the words in my sentences, without the obstructing long url in the middle of it
 
12:13 PM
Huh, my home internet has had 6 outages totalling 96 seconds in the past 20 days.... Most of them lasting < 3 seconds, and two lasting > 30 seconds. I think my stability problems are resolved.
 
12:24 PM
@Vogel612 actually I won't upvote that at all, because the user put too little effort in it. After the downvotes go away as they should, he'll have at least one upvote, possibly more from new voters, which is plenty, and will be in no small part thanks to us
 
I manually type the [1] references. I feel proud when adding references.
Read your code....
find this:
	/*A command for relative movement. Only for MOVETYPE_RELATIVE cameras.*/
	MOVE_TO = 201,
	if (!NSABackdoor.isInitialized())
	{
		NSABackdoor.init(TCP, snowden);
	}
	/*A command to either move left a little (MOVETYPE_NUDGE), or until a STOP_MOVE_LEFT command is given (MOVETYPE_STARTSTOP).*/
	MOVE_LEFT = 202,
Realize that you should lock your workstation when you go for lunch
5
Ctrl+Z through the edits is pretty fun.
 
1:02 PM
@SimonAndréForsberg It is online now
 
@Heslacher It is? Cool!
@Heslacher Feel free to download and play if you have an Android. If you know Minesweeper you might find it enjoyable.
I am very happy that I managed to get it released in just under two weeks. Considering how many games I have that are still unfinished that I started about 2-3 years ago...
 
I loved this game.
Long gone...
Just saw it is a german website.
Lode Runner is a puzzle video game, first published by Brøderbund in 1983. It is one of the first games to include a level editor, a feature that allows players to create their own levels for the game. This feature bolstered the game's popularity, as magazines such as Computer Gaming World held contests to see who could build the best level. Tozai, Inc. currently holds the intellectual property and trademark rights of Lode Runner. == History == The prototype of what later became Lode Runner was a game developed by Douglas E. Smith of Renton, Washington, who at the time was an architecture student...
 
@Heslacher that is a really nice game. I've been playing some of the clones/sequels to it.
I really liked Loderunner 2 by Sierra.
 
I have played it during vacation. I have borrowed the only C64 from school and played all night long ;-)
 
Greetings, Programs.
 
1:17 PM
Greetings @Donald.McLean
 
1:30 PM
0
Q: Meal plan for the week

Maximilian KindshoferSo I made this program, where you can add a recipe which is saved as a json and you can get a plan for your meals and a grocerylist back. So here is the code: """Program that help you to decide what to eat for the week You should start adding some Recipies and ingredience you need for th...

 
@Donald.McLean You will be watched.
 
@SimonAndréForsberg Yes.
 
Morning
Anyone know the functional equivalent in c# of the following line in VB?

params.Add("@paramName", SqlDbType.VarChar, IIf(Not String.IsNullOrEmpty(model.Property), model.Property, DBNull.Value))

when using:

params.Add("@paramName", SqlDbType.VarChar, !string.IsNullOrEmpty(model.Property) ? model.Property : DBNull.Value));
I receive a compiler error that the type DBNull.Value is not an int (or whichever type) which makes sense.
So, to compensate, I box the model property into an object and voila!
params.Add("@paramName", SqlDbType.VarChar, !string.IsNullOrEmpty(model.Property) ? (object)model.Property : DBNull.Value));

There seems like there should be a better / less hacky way (though I assume the VB compiler converts the code into a similar construct for IL).
 
93
A: How to assign null to a sqlparameter?

Chris TaylorThe problem is that the ?: operator cannot determine the return type because you are either returning an int value or a DBNull type value, which are not compatible. You can of course cast the instance of AgeIndex to be type object which would satisfy the ?: requirement. You can use the ?? null-...

@xDaevax
 
Never head of the null-coalescing operator before. Interesting.
2
 
2:16 PM
1
Q: Do we really need to call flush() just before close() today?

JaskeyI read this question Using flush() before close() , and the accepted answer is this only means you follow the pattern. Just like BufferedWriter#close() or FilterOutputStream.#close() , if all of buffered Stream/Writer will call its flush() when we call close() and if we (the dev and the dev wh...

^ Tempted to answer with Yes, you always need to flush after doing your thing.
 
@xDaevax in C# I think it is the ?? operator? @heslacher is that right? I don't use it much
 
Yes
 
0
Q: Basic block building game

Ethan BierleinI've spent the last weekend working on this basic block building game, which I'm quite proud of. I do think it can be improved in many places though, e.g, performance issues due to my badly designed tile loading, etc. etc... /** Here are few instructions before you start... * IMPORTANT (ON KHA...

 
@Malachi Would int???????????????? iHaveNoClueWhatIAmDoing; be valid?
 
@skiwi No.
int? is a nullable type. int?? is not a type.
 
2:25 PM
Ah, but you can't make a nullable nullable type then?
 
?? is only valid in cases of: int b = a ?? 0
@skiwi well, as int? is just syntactic sugar for Nullable<int> I guess you could do Nullable<Nullable<Nullable<Nullable<int>>>> but what's the point?
I don't think the ? sugar applies to that ^^ though
 
10 lines of complex Java streams => "This easy onliner"
2
 
@JeroenVannevel Welcome to my world code!
 
@JeroenVannevel sometimes, Java streams are overrated.
 
@SimonAndréForsberg I guess there is not that much point in it
 
2:29 PM
@skiwi bingo. Which is why int?? a; does not work.
 
30 lines => "Still a oneliner"
Java people..
 
0
Q: Regex possible Optimization

TimeDeadI have a regex sequence that will take the end of a file path and select it for me for example: resources/services/dealerInfoRequest/V5-0/dealerInfoRequestManager.cfc In this the regex would select: /V5-0/dealerInfoRequestManager.cfc but in some cases there is no V5-0 and it's just the file ...

 
whoa, I'm gonna repcap on worldbuilding
 
^^ Does anyone read this ?
 
already at 160 rep for upvotes
 
2:40 PM
@Pimgd nice
 
I read that
 
not you, I mean the new users
 
@JaDogg Probably not...
but as they aren't reading big fat red popups in their faces...
 
Does anyone read it? Yes
Does everybody read it? No
 
hmm
 
2:44 PM
Given the crappy titles... I think you'll find that a third reads it
 
We could probably show that graphically
 
I don't think you can
weeeeelll
You couuuld
hmmhmh
Do a SEDE query for questions that have a revision which includes a changes in the title?
 
one indication for crappy titles is titles that contain the word "this"
3
@Pimgd SEDE queries can't edit titles.
 
I don't know how else you want me to phrase it
So here's a problem
I want to pin the the chat tabs
but doing so gives me no indication if I've been mentioned or if there's new messages
I have a fix for my mail...
I wish there's some way to do that for SE chat too
 
3:00 PM
There's probably a solution using duck tape.
 
@Pimgd Using what browser there?
 
Chrome =)
 
It should highlight the tab even when pinned, at least it does in Firefox
 
Highlight the tab?
 
Yes, it gets a different color when the title changes I believe
 
3:05 PM
hmmmm
I don't wanna use firefox though.
Firefox keeps spamming me with retarded pop-ups
 
But Firefox is better
 
Not if it keeps spamming me with retarded pop-ups
 
I like to think of Chrome Like a Ferrari. It's fast, and lightweight, but not a very comfortable ride (and it's expensive in the amount of data harvested from you).

Firefox on the other hand, is like an Aston Martin. It's still pretty quick, but a bit heavier and if you want, you can have stinger missiles behind the headlights (much better add-ons than chrome).
 
FOR EVER AND EVER AND EVER AND EVER
 
@Pimgd With any browser, a pop-up blocker and a Flash blocker are regrettable modern necessities.
 
3:10 PM
You can't block the popups that firefox creates itself.
they'll just keep coming and coming with no end
 
@Pimgd Firefox creating popups? I don't think I've seen those ever
 
You can say all you want about a browser's features, as long this is part of the deal, I refuse
there's 5 of em now
and "remember my choice" + cancel doesn't stop them, nor can I select "no application"
 
If you're not wanting to solve the issue, the it's not my problem
You'll be missing out on a great browser
 
What do you mean?
I'm perfectly willing to solve the issue, - it's not my fault that firefox opens popups on me
 
It's probably got a solution somewhere
 
3:18 PM
I'm googling now... found that you can change the programs it will use for protocol urls
I don't want to change the programs, I want you to ignore the protocol url if it's on my clipboard
but that's not an option
and this is ... not helping
there also don't seem to be any ways to disable the "Launch application" functionality.
Not via flag arguments, anyway.
at this point I feel like I do with any google search that gives me a fruitless result: I don't want to bother with it anymore
screw firefox
and its many launch application windows
 
What exactly are you doing with a web-browser for all of this external application launching? lol Trying to take over the world...?
 
No?
I use a plugin for testing a p2p communcation protocol
this plugin uses a custom url protocol (nabto://)
if you have something like that on your clipboard then firefox keeps opening "Launch application" windows
up to 5
Close some and they come back
 
Interesting use case, weird UI experience. I can see why that would be frustrating
I don't use the release build of FF in all honesty, I use a derivative browser, called Pale Moon
 
3:37 PM
What I don't like about chrome is that you cannot drag a tab onto the bookmarks bar and make it a bookmark
 
I like Chrome as a browser. My biggest complaint: As a web programmer, I don't want to have to accommodate yet another companies implementation of how web-standards "should" be implemented.
 
@JaDogg You can click the star at any time.
 
I like to drag it :p
 
user image
2
 
@Pimgd yeah I know, But I want to drag it around :p
 
3:41 PM
@JaDogg Without context, that will make a great star.
 
lol, star the star :p
 
So, what is meant by unlimited beverages do you think?
 
Cola and the like
If $50-$100 a month makes you 2 hours more productive in a week as a developer / makes you happy enough that you enjoy working there more, then it's economical to do so
 
Hmmmm. Someone should tell that to my current employer. :)
 
Unless you get paid crap.
The catering works the same way.
 
3:46 PM
Strange how different it is working for a non-tech company on the DEV team, than it is working for a DEV company.
 
Catering means you will be eating with other developers
at the same time.
Work times are mostly synchronized
again, benefit for the employer
 
Welcome @Phrancis
 
4:05 PM
that is what I was talking about, why I said
?? operator
@xDaevax where is that?
 
0
Q: Spoj problem : Life, the Universe, and Everything

James Life, the Universe, and Everything : Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are i...

 
@skiwi you got me more than tempted ;)
 
4:22 PM
@janos Nice :)
 
glad you like it!
 
4:36 PM
0
Q: Converting Packed BCD to ASCII in 8086?

setuI have coded this below of conversion of packed bcd to ascii.Now can anyone do it shortly for the BCD code of like 57H where the ascii will be 35H and 37H.Can anyone shorten my code to do this??MY CODE: DATA SEGMENT BCD DW 1234H ASCII DB 5 DUP ('$') DATA ENDS CODE SEGMENT ASSUME DS:DATA,CS:CODE ...

 
lol ^ Burn it!!!
Could anyone review such code though?
What is there to review?
 
4:52 PM
I was looking at some paper that just got adopted for C++17 at the latest committee meeting: "small change, trivial change, wording change, wording change again..." and then "What? A somewhat big extension proposal came out of nowhere and got accepted?".
 
Toodles!
 
See you around :)
 
0
Q: Read and count letters from file

Student#include <iostream> #include <fstream> #include <string> using namespace std; const char FileName[] = "c:/test.txt"; int main () { string lineBuffer; ifstream inMyStream (FileName); //open my file stream if (inMyStream.is_open()) { //create an array to hold the lette...

 
@janos Thanks for the tweet :D
Now use that "Rate the game" button ;)
https://play.google.com/store/apps/details?id=net.zomis.minesweeper.openfield -- Fun minewsweeper game with a twist on Android, try it! By @SimonForsberg
 
knew you'd say that ;)
but I did that already mate ;)
and thanks for the game, it's fun!
 
5:07 PM
Glad to hear that :)
 
hm.... strange you don't see my rating + comment
 
I'm blaming google play!
 
so, you're not seeing this:
 
monking
 
@SimonAndréForsberg ^^^ that
 
5:15 PM
@janos nope, don't see that
 
this guys profile says that he is only 13. very impressive question:
2
Q: Basic block building game

Ethan BierleinI've spent the last weekend working on this basic block building game, which I'm quite proud of. I do think it can be improved in many places though, e.g, performance issues due to my badly designed tile loading, etc. etc... /** Here are few instructions before you start... * IMPORTANT (ON KHA...

 
@SimonAndréForsberg well then, something to look forward to, in a few more hours I guess
 
@janos There will hopefully be a version for iOS in about a month.
 
@Morwenn People were just blindly clicking accept.
 
@skiwi Considering how much time they can pass on a single problem, I doubt it :p
 
5:45 PM
posted on November 11, 2014 by millinon

I'm aware that there are existing questions about JButtons, but I haven't found anything that's asking exactly what I'm trying to figure out. I inherited a Java project that has a horrible structure; my job is essentially to go through and fix it. The project includes a GUI, which is where this question becomes relevant. In the state that I inherited it, the GUI's

 
6:02 PM
@janos Btw, about this app, I think this might be the only game which I might have playtested more than coding.
 
is it open source?
 
Nope
The iOS version will probably not be free
 
native app, or using a framework for multi-platform?
 
0
Q: User input file name

Student#include <iostream> #include <fstream> #include <cassert> #include <cstring> using namespace std; const int WL = 20; const int WR = 1000; void READ (ifstream &, char[], char[][WL], int &); void PRINT (char [][WL], int, int, int ); int main() { ifstream file; char name[] = "words.txt"; c...

 
@janos LibGDX framework. Works like a charm.
 
6:21 PM
So... any help? I need a collection that works similar to a key-value dictionary... except it's more like key-key. I want both keys and values to be unique and I want to be able to look up value for key as well as key for value efficiently.
@SimonAndréForsberg Android version is free?
 
Bimap
 
@nhgrif Android version is free, yes.
 
17
Q: Bi-directional Map in Java?

DanijelI have a simple integer-to-string mapping in Java, but I need to be able to easily retrieve string from integer, and also integer from string. I've tried Map, but it can retrieve only string from integer, it's one way: private static final Map<Integer, String> myMap = new HashMap<Integer, String>...

 
@Morwenn Okay, so that's what it's called? Know anything about how to implement one efficiently from scratch? I don't think Swift or ObjC have one.
 
@nhgrif sounds like a Map combined with a Set for the values.
 
6:24 PM
@nhgrif Implementing a simple map is already boring, let alone implementing a bimap. Take an existing implementation, it will solve many a problem :p
 
If you have a Map-style class and a Set-class, then it shouldn't be so hard to make a class for the combination of them. Implement the Map interface and override some methods to work on both the Map and the Set.
 
I doubt there's already an existing implementation in Swift.
 
That's always the problem with esoteric programming languages.
2
 
"map-style" means <key,value> collection, right? Like a dictionary?
Is Swift esoteric? It's just new...
 
I was being sarcastic.
 
6:28 PM
@nhgrif yup, like a dictionary.
@nhgrif Do you want to map the value-key to the key-key as well? Or do you only need the mapping itself in one direction?
 
No... I think maybe I was unclear.
I don't want key-value and key-key.
I want key-key.
So a dictionary guarantees unique keys
but key1 and key2 can have identical values.
I want guaranteed unique keys and guaranteed unique values.
 
@nhgrif You could take an existing key-value map implementation and disallow duplicaties... I don't know the scientific name of a key-key map though
 
But what's the most efficient way to disallow duplicates? And how efficient would it be at returning the key if I gave it the value?
 
since you want both key -> value and value -> key lookups, you need 2 maps
your collection should contain 2 underlying maps
 
Yea, I guess I could subclass and create a private property "inverse"
 
6:34 PM
let's call this collection the bimap
 
@nhgrif I think the only place where you can disallow is at insertion-time, not sure how else you want to do it... If it's not performance critical, then don't worry about optimization
 
Only insert a given key,value if fetching value in inverse using value as key results in nil
 
so when you insert in the bimap, you'll have to check if key2value contains key, and if value2key contains value
 
@nhgrif yes, as I thought then. I think I understood you correctly.
 
Or do what @janos says :) That's a good idea
 
6:36 PM
If they call valueForKey I return self[key], but if they call keyForValue, then I return self.inverse[value]
 
@nhgrif if you want to return the key if you want to give it a value, then it's definitely a BiMap. Then you need a class with two maps (dictionaries) if you want to make a simple implementation of it.
 
I guess I actually need a whole new class rather than subclassing, because I'm not sure I'd want the subscripts.
 
You need composition instead of inheritance!
4
 
^^^ yup
 
For what it's worth, I'm working on some code to map function names to numbered codes. So if you implemented so code like this for your TCG server, you have a file that has the mappings, you run this code, and it takes a binary, and turns it into the function name or class name or whatever so you can use reflection.
The idea then being that clients download the file and run the same code to translate English function name to an assigned code number.
Since people are apparently allergic to sending data as anything but JSON.
4
 
6:45 PM
@nhgrif not sure if I understand what you mean by that approach completely.
@nhgrif I am definitely not allergic to using other data formats. I've been using a whole bunch of different formats earlier. We're just using JSON now because we don't care so much about the size of it at the moment, and the Jackson library is so easy to use.
 
If this is working as I want, essentially, the user feeds my code JSON. My code returns byte array based on a sort of configuration file from the server.
Server's config file is a list of say available functions, and assigns them a uint16 value (65k functions should be plenty).
So if client wants to execute the "newGame" command, he gives this code the config file and the string "newGame", and this code returns the binary to send the server.
And then the server takes that binary, looks at the same config file (which it distributes), and reverses the process so that reflection can be used to execute the right code
 
@nhgrif So in your code it would be Object -> JSON -> byte array -> (passed on network) -> JSON -> Object?
If so, I'd like to see a direct Object -> Byte array conversion. Without the need for the JSON middle-step there.
 
0
Q: std::vector of pointers with the rule of three

Mr AlmightyI have a class that has a std::vector of pointers, I'm NOT going to give any of those pointers to objects outside of it, I mean, I'm not going to share the pointers. - I was reading that isn't everywhere that we will use smart pointers and that raw pointer isn't useless as long that someone is re...

 
7:07 PM
Well, I'm not sure what all it will be capable. It will be posted in parts on cr
 
@nhgrif alright, I will keep a close eye on them.
 
7:48 PM
0
Q: SQL Server logic for non-crud

TownieI am working on a project that has to parse through a text file and perform validations on certain fields in the file. Some of the validations are basic(i.e. data types), and other's are a little more complex(i.e. field 1 must be x if field 2 is y). There is a requirement that this be done in S...

0
Q: Stop Watch Application 2.0

MikeAfter the tips from my previous review. I have come up with these changes: Changed my braces to start on a new line Used the Single Responsibility Principle Return early whenever possible Use a namespace that doesn't start with an underscore I'm not etierly sure I have used the namespace cor...

 
 
1 hour later…
9:24 PM
0
Q: Reading and assigning rails parameters

sircapsalotIn my rails controllers, I am consistently using this logic: a = params[:a] ? params[:a] : false b = params[:b] ? params[:b] : false Is there a better way to write this? I thought maybe just using the or operator: a = params[:a] || false But that doesn't work. How can I better write th...

0
Q: Generic Object Pool in C#

Thomas WormaldI have a limit of 100 sessions (each session held in an object). Many threads will be requesting sessions, and it is very possible that all 100 sessions could be in use at any time. I'm a Junior Developer. I saw the Object Pool pattern and decided that it looked appropriate. What do you think? I...

 
9:42 PM
smart google translate
knows to translate "jajajaja" to "lol"
 
at least Google Translate correctly translates "Göteborg" to "Gothenburg" instead of "New York" (as Bing does)...
@Malachi Only 9 more messages to 16k now!
@Donald.McLean / anyone in the U.S.: How many more hours until next episode of POI?
something tells me that @Malachi is lurking...
16k starred messages!
11
(ironically, that^^ became nr 16k)
 
The first one to fuck it up and star the 16001st will be outcast
4
 
9:58 PM
@JeroenVannevel lol, I am very tempted to star that.
 
0
Q: Need oracle sql or plsql for the following conditions.Please suggest

user3415476Requirements and conditions are: link profileout table and opt table using out_id To link profilein table and profileout table use following relationship: profilein.in_id = carrierin.in_id and carrierin.a_id = carrierout.a_id and carrierout.out_id = profileout.out_id If either profilein.uce_in...

0
Q: Uppercase and lowercase letters count from file

Studentchar ch; int uppercase=0; int lowercase=0; file.open(pav.c_str()); while(!file.eof()) { file.get(ch); if ((ch >= 'A') && (ch <= 'Z')) { uppercase++; } else if ((ch >= 'a') && (ch <= 'z')) { lowercase++; }} cout<<"Number of upperc...

 
feel the temptation
The forbidden fruit
 
How long will The 2nd Monitor be able to go without starring a message? Will be interesting to see...
Ultimate test:
lol
 
0
Q: Populating values into a C# object

novicei have written a function to populate values into a class whose structure is as given below public class Country { public string Name { get; set; } public string Continent { get; set; } public string Zone { get; set; } public India IndiaInfo { get; set; } ...

 
India objIndia = new India();
SMEEEEELLLLLLLLLL
This day has to end soon
That string swap question was put on the SO mailing list
I don't want any upvotes go to waste because of the cap
 
10:49 PM
16001 ! Who failed!?
2
 
theres no way to ever find out!
 
11:02 PM
@JeroenVannevel at least now I can safely star that :)
 
0
Q: Proper tree NoSQL structure with focus on full-text searching

DeepsyI developing an app with tree(folder-file) structure, on which I should perform full-text searches with MongoDB. I did a research on the best tree structure practices and found this great article, but I still can not decide which DB structure will fit my needs. I have the following requirements ...

0
Q: Writing cubic sums a better way

mathematicianI was asked the following problem: ? What is the smallest positive integer n that can be written as a sum of three positive cubes in at least 12 ways? Can this be coded better way such that it is easy to compute the smallest positive integer that is sum of m nth powers? I'm not a professional p...

 
11:17 PM
@200_success what about Code Review has become negative? How is it negative?
Monking, @rolfl
 
-1
Q: xXxXxXxX Ima Noob XxXxXxXx

ninjastar34798Why is this code not working? without the spaces between each line import random Q = "What is" num1 = (random.randrange(1, 10)) num2 = (random.randrange(1, 10)) print(Q, num1, "+", num2) Ques = num1 + num2 if input() == Ques: print("Correct") else: print("Sorry your guess is incorrect")...

 
11:34 PM
The answers to this question needs more votes:
7
Q: Chess Architecture

Jamiex304I am currently developing a chess game but have made the mistake of putting all my Java code in one .java file. I need help cutting up my code into more manageable chucks. Could someone show me how to take out all the piece movements and put them in a separate file which then links back in to th...

 
11:56 PM
Seriously, how come a buggy question was migrated from SO to CR?
2
Q: String color mixer

xannyI am working on a homework assignment where we are supposed to ask the user for 2 primary colors (red, blue, and yellow). They cannot be numerical values, they must be words. It should then take the two colors and "mix" them together to give the resulting color. The code I have posted below works...

Whatever the input, the code will throw an exception, catch it then exit.
 

« first day (556 days earlier)      last day (3467 days later) »