« first day (528 days earlier)      last day (3484 days later) » 

11:00 AM
int generateRandom() {
    int result = random.nextInt(UPPER_BOUND - 1);
    if (result == lastRandomNumber) {
        result = UPPER_BOUND - 1;
    }
    lastRandomNumber = result;
    return result;
}
If lastRandomNumber is 2, and UPPER_BOUND is 3, and result is given the value nextInt value 2, then what?
 
then you need to get a new compiler.
public int nextInt(int n)
 
Hi rolfl.
 
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)
 
@Pimgd Or a new moderator ;-)
 
int generateRandom(int lastRandomNumber){
    int randomNumber = random.nextInt(UPPER_BOUND - 1) + 1;
    if(randomNumber == lastRandomNumber){
        randomNumber = 0;
    }
    return randomNumber;
}
I managed to get that one after a bit of thought
 
11:03 AM
Pimgd +1
You version is equivalent, it just uses a different special case.
 
Although I prefer AS3 style hax value = random(bound-1)+1; return value*(value!=lastValue);
 
OK, @maaartinus - I see my error, correcting some comments, but, for the record, the UPPER_BOUND-1 inoput to nextInt, given the other nextInt() calls all with UPPER_BOUND, was hard to spot.
needs comments.
 
Or a different name?
generateRandomThatIsNot(int lastRandomNumber)
oh well lunch
 
@rolfl Sure... I should better have left it out, but there wasn't much to say and I find the idea nice (it's not my idea).
 
@maaartinus - Alright, sorry about that confusion, I know these things make aa difference in voting, etc.
I am only taking part-responsibility for it... if it confused me, then .... well. who am I kidding, that was an oversight.
If you think the comments should be cleaned up more than I have, then feel free to flag the ones you don't want, @maaartinus
 
11:16 AM
0
Q: CodeEval's SkyScrapers challenge

mjolkaThis is a solution to CodeEval's SkyScrapers challenge. You are given a list of triples \$(l, h, r)\$. Each triple represents an axis-aligned rectangle, with top-left corner at \$(l, h)\$ and bottom-right corner at \$(r, 0)\$. You can imagine these rectangles as buildings against a skyline. The...

 
@rolfl It's fine... now there are only 3 comments there. I've added a short comment to the code, feel free to do whatever you want.
OK guys, I'm leaving. Bye.
 
Hai
 
grrrr frozen bread
Hello
 
11:32 AM
@Pimgd Toaster?
 
I pay for lunch at work. I should not get frozen bread in return.
I'm considering just buying snacks on my way to work on a daily basis
same microwave effort but far more tasty
... actually I think it's less microwave effort
 
Hmmmm, work.
Any tips on what to do after school?
 
after which school
 
High
 
are you asking whether you should go to college?
 
11:40 AM
Already applied for a few courses however is there anything else I should be doing to advantage myself?
 
@TheFailure Learn how to do calligraphy.
 
keep going and you'll hit a solid question
 
buy a camera... .take pictures.
travel.
 
Right now we're still in fluff territory that makes me think "but most of all, don't forget to use sunscreen."
 
^^^ that.
 
11:41 AM
Relevant text copied:
Ladies and gentlemen of the class of '97

Wear sunscreen.

If I could offer you only one tip for the future, sunscreen would be it

The long-term benefits of sunscreen have been proved by scientists, whereas the rest of my advice has no basis more reliable than my own meandering experience.

I will dispense this advice now.

Enjoy the power and beauty of your youth.
Oh, never mind. You will not understand the power and beauty of your youth until they've faded.

But trust me, in 20 years, you'll look back at photos of yourself and recall in a way you can't grasp now how much possibility lay
 
Oh, add more context. What else should I be doing to advantage myself toward a career as a programmer?
 
build a good portfolio, i suppose
 
Hmmmm okay
 
That's still a hard question to answer
 
Damn, I don't know how to make it any easier..
 
11:44 AM
I mean you could go to college and then to university
or... jump straight in
or only do college...
 
