Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 Nov 2002
Online Last Active Today, 03:24 PM

#5206490 Java how to do this

Posted by alnite on 24 January 2015 - 07:10 PM

I think the problem is that you are not saving the resulting string from the previous invocations, so strOutput only yields the result from the last replaceAll().

strOutput = english.getText().toString()
for (int i = 0; i < enLang.length; i++) {
    strOutput = strOutput.replaceAll(enLang[i], petLang[i]);
return strOutput;

#5205857 Should I leave the current company and take the risk?

Posted by alnite on 21 January 2015 - 03:24 PM

I have offered a C++ Augmented Reality job, which is interesting to me, at least I won't go far away from GD.. but I'm very worried, it's a small company, pays less, and right now, the manager told me that there are two c++ guys that are leaving and they want me asap.


That's actually a redflag.  Perhaps there's something with the management or the financial of the company.  If this is a brand new startup with lots of funding, and everyone is excited to jump onboard, that's a whole different story.  But the fact that there are people quitting, and these two happen to be (I would assume) the core C++ programmers, you would be left out dealing with source code which you have no idea how it works, and there's deadline looming over your head because he wants to join you ASAP.


My suggestion is look for other opportunities.  Take advantage of the idle time you have at work as much as possible by learning/working on separate projects that can make your resume look better.

#5205206 A new beginning, some questions for pointers for a stranger to coding

Posted by alnite on 19 January 2015 - 12:18 AM

I am now going to self-proclaim myself as an expert.  So, in addition to reading my expert advice, please read the forum's beginners guide for further references.


As I understand it's rather easy or at least possible to change to another platform with JAVA coding am I right?

That's what they say, but usually when you are coding an app, be it for mobiles or PC or server-side, you will eventually use the platform-specific libraries.  That promise only holds true when you write a Hello World, or a very simple program.


The list that says you first need to start with tetris, then breakout, then pacman isn't authoritative.  You don't have to have that exact sequence.  What you need is lots of experience.  Lots of programming experience dealing with lots of different things.  That sounds a lot, because well it is.


Programming is a tricky skill.  No one can tell you exactly how to become a good programmer.  Unlike, let's say carpentry, in which you may have some blueprints of a design, along with its measurements, programming doesn't have that luxury.  There are sample codes, but part of the fun of programming isn't making someone else's games, it is to make your games.  To make your own game, you just have to do it with trials and errors.


The good news is that you don't need all of those just to create a game.  Creating a game counts toward that experience, and you don't even have to start with tetris.  Make some lame game where you get to drag this...camel, collecting stranded adventurers in desert, or something like that.  Create a game with ridiculously simple mechanic that takes a 2-year-old no longer than 10 seconds to master, like Flappy Bird.


Don't be discouraged by its simplicity, nor feeling like a loser for making such a ridiculous simple game.  If your friends make fun of you for making ugly simple games, instead of shiny 3d graphics with unity, then dump them and make new friends.


Don't worry about the nitty gritty details like whether to use Paint or Photoshop, or which IDE, or what PC with what video cards.  All of those are irrelevant.  Just pick one, and start coding..

#5203983 I am beginning to hate the IT and gaming industry.

Posted by alnite on 13 January 2015 - 12:04 PM

Tbh, I never want to work for a game company ever again (unless I'm running it of course)

Awesome! We are on the same boat now!


General tech industry interviews are more annoying than game industry btw, and you have experienced some of those at Microsoft.  They want people with a particular set of skills with X years of recent experience.  One example is this one company that builds game engines using Java.  I have worked on Java professionally for like 6-7 years, but I wasn't using Java in the last two years.  They flat out rejected me.  Like, flat out rejected my resume!  They didn't even want to call me in for an interview.


Here's some insights about these employers:

People are picky, but they don't really know how unqualified they actually are to be picky.  This is why you see job description with bazillion requirements.  They don't know what they want, they vaguely know what kind of person they are looking for, but they can't make a decision.  So they just throw in the most impossible qualifications.  They want the best, likable, person they can find who's willing to take the bait.


If you are applying at a hot startup company (e.g. Twitter back before it went IPO), this can get worse as ego will bloat their little heads thinking they are a hot piece of a company.  You gotta be as "cool" as them.  The definition of cool is up to whatever they feel at the time they interviewed you.


If you are applying at a company that's as behemoth as Microsoft or Google, then you are at the mercy of whichever department interviewed you.  Their expected set of skills might be different than that of your resume.  Expect the worse.  I have had an artist interviewed and rejected me.  A fucking artist who didn't even ask me any technical questions rejected me.  Obviously he didn't like me.  What could I do?


Employers buy skills, they don't buy potential.  They buy what you can present at your resume and interview.  Even if you have done your best to present yourself, sometimes people expect different "type" of person.  I have interviewed many qualified candidates, but my coworkers didn't like them.  They vibed you.  "Can I get along working with this guy?",  "Oh he talked to much", "Oh he is too opinionated".  "I don't like his hobbies".  "I like cats and he said he loved dogs.  I don't like dog people", "Oh he doesn't have a Facebook account.  He's got something to hide."


Whatever random crap that's going on in their heads.  You can't control these.


The best thing you can do is to do your best presenting yourself.  If they don't like you, then fuck them, you move on.  End of relationship.  Did you know one of cofounders of What's App applied for a job at Facebook and Twitter but got rejected?  Technically unqualified?  Hardly.  Whoever interviewed him at Facebook and Twitter didn't like him.


Accept the fact that there are millions of personalities out there.  Job interviews aren't just about a set of skills, it's also a match.com.  If they personally don't like you, they will come up with lame reasons, within legal boundaries, why to reject you, which I am sure you have grown tired of.

#5201763 Is it a good idea to block android phones that cause lots of trouble?

Posted by alnite on 04 January 2015 - 10:46 AM

I thought Google provide you with a crash log remotely?  Last time I did Android development, you can check in your Google developer page the recent crashes along with their stack trace.


Singling out particular models because your app is crashing is bad engineering.  Unless it's beyond your control (e.g. hardware issues, in which case it should only affect that one device only), you can normally find the problem.  Perhaps it's a timing issue if your app is multi-threaded.  Perhaps different resolutions causes some computations to mess up and you got a divide-by-zero.  Maybe your app is consuming too much memory, and these phones can't handle it.


Releasing an app is running a business, and these are your customers, so I would recommend that you investigate and try to fix it.

#5188631 Does Valve have a good working methodology?

Posted by alnite on 22 October 2014 - 05:29 PM

Somewhat related:



There's also the part 2.  Check it out.


The whole idea of this loose structure is based off trust.  Without trust, this won't work.  So obviously, if you have an enormous company with poor management teams and where 50% of employees aren't happy, you can't just switch to this structure and expect everybody to get happy and get along.  This is something that has to be built from the ground up, starting from the core original employees, and the support from the management.


Managers of a Big Co sometimes want to keep that power.  Why?  They don't trust their employees will do the right thing.  They treat them like some kind of farm animals, resources that needs to be caged and directed to maintain order.  This is fine and well, but domesticated employees will do nothing but being told.  Without direction, they will refuse to work.  When there is no project to work on, nobody will come up with a new exciting project, people will simply sit and idle.  Not because they can't start one, because they don't want to.  Why should they?  They don't get paid extra for it, and perhaps if the project did end up successful, the managers or other people will try to steal the credit -- because there's no trust among the employees.


While a structure that's as loose as Valve's encourages employees to be independent, so they can have some 'ownership' or 'investment' to their projects, which ultimately benefit the company as a whole.  The idea is for employees to understand that the company trusts them to do the right thing, and that they should be the one turning the gears, not being the cog in the wheel.

#5182246 Fear of replacement

Posted by alnite on 22 September 2014 - 04:00 PM

Test, test, test your code.  Everyone makes mistakes, even professionals, even those with 1000 years of experience (exaggerated).  Your brain is so fragile that your thinking can be affected by the time you wake up/sleep, what you ate, what you drank, what your friend just told you, or a bug buzzing around your monitor.  Pretty much everything.  Any developer who refuses to write tests is only fooling himself.


Your coworker is immature.  Any senior engineer would've understood that everyone makes mistakes, and not make a big deal out of it.  He's not a team player, and plays the blame game.  If your manager is anywhere smart, he'd boot him instead of you.  Act professional, admit your mistakes, correct your mistakes, and don't play the blame game.  What you did was right.  If the company decided to boot you, it's their loss.  Really.  Keeping that coworker would damage the company more.

#5168691 Looking for feedback to add more of a 'point' to our game

Posted by alnite on 23 July 2014 - 11:33 AM

You need quests.  You need to direct people what to do when they first play the game.  I just tried your game, and found myself having to consult the manual a lot just to find out what I can do or cannot do.  And I have done a lot more reading than what most people would be willing to do.


As a level 1 thug, I can only pickpocket or punch, which only netted me ~$20/action.  When can I move on and do something else?  What commands should I enter to get to those?  I tried buying some drugs, and it tells me to get a container, and after consulting the manual (again), I can't find containers anywhere else in the shop.


Tell players exactly what to do:

"You are on your own and need some cash.  Type .crime pp or .crime punch"
> .crime pp
"You stole $100 from wandering tourists!  Awesome, let's buy some containers so we can get drugs later.  Type .shop buy container"
> .shop buy container
"You spent $10 on a container. Nice! Your buddy Joe asked you for some cash. Type .crime punch Joe to tell him to go away, or .debt add Joe to loan him some cash"
> .debt add Joe
"You loan $20 to Joe.  He said "I appreciate it" and left.  You now have $50. Go rob more tourists"
> .crime pp
"You stole $150 from wandering tourists!  Now let's try to trade some drugs"

You get the idea.  After players get a hang of the game with some commands, then you can let them go in the open world.

#5149515 Fastest way to get elements in one list but not in other and vice versa

Posted by alnite on 25 April 2014 - 05:35 PM

edit: ok. apparently I misread the question.


std::vector<T> difference(const std::vector<T>& A, const std::vector<T>& B) {
  std::vector<T> result(std::max(A.size(), B.size());
  for (auto &e : A) {
    if (std::find(B.begin(), B.end(), e) == B.end()) {
  return result;
difference(A, B); // A - B
difference(B, A); // B - A


Possible optimizations:

  • Sorted A and B can use binary search.
  • Only perform this operation when A/B change.  If you can identify a part in your code where A and B change, you can minimize the recalculation.

#5136251 Moving away from the games industry

Posted by alnite on 03 March 2014 - 11:31 PM

I am not in the game industry right now.  I switched around 4 years ago, after working on a failed game startup with crazy long hours.


I do not regret switching away.  However, that does not mean that I hated or gave up game industry completely.  There are moments where I would like to make a game, but it'd be my own game, not someone else's.  So you do not have to give up your passion in games.


Switching away also allows you to see what everyone else has been doing in the enterprisey technology -- what technology, tools, and practices they use.  Gee, DB, enterprise solutions, cloud technology, Big Data, Hadoop.  Even though some people may find them boring, I don't.  It's really up to your personality.


My lifestyle since then has changed a bit.  I play less and less games, because my crowd at work are naturally more diverse.  When I moved away, I realized game industry is a very exclusive community.  They love playing games, they love seeing pretty graphics, and they discuss games.  It's a very adorable community, and I meant that in a good way.  There are also some that are on the extreme side.  Hearing stories that you have to be a serious player of LoL if you work at Riot Games sound ridiculous to me now.  Moving away from it, if anything, actually benefits my perspective of the industry, and I could reapproach it later, if I want to, with a fresh pair of eyes and knowledge.

#5127610 Why it is so hard?

Posted by alnite on 30 January 2014 - 05:44 PM

I am not sure how artists could be hard to find, but to tell you the truth, if I were an artist, I too would be skeptical of these "profit-sharing" projects.


It's much easier to pay things up front.  Profit sharing is what mostly inexperienced developers would promise.  They can't pay, so they promise they would share profit.  Is there even a profit to begin with?  How can you guarantee profit?

#5127103 C++ Interface Review

Posted by alnite on 28 January 2014 - 07:54 PM


void TextButton::HandleInput(Mouse mouse)
	// Don't accept input if the button is disabled.
	if(isEnabled == false)

	bool isMouseOver = IsMouseOver(mouse.mousePosition);

	//Set MouseOverState
		if(mouseOverState  == MouseOverState::None)
		else if(mouseOverState == MouseOverState::Begin)



		if(mouseOverState == MouseOverState::Stay)
		else if(mouseOverState == MouseOverState::End)
			mouseOverState = MouseOverState::None;


IMO, you should have handled this on GameObject.  That way all objects that inherit from GameObject will get mouse handling for free.


Having said that, considering that your MouseOverState is just an enum, and its values are Begin, Stay, End, I would collapse all those mouse events into just one:


class IMouseOver
    virtual void OnMouseOver(const MouseOverState::MouseOverState&) = 0;


Then, when you want to invoke a Begin/Stay/End event:


if (isMouseOver)
    if (currentMouseOver == MouseOverState::None)
        currentMouseOver = MouseOverState::Begin;
    // ... and so on


currentMouseOver is an instance variable that belongs to TextButton.  Again, If you do this on the GameObject level, this implementation would be in the GameObject, currentMouseOver would belong to GameObject.  TextButton, ImageButton, EtcButton would get it all for free, and they don't have to maintain the mouse over state.


You could also go another step.  Not all GameObjects should respond to mouse states.  Some GameObjects might be invisible, for example.  Then you can create another class, let's call it UIObject, which inherits from GameObject and implements the IMouseOver interface.  Then your TextButton/ImageButton would inherit from UIObject.


class GameObject { ... };
class UIObject : public GameObject, public virtual IMouseOver { ... /* implement your mouse stuff here */ };
class TextButton : public UIObject { ... };

#5126788 C++ Interface Review

Posted by alnite on 27 January 2014 - 02:01 PM


#pragma once

namespace MouseOverState
	enum MouseOverState
		None =0,

class IMouseOver
	virtual ~IMouseOver(void) {};
	virtual bool IsMouseOver(sf::Vector2i mousePosition) =0;
	virtual void OnMouseOverBegin(void) =0;
	virtual void OnMouseOverStay(void) = 0;
	virtual void OnMouseOverEnd(void) =0;
	virtual void SetMouseOverState(MouseOverState::MouseOverState mos) { mouseOverState = mos;};
	virtual MouseOverState::MouseOverState GetMouseOverState(void) const { return mouseOverState; };

	MouseOverState::MouseOverState mouseOverState;



Why don't you do this instead?


class IMouseOver



    virtual ~IMouseOver(void) {};

    virtual bool IsMouseOver(sf::Vector2i mousePosition) =0;

    virtual void OnMouseOverBegin(const MouseOverState::MouseOverState&) =0;

    virtual void OnMouseOverStay(const MouseOverState::MouseOverState&) = 0;

    virtual void OnMouseOverEnd(const MouseOverState::MouseOverState&) =0;


#5114236 Help please, :)

Posted by alnite on 04 December 2013 - 12:21 AM

I can't believe you linked me to google blink.png . I searched google in relation to qt but didn't get any answer that is why i asked.


Anyways, my question has been answered by qtcenter ( thankfully).biggrin.png


In the future, it's always a good thing if you spend some effort to your question before asking it.  Don't just expect us to solve your issues at your whim.  Always search your question first on major search engines, most likely someone else have the solutions and posted it somewhere.

#5082575 Why XML is all the rage now?

Posted by alnite on 02 August 2013 - 03:09 PM

And just to reinforce my point, in INI:


Just when I thought "maybe I should do the INI too!"  biggrin.png