Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

2014-11-13

Level Up - Java: What is Vararg?

I like to remember vararg as "variable-length arguments". You may see them parameterized as "foo(Object... objects)" or "foo(int... ints)" or maybe "main(String... args)". The triple-dot signifies the vararg, and the method that has them uses it as an array.

Example code:

/** Returns input as a comma-separated list. If input if null
  * or empty, then this returns an empty string. */
public static String convertToString(Object... objects) {
    if (objects == null || objects.length == 0) { return ""; }
    StringBuilder sb = new StringBuilder();
    for (Object object : objects) {
        sb.append(object.toString()).append(", ");
    }
   return sb.substring(0, sb.length() - 2).

2013-11-09

Danial Versus Games

Whenever I get the sudden thought to play a game, I think how much more satisfying it will be to just create a game instead. Or at least create another app.

--
Random story that I remember:

I first got into computer programming in high school by editing the source code of a popular MMORPG (Runescape) in order to make it better. The language was Java, but at that time I just knew it as code. And, with no prior coding experience I could understand and walk through much of source code without looking up what different words meant. I just thought that was cool, it felt great how everything just clicked together. But, it actually wasn't until a few years later as a sophomore in college that I actually decided to get into computer engineering and take my first real logic and programming class (basically, the school said I choose a specific degree to work towards. I just wanted to learn everything).
--

Coding has the elements that playing games offer:

  • There are highs and lows
  • There are easy parts and hard parts
  • You can save and resume at any time. Or even start over

And coding has even more great elements only available in some games:

  • Levels are always evolving
  • They can be single player/coder or multiplayer/coder
  • As you work on more parts, you "level up"
  • Instead of spending money, you make money ;)


~ Simply Advanced ~

ps - I like how originally this was just going to be a 1-2 sentence post.. ;]



2013-01-23

App to Clipboard Multiple Items

I may have mentioned this before, but just now I thought of a good way to do this on a desktop computer. If there is anybody else who would like to save multiple items to their clipboard, then please email me or contact me via Google Plus.

I believe this can help me while programming, and I'm sure there are other uses for it too.

The first version would just have the ability to copy different text to multiple clipboards, then future versions would have the ability to save anything.

~ Simply Advanced ~



2012-06-20

Procrastinating Productivity - It's a Good Thing

It seems the more I feel unproductive, the more I want become productive.

I was just thinking of this because two days ago I played some awesome volleyball for six hours straight. It was great relaxation and social time. And right afterwards I was motivated for some all night Android coding. The entire all-nighter was productive.

It was definitely worth it to take that half-day break.

This is not the only case of having pure productivity, it happens all the time. But, there are certain conditions necessary first. Mainly, having a clear goal/plan-of-attack. Spending 5-10 minutes to create a definite list saves you from unproductive time.
And, my personal condition for productivity is having a clear/clean workspace where I can easily concentrate on only one thing at a time. (I know a few people who can work in messy areas, so whatever works.. make it so)

Someone who has read enough about productivity that any more would be unproductive,
~ Simply Advanced ~