Oh, I am going to uni.
 
or maybe somehow skip college, I don't know how these things work in other countries.
 
i wouldn't take on a lot of debt to go to university, that is my advice
 
@TheFailure - find something you like, and get passionate about it. If programming is it, then get programming, and explore the domain.
push yourself, and learn your limits.
learn something new every day.
 
I'm passionate about programming too but weekend is weekend man
some days I just wanna play games
 
11:47 AM
^^^ do that too.
 
And here's the ambiguity of your question
 
@rolfl I am loving your answer
 
@TheFailure then read the long thing that Pimgd posted above, it has lots more of that type of stuff
 
> Learn something new everyday.
Most excellent advice.
 
I do the learning thing already, but I have this nagging feeling I also forget a thing everyday
so yeaaaaaah
also the autist in me is basically screaming at "something new".
It's so vague...
you could go through C's standard library, looking at a function each day
I suspect you could fill many years with that
I'm not sure whether it will help
also... if you watch/read the news daily, don't you already learn something new?
 
11:54 AM
all good points :)
 
@Pimgd Yes, you do, so follow important/trusted news sources (bbc, local, and technical)
 
All of them? I only had to learn 1 thing a day, right?
 
Suppose go onto programmers.se and look at common interview questions and do them.
 
@TheFailure - if you were to read and understand a question/answer on Code Review each day, that would take you a long way.
Once you get started though.... it's hard to stop.
 
there's more than just code to programming
 
11:57 AM
@rolfl I will do 3 :)
 
@TheFailure Ah, I got a bit of advice for you. Learn how to manage your time.
 
@Pimgd Of course, there's boredom, monotony, politics, etc.
 
My downfall :(
 
Specifically, learn how to estimate, what you can promise, what you can't promise, and how you can negotiate
 
But, there's also creative aspects, intelligent solutions, elegant tricks, etc.
 
12:03 PM
Writing a list and going to sign it promising it to myself
 
That's... slightly dangerous
 
What should my enforcement be?
Why?
 
@TheFailure one thing I would tell you is to not be too idealistic, and be ready to change your mind and ideas when better ones come along
 
You're likely to get parts of your list wrong,
then rationalize your way out of your list later.
 
Hmmmmm.... This is difficult
 
12:05 PM
achieving mastery of any profession is going to be a long, slow grind, so the most important thing is to just keep doing it
3
 
1
Q: Immutable objects in java

Ishan SoniI just finished studying immutable objects and their advantages so I thought I'd create one of my own. Here is my employee class that extends a person class. It is not mutable since i have getters to my mutable date objects. package objects.objects; import java.util.Date; public class Person {...

 
You see, you don't really need to do item #1, since you know X and Y already. And the same goes for #2 as well... well, not for #3, you should do that maybe... but not right now, you're far too busy. But #4 was actually already done, technically speaking, and #5 and #6 turned out to be irrelevant... ... the rest of the list doesn't have much value either...
I've been there, and I always kill off said lists eventually.
 
Hmmmmm
Ooooh, beginner Java question
 
... find a goal you REALLY want to achieve. Then work towards that, I guess.
You can't rationalize something you want to achieve away, because you'll be rather quick to remind yourself that you haven't achieved it yet
 
Greetings, Programs.
 
12:08 PM
I don't know what I want to achieve....
 
watch out @Donald.McLean, the 2nd Monitor is very philosophical this morning
@TheFailure what you want to achieve is financial security, that goes a long way toward happiness i think
 
@TheFailure ah but that's easy, you'll probably know it subconciously
You want to get rid of things that bother you and do more things that you like
it always boils down to that
 
I have achieved most of the truly important things already, but I still have a long list of other things I would like to do.
 
what kind of long term goals that translates into... well... likely to be defined by whatever bothers or interests you
 
Can yous tell me some of your achievements you are most proud of?
 
12:11 PM
@Donald.McLean Greetings, user!
 
I was one of the best in a shooting game for multiple months.
I have many other achievements, but most of those were given to me.
 
@TheFailure you mean aside from my quite nice rep-curve for CR??
 
You do a school project because school tells you to
and.. well...
I'm proud of younger self to be able to work on and complete a game
 
@TheFailure I've been happily married to a wonderful woman for 28 years. I have three great kids. I have an interesting job that pays well and is the envy of my fellow geeks.
4
 
@Pimgd what, you completed it??
 
12:13 PM
well
 
@Donald.McLean well, it's hard to have such accomplishments when having been born after your marriage....
I hope that means what I think it means, else it would be absolutely nonsensical.
 
So start a project that can be continuously added onto and updated like a game or website would be helpful?
 
well yeah. I built my own game(s), but I'm most proud of the one that I supported for multiple months
@TheFailure very much so. These things will pay emotional dividend later on.
 
@Vogel612 Being an old geezer does have some advantages.
 
It helps if it's resistant to time too
 
12:15 PM
@Vogel612 Being an old geezer does have some advantages.
 
Hmmmm, sounds like something to do tomorrow :)
 
