Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!

H. Mungus

+ Follow
since Aug 30, 2018
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by H. Mungus

It sounds like Kotlin has already figured out a better way for me to do things than traditional scripts :-) Thanks for the suggestion. I'll have to look into that!

By the way, Peter, thank you for ALL your help in my various questions this week! Much appreciated!

Vielen Dank!
1 year ago
I didn't really have a specific use case in mind when I asked the question. It just struck me that if a script is useful on one device, I might want to use it on another and that device could be a laptop, a tablet or a phone. Or maybe a bunch of devices, as in the case of, say, a regular download of files. Or let's say I had sales databases on a variety of phones where each person recorded their own sales and a script ran daily to upload the days sales from each salesperson to a central database where everyone could see it and reports spanning the whole sales force could be run.
1 year ago
I'm not following you. Do you mean I have to install IDEA on any device that needs to run a Kotlin script? Or that I don't need to install ANYTHING on the other device and the script will run just fine on the target machine from the development machine? The former seems to require a biggish IDE to be installed but that latter seems more like magic than anything. I was expecting to install some kind of (hopefully small) runtime environment on whatever machine runs the script.
1 year ago
I followed a similar tutorial with the same steps and did all the steps but the Kotlin code ran incorrectly as I described.

So Stack Overflow is the best place to ask this sort of question? That's useful to know. I searched the Eclipse forum but didn't find much of use beyond an implication that *maybe* the plugin didn't work really well in Eclipse 2018-09.

I've used Eclipse for years so I'm more comfortable there than any other IDE.  But if Kotlin isn't working in Eclipse right at the moment, that's not a huge problem. I've been using Android Studio for my mobile development and IDEA is very similar to Android Studio so it's not daunting to use. Or at least not so far when I'm just writing code :-) I still have some learning curve with respect to Gradle and other tools.
1 year ago
That sounds simple enough :-)

But where can I run it? Or to put it another way, if I write a Kotlin script in, say, IDEA, that I want to run on my phone or another laptop, what has to be installed on that phone or laptop for the script to run correctly?
1 year ago
Thank you both for your thoughtful and informative answers!

I especially appreciate you clearing up my mistaken assumption that Kotlin was getting turned into Java by a preprocessor. (I should point out that this was just a guess on my part, not a regurgitation of something I'd seen elsewhere. I simply hadn't seen ANYTHING on how Kotlin gets turned into executable code and made a (bad) assumption.)

It's very interesting that the developers are working toward making it interoperable with several other languages. That's really why I asked the questions I did. From the handful of days I've spent with it and some seminars I've seen via a local Meetup group, I could see some real potential to possibly make some kind of "super-language" that might ultimately help bring the number of languages down to a useful several - or just a few - that could do practically anything you might want. I'm a bit overwhelmed by the plethora of languages these days and all the complications it causes to have so many.

As for the things Kotlin does and doesn't do - and does differently from Java - that too is very useful. I need to go get familiar with that material now that I know where it is :-)

Again, thank you both for your answers!
1 year ago
I just started learning Kotlin the other day via Derek Banas' tutorial on YouTube. I use IDEA, the IDE he suggests in the video, and it worked fine.

However, I mostly use Eclipse for my development work so I installed the Kotlin plugin in my copy of Eclipse to try it there and found it didn't work at all. Even HelloWorld failed miserably - and not because of my code. I'm running Eclipse 2018-09 and the latest version of the Kotlin plugin in Windows 10 Home. Even the most trivial of programs shows me a page of errors in the console, then that disappears before I can read it to display a couple of other errors, like this:

Error: Could not find or load main class sandbox.Kotlin001Kt
Caused by: java.lang.ClassNotFoundException: sandbox.Kotlin001Kt

I expect that the first page of errors would be quite helpful if I could actually get them to stay on the screen long enough to read them but I don't know how to accomplish that or how to get back to them. If anyone knows how to do this, I'd love to hear from you. I'm positive my code isn't at fault - even I can't screw up a two line HelloWorld, copied from IDEA where it worked fine! - but maybe the errors would help me figure out some kind of simple configuration problem that I could potentially fix.

