Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 01 Oct 2005
Offline Last Active Today, 12:44 PM

Topics I've Started

java.lang.String split

02 April 2013 - 03:21 AM

I just recently found out that Java's String split method works in (at least for me) unexpected ways:


"hello".split(",").length  // -> 1
",".split(",").length      // -> 0
",,".split(",").length     // -> 0
" ,,".split(",").length    // -> 1
"".split(",").length       // -> 1


Is it just me that thinks this is weird?

  • Did they forget about empty strings?
  • Isn't this a possible source of bugs -- I'm thinking CSV, etc.
  • Isn't "split" breaking SRP, meaning, it doesn't just split, it also checks if the result is non-empty

Is there some possible explanation why they decided to do this? Mostly out of curiousity.

Non-retaining graphics engine

25 November 2011 - 05:26 PM

Hi! I'm looking for a free (and preferably also open source) graphics engine that doesn't rely on any kind of retaining data structure like a scene graph, is there an engine like that? Some other features that would be nice:
  • Targets both OpenGL and Direct3D
  • Mac, Windows, Linux. iOS and Android support would be nice
  • Shader support and material scripting (like the FX files in DX) + fall back handling
  • Image loading supporting png, jpg, ...
  • Model loading, COLLADA, ...
  • Window management for the host platform
  • Text rendering, GUI?
  • Some built-in effects, lighting, ...
  • Similarly scoped as Irrlicht
  • Scriptable/data driven particle system
I'm also wondering if you can use Irrlicht in a more "immediate" mode.


Edit: maybe the thread would've been better placed in "Alternative Game Libraries"?

Experimentation and Doubt

03 April 2011 - 10:17 AM

I have this re-occurring problem when designing my projects at an intermediate level; it seems I can't make "big" decisions without a lot of doubt creeping up all the time, which is taking away time that I could've actually spent doing stuff! For example, deciding whether I should go with a third-party physics library or roll my own. Let's say I pick the physics library as an experiment; failing would just mean some wasted time and some acquired knowledge--but I still end up with all that doubt when it comes to actually doing it.
Maybe this is a case of "paralysis by analysis", but I've done the analysis, it just won't stick, heh. Analyzing doubt, on the other hand, is pretty hard I've found. I don't think it's about "failing"; it's more whether it's going to be the best solution, in present and future.
Does anyone have any ideas on how to analyze the situation better, or any tips for getting rid of the doubt? Doubt is the biggest enemy to my motivation.

Finding a Niche

09 December 2010 - 09:42 AM

I've been thinking about this lately; it seems everyone in my line of work (programming) have found their niche; may it be web developing using .NET, optimization of low-level memory management, or game development, and they don't stray from this niche. Getting a niche seems to be important and is the way to be an important person/receive high quality work proposals. It's how people identify.
I don't understand this. To me, it seems very narrow-minded. Shouldn't a developer be versatile? That's what I've strived for; to get wide knowledge. Wide, but not shallow. I think that's what I've done, too. I know quite a lot about many different areas, and I pick up new systems faster than most else. I keep a list with new things to learn and I make an effort in improving my skills in handling processes (requirements, coordinating people, etc.)
I have a history in programming, but there are too many things that I want to do! How do you pick one?

/ A mildly ambivalent poster

Intersection of two frusta

14 January 2009 - 04:26 AM

Hello! I want to optimize my light rendering by creating a snug-fit (axis aligned) bounding box around the visible part of a light's frustum, then just shade pixels inside the box. My first attempt was to simply calculate the corners of the light's frustum in world space, then transform them into normalized device coordinates using the camera's modelview and projection matrices. I then simply created the bounding box using those coordinates. The result was bad, there were false negatives, and the bounding box wasn't a perfect fit. My second attempt was to turn the light frustum corners into a list of edges which were intersected with the planes of the camera's frustum. If an edge is outside the camera's frustum, it would be discarded. The problem here was the discarding of edges; it caused false negatives. But what else than to discard them can I do? Hope I made myself clear!