Mind you, I married later than @Donald, I think.
 
start*
 
that kinda remins me of that one comment by HansPassant...
 
It's... not something you just start like that, although you can, in theory.
 
12:16 PM
See, here's something to learn today, @TheFailure, if you press the up-arrow twice, you can edit, and fix the start.
 
I built a single-page web app from scratch, by myself.
 
Posting an answer at SO can be a lot like teen-age sex. Ten minutes of fun and then you'll have to support it for the rest of your life. — Hans Passant Oct 5 at 16:26
4
 
But for me, those things that pay emotional dividend didn't start by "I'mma make something great"
 
@Donald.McLean <html><body>Hello World!</body></html>
 
It more started with something I just wanted to do
 
12:17 PM
s/Posting an answer at SO/Starting programming a game/
@rolfl IIRC head is required...
 
Basically, be a dwarf!
 
I built a single-page web app from scratch, by myself, that manages the Hubble Space Telescope data archive.
 
Get a spark of inspiration, horde some materials, throw a tantrum and create a masterpiece.
 
@TheFailure i would suggest that smaller, finished things will be more impressive to a potential employer then one large unfinished thing
 
@bazola In my experience I noticed that employers like their things to be recent, so just building something now doesn't really work that well
 
12:20 PM
I am no good at coming up with ideas. Should I be doing projects in a new lenguage every time for the learning bit?
 
@TheFailure he said, after 5 minutes
 
Sorry, that sounded a bit mean.
 
@TheFailure It depends. Some companies respect breadth of experience, and some are looking for strong skills in the technologies they use.
 
12:21 PM
Good ideas don't come easily. But when you have them they'll be obvious...
 
@Pimgd There is a reason I made an account with this name.....
 
@Donald.McLean That does require more than just 'hello world', it requires "Hello UNIVERSE!"
 
@TheFailure get rid of self loathing where you can, it'll come back soon enough anyway
4
 
@Vogel612 Hit Ctrl-U to see the source. Just because the browser adds it, does not mean it's needed.
 
12:23 PM
Where I work, we use some technologies that are not widely used and so they try to hire people who are talented and have diverse experience rather than particular skills - because good people can learn the necessary skills.
 
what I am trying to suggest is that the ability to take an idea all the way to completion is more important and impressive than having the idea, or starting working on the idea
 
Whether it will be in form of regret of saying one thing and doing another, shame for making mistakes, or just abject horror at past decisions (I WROTE THIS CODE?!)...
 
I have less trouble coming up with ideas than I do finding the time to finish them.
 
@Pimgd Yep, what I think after 10mins
 
Code Review down?
 
12:24 PM
CR up
 
Up for me
 
back up for me... hmmmm
 
Most of the time I have pretty good ideas (or so I think, anyway), but I tend to quickly find out they'll be huge projects
 
@rolfl the strict DTD seems to allow missing HEAD, if my DTD skills still work...
 
@Vogel612 I thought chrome will automatically add empty head
 
12:26 PM
@Pimgd I though so, too..
 
I have no ideas
 
 <!--================ Document Head =======================================-->
    <!-- %head.misc; defined earlier on as "SCRIPT|STYLE|META|LINK|OBJECT" -->
    <!ENTITY % head.content "TITLE & BASE?">

    <!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head -->
    <!ATTLIST HEAD
      %i18n;                               -- lang, dir --
      profile     %URI;          #IMPLIED  -- named dictionary of meta info --
      >
 
Chrome translates
<html><body>hi</body></html>
into
<html><head></head><body>hi</body></html>
 
but <!ENTITY % head.content "TITLE & BASE?"> is not #REQUIRED
and neither does the html entity declaration declare them required..
<!--================ Document Structure ==================================-->
<!ENTITY % html.content "HEAD, BODY">

<!ELEMENT HTML O O (%html.content;)    -- document root element -->
<!ATTLIST HTML
  %i18n;                               -- lang, dir --
  >
 
Anyway, most of the good ideas are acted upon because you want to, badly.
I made my own game because I wanted to do so
and nothing was gonna stop me
sure it has really bad code and <devaluing comments here> but I made a game because I wanted to
 
12:32 PM
Hmmmmm ok
 
as what to do with your life on a whole
My mother says "find a job that you like because you'll be doing it for the rest of your life"
and I think that's true
 
Same
 
so do that, or you'll be in your own personal little hell for 8 hours a day, 5 days a week.
2
 
Sounds fun
.....
 
hence @bazola 's comment about achieving financial stability
it's far more easy for you to steer your career if you're financially stable
 
12:36 PM
203... messages... must... read...
 
If you still don't know, setting limits might help.
Eat as much as you want without worry, as long as you don't go over X KG
Spend as much as you want, as long as you set aside X per month and pay your bills
 
Already doing that
 
And do what you want, as long as it doesn't make you sad.
 
........
 
(Disclaimer: Legal restrictions may apply. This is not a waiver. Please don't go stabbing people because it's fun =D)
 
12:41 PM
Noooooooo!
Ideas....
 
@TheFailure I'd advice you to start small and then build bigger and bigger things, it is really really nice to see some things working and fully playable/functional... Better as 100 failed attempts, sure you learned something of each and every failed attempt, but usually you cannot show it or use it in a portfolio
 
... so which of your high school grades is the highest
 
@skiwi It's still the idea part that I can't do.
@Pimgd ????
 
I made a derp, I meant high school
 
Ummmm Math C and B I guess....
 
12:50 PM
@TheFailure I'd suggest to focus on one core language when learning, but do not forget to get some techniques in other languages as well, though it's often wise to first get good at one language and learn programming, not necessarily a programming language, but just programming.
 
@skiwi I made this account to focus on new things as I have been using java for about 2 and a bit years.
 
@Pimgd Being rational about new projects can be a killer sometimes... Sure, you are being rational, but do you think the guy who coded Minecraft would have started if he thought out rational? (Disclaimer: I think rationally too!)
 
@skiwi Sure, but I've retried to create a game based of certain elements a couple times and it was not until I actually took 2 days on it before I realized it just wasn't possible
 
@TheFailure Ideas simply happen... At least for me, I always suck at so called sessions where you need to come up with an idea within 2 hours
 
Ok, I have earned the privileg to protect question. So what ? How can this be done ?
 
12:52 PM
@TheFailure, may I suggest you ditch the name in favor of something more positive. Positivity really does matter if you wish to succeed.
 
Or rather, it was possible, but it would require sick amounts of balancing to get right.
 
@Pimgd Without knowing what you were making, I tend to disagree with it not being possible... It not being reasonable to do, is something else... Unless you were talking about making an MMORPG or something, then it's just not possible alone
 
... RPG that uses and combines body parts
 
For the bigger projects you want multiple people anyway, there's always going to be times (when talking about projects in free time mainly) that people feel a bit down about the project. Their motivation then is to see others working on that same project.
@Pimgd Ouch... difficult
sounds cool though
 