As for the error I've pasted above, one thing jumps out at me: my package name, sandbox, is correct but the name of my program is not quite right; it is actually Kotlin001.Kt. For some reason, the dot is getting lost.

The *other* approach I could take is to install Eclipse 2018-12 - that's the latest version, right? - and install the Kotlin plugin in that and see if things work better. Has anyone actually done that or are things just as broken there?

Am I right in assuming that others must be seeing this problem too? What are other Kotlin developers doing about it? Or is the whole Kotlin community using IDEA while the Eclipse/plugin people are figuring this out?
1 year ago
I'm brand new to Kotlin and have just discovered that Kotlin can be used for scripts as well as in regular programs. Can anyone point me to a good tutorial on the scripting aspects of Kotlin?

I've certainly had a need to write scripts from time to time and have done so in languages like BASIC, REXX, and other more recent languages. If Kotlin can do similar things, I should probably spend a bit of time getting at least an overview on scripting in Kotlin.
1 year ago
I have literally just started actually learning how to write Kotlin in the last few days. It seems pretty straight-forward so far and I can certainly see the attraction of having a more concise way to write code. It doesn't seem to lack any of the many features of Java (but perhaps I haven't seen those yet) and adds several other nice features, like null safety.

But is that all Kotlin is trying to be? Or is there a bigger vision at play here that I just haven't come across yet? For instance, do the creators of Kotlin hope to make Kotlin work with OTHER languages as well, such as PHP or Python? Are they hoping to REPLACE Java at some point or do they plan to essentially stay a language that always gets converted to Java via a preprocessor?

Does anyone here know enough about Kotlin and its creators' goals to answer those questions?
1 year ago

Tim Moores wrote:Indeed, I think a library such as Unity would be way overkill for your purposes. In Android you could subclass an android.view.View and use a Canvas to do custom drawing (which includes putting text on the canvas if need be).

A simple example:

Thanks, Tim, I was hoping there'd be an easier way :-)

I'm also pleased that my question showed up this time! I used to post here occasionally in my Java ME days but hadn't been around in a few years. Then, when I tried a mobile post a few weeks back, I couldn't find my post after sending it, nor could I find any way to notify anyone to find out what I was doing wrong. It looks like the problem sorted itself out in the meantime.

Thanks again for your suggestion!
1 year ago
I'm thinking about porting a game that I wrote in (desktop) Java several years back to Android Java but I have a fundamental question about the graphics. This is NOT a first person shooter game or anything visually complex. In fact, it's basically Hangman with some twists. My GUI needs to show a mystery phrase broken into boxes with one letter per box. I need to be able to put special characters underneath each box to indicate if it is a vowel or special character. I want to show the letters and words which have already been guessed. I need something like buttons to indicate that the player gives up on the current phrase and wants to move on to another phrase. The player needs to be able to access settings so that they can turn on or off various features. I suppose something moderately interesting needs to happen visually to indicate a successful guess of a letter or of the whole phrase or failure to get the phrase after the maximum number of tries but that's not important to me: that could be as simple as displaying a message like "Congratulations!" or "Sorry, you lost".

Can I do all of this without having to resort to something like Unity? I started to look at Unity but found that it seemed to be geared towards much more visually complex games; I didn't see any capacity to do anything as simple as what I want to do.
1 year ago

Pete Letkeman wrote:I'm unsure if these qualify as funny,  but I think they are clever:
"We fix home made hair cuts" for a hair cutting/salon
"On time is a fluke" seen on transport truck

With respect to the second one, I suspect you may be Canadian (as I am)! There is a transport company called Fluke Transport somewhere in the Hamilton Ontario area whose trucks I've seen occasionally in Southern Ontario. Their slogan is "If it's on time, it's a Fluke". I always chuckle when I see that; it's not many companies that will have that sort of self-deprecating humour in a slogan. :-)
1 year ago