The idea was that different monsters could do different things depending on their limbs too
 
12:55 PM
Spore?
 
no... think more like mecha's
 
@Pimgd Damnit, "my idea" is not so unique then... It's been 1-3 years for sure since I thought about it though and I had practically no experience with 3D back then
 
your left arm punches this guy, your right arm blocks mid center, you shift your legs to support your block, and you shout at your opponent.
End turn.
Except then the other guy got his turn, moved to your back, tripped you and pinned you by letting himself fall.
so it quickly broke in terms of balance
the idea of multiple actions is cool, but it quickly turns into a overpowered offense
turn based doesn't work very well with that
 
Hmmmmm, ok what would be a good project to start on?
 
Is that still some kind of turn based game then?
Oh, you answered it there
I initially wanted to do it MMORPG style already... but I just lacked experience to do that
 
12:59 PM
... it would have to be real time, except real time doesn't like complex systems very much
and so it would need some sort of simplification
along the lines of "no causal actions in the same turn"
@Heslacher that was said 43m ago
 
I see, I just used the starred one and thought it directs to the post.
 
but I basically figured out I'd be describing tons of different attacks for monsters
and then I'd have to balance them
and that would be hell, because I have no idea what you can do with a shapeshifter in such a system, but I assume it's pretty nasty
I keep the idea rolling around in my head from time to time, maybe one day I'll come up with something
 
@Pimgd have you ever played Magic The Gathering? It has an interesting system for resolving complex actions in a pretty simple (turn based) way.
 
@Pimgd I'd use some sort of tool that automatically does that... Still a hell to program, but would make it somewhat more balancable
 
That's just the thing: I've defined a system that looks a lot like a TCG or a CCG but I don't want to write all the cards
plus, what's to stop the player from finding a combo that works (backpedalling and shooting arrows!)
and using that over and over and over and over and over and...
 
1:05 PM
So what would be a suggestion of something simple at first but easily expandable?
 
@TheFailure any arcade-y game.
 
@Pimgd like?
 
heck, anything that has a play cycle of 5 minutes or less.
Pacman.
just about any arcade-y game you can tack power ups onto
Pacman is pretty hard since it's got this whole fixed world thing going on
(although I can see ghosts laying traps, and different level designs)
But dang, power ups
A gun in tetris that will let you shoot blocks
 
Wow, that seems great
Gun...... Tetris....
 
...
Actually I have an idea for you go play this game
 
1:09 PM
I am on my phone atm ;)
 
Curses
...
Okay then bookmark it or something
it's a stupid arcadey game.
It introduces new elements after periods of time.
 
@Pimgd Ah nice, you have a game on such site, it was from your AS3 time, isn't it though?
 
You need to dodge enemies.
@skiwi yeah it is
but basically you can click to get points every x seconds.
 
Hmmmm
 
I don't have much clue about those browser games, in what alnguages would they be written nowadays?
 
1:10 PM
And there's stuff to dodge.
 
JavaScript + WebGL?
 
Except they move faster after a while (That's a feature).
And some of them move even faster and are gold (That's another feature)
And then you can find balls you can click for more points... but they might require you to get out of the center of the screen (that's another feature)
And then enemies start to move diagonally too
And then there's a ball that makes enemies freeze (move slowly) for a bit of time
and then static enemies, who, if you hit them, don't take away a life, but spawn a bunch of extra enemies
 
text-based browser games were also fun... but they seem to be no more, it's from the time where lots of people were really behind their PC, whereas nowadays a lot of people do not have a PC anymore and only use a smartphone... And occasionally shared PC/laptop for school documents, talking about high school though
 
and then balls that make all the enemies on the screen disappear
and extra lives
and homing enemies
And when you're building such a game...
You'll have PLENTY of ideas.
 
Okay
 
1:14 PM
Mobile walls block your movement, bonus zones that give points if you're near them, curses that enlarge your hitbox, boosts that double all your points, panic buttons that will allow you to clear the screen, ...
you name it.
Multiple game modes. Multiplayer! A gun you can use to shoot back! Things that can be shot so they get destroyed, but spawn enemies until they're destroyed!
 
0
Q: Find primes using "naive" algorithm

LordAroI know I can use Sieves to make this faster, but I wondered if there's anything I'm missing with this implementation of the "naive" algorithm On my PC running the command (first million primes) g++ -std=c++11 -Wall -Wextra -Ofast primes.cpp -o primes && time ./primes 15485863 Takes approximate...

 
You can add as much as you want to with these kinds of arcade-y games
Plus, when you share your game, you'll get players.
And players have feedback and ideas too.
before you know it you'll be swamped
If you're interested in designing games because you want to build a game, read this blog. gamedesignconcepts.wordpress.com
 
We are looking into what's making data.stackexchange cranky.
 
Snippet from first chapter:
Let’s Make a Game

You might be wondering how all of this is going to help you make games. It isn’t, directly… but we need to at least take some steps towards a shared vocabulary so that we can talk about games in a meaningful way.

Here’s a thing about games. I hear a lot from students that they’re afraid they won’t be able to make a game. They don’t have the creativity, or the skills, or whatever. This is nonsense, and it is time to get that out of our systems now.

If you have never made a game before, it is time to get over your fear. You are going to make a game now. Take out a pencil
 
Designing games wasn't my career aim but I suppose it will help for this :)
 
1:23 PM
0
Q: when would you write static method?

Elad Bendawhen would you write static method. I used to write it in utils classes where all the methods are static and work state-lessly on arguments only. But now I know it blocks from creating a seam in that point so even if it works on arguments only I prefer making it non-static. When would you wri...

0
Q: would you wrap any serviceObject with interface?

Elad BendaI'm new to UT and some of the best practices and anti-patterns when writing testable code, made me think. I used to wrap any service object with interface. but I see many mocking frameworks can mock a concrete type as well. Should I create an interface only when I have at lease two concrete c...

 
hey I dunno what you like to do so I'm just offering suggestions. I like to play games, so building games quickly leads to "it would be cool if the game had X or Y"
 
Hey everyone!
 
@CaptainObvious VTC no code, code not written and perhaps in the future example code
 
@Pimgd I know :) thanks for all of this.
 
@CaptainObvious VTC DITTO.
 
1:27 PM
Hey @Marc-Andre
 
Well, I am going to sleep now. Night everyone!
 
Night @TheFailure
 
The Stack Exchange Data Explorer is back online, but we'll continue to keep an eye on the connection pool issues that caused it to go down.
 
0
Q: Uppercase vector

Himagra ChawlaRead a sequence of words from cin and store the values in a vector. After you've read all the words,process the vector and change each word to uppercase.Print the transformed elements, eight words to a line. #include <vector> #include <string> using namespace std; int main() { string one; vector<

 
@Marc-Andre Hey! How went the vacations?
 
1:35 PM
Hello again :)
 
Hello Morwenn.
 
Hi!
 
Hi TopinFrassi, and @All
 
hey @Morwenn
 
@TopinFrassi It was so nice! Really enjoyed New-York! I have a tons of photos and souvenirs ! I'm glad I did it! My feet hurt like hell and I'm tired at work, but it was worth it!
 
1:54 PM
Great!
 
22
Q: Is there a cap on simultaneously active Wi-Fi Access points in a single area?

PimgdI'm writing an API for controlling an external device. Part of this API is having the device scan for Wi-Fi access points. The API will be implemented across many types of devices, with varying memory capacity. I want to know whether I can just allocate a buffer for found access points once and t...

+22 in a day, and answered my question too
 
@TopinFrassi You, did you have a nice weekend?
 
this is why I love SE
 
@Marc-Andre Pretty boring honestly :p
 
@Pimgd Can't you count the number of atoms within the reachable area? Then you'd have a nice upper bound
2
 

« first day (528 days earlier)      last day (3484 days later) »