Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 360 361 [362] 363 364 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 903573 times)

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5415 on: February 09, 2014, 04:52:50 am »

Yes, I did do that. But how do I import the classes in the jar? I get the red squiggly line despite having copied one of the package names and wrote "import" next to that.


edit: ... oh, I missed a semicolon.
I'm new to java, ok? >:I

edit2: java is so stupid ;_;

Quote from: Gephifyer.java
package gephifyer;
import org.gephi.*

public class Gephifyer {
   public static void main(String[] args)
   {
      
   }
}

Spoiler: package list (click to show/hide)
« Last Edit: February 09, 2014, 05:23:10 am by Skyrunner »
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

da_nang

  • Bay Watcher
  • Argonian Overlord
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5416 on: February 09, 2014, 06:05:47 am »

If you haven't done it yet, put a semi-colon after the import-line.

Remember, in Java statements end with ; while bodies end in with }. Import is a statement.
Logged
"Deliver yesterday, code today, think tomorrow."
Ceterum censeo Unionem Europaeam esse delendam.
Future supplanter of humanity.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5417 on: February 09, 2014, 06:14:17 am »

I can't understand why anyone would want to ever use Java. So far I've imported 21 separate classes for arcane reasons I would never know, and initializing things is so painful and obnoxiously verbose. -_- Basically I've been copy-pasting the demo file code, changing variable names where needed, importing missing classes, and just trying to get it working for so many hours.

If it weren't for Eclipse's version of intellisense, I would have just said screw this and given up two hours ago. Thankfully, I just need to right click the red squiggly line and click "import class from file" or something.
« Last Edit: February 09, 2014, 06:16:33 am by Skyrunner »
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5418 on: February 09, 2014, 10:53:56 am »

Personally I prefer IntelliJ to Eclipse, has more functionality and you can do more complex refactorings, most things you want to be automated can be done just by hitting Alt+Enter. But I'm a Jetbrains fanboy xD

Really, there's just a few things Java needs to introduce for it to be usable again instead of massively overtaken in programmer pleasure by newer languages like C# and even other JVM languages like Scala.

Just things like var for type-deduction, like lambdas (coming in Java 8, finally), and efficient support for a more function map-reduce or linq style of coding because working with collections in Java can be a headache of nested loops and constantly building temporary collections that's more difficult to follow than what other languages provide.

It's possible to do this kind of thing in the JVM, because Scala does it and does it pretty darn well, but Java itself just doesn't have any good support for this and the people in charge don't seem to want to make any changes to the language that would allow it to. It's almost like they have Stockholm syndrome towards the verbosity of the language.

And that's the problem really, Java isn't so much a bad language as it's refused to evolve and as a result just hasn't kept up with other languages.
« Last Edit: February 09, 2014, 11:24:02 am by MorleyDev »
Logged

Sheb

  • Bay Watcher
  • You Are An Avatar
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5419 on: February 10, 2014, 04:28:47 am »

PTW
Logged

Quote from: Paul-Henry Spaak
Europe consists only of small countries, some of which know it and some of which don’t yet.

gnome42

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5420 on: February 10, 2014, 06:33:45 pm »

I can't understand why anyone would want to ever use Java. So far I've imported 21 separate classes for arcane reasons I would never know, and initializing things is so painful and obnoxiously verbose. -_- Basically I've been copy-pasting the demo file code, changing variable names where needed, importing missing classes, and just trying to get it working for so many hours.

If it weren't for Eclipse's version of intellisense, I would have just said screw this and given up two hours ago. Thankfully, I just need to right click the red squiggly line and click "import class from file" or something.

Preface:  I am an old school C code monkey.

Depends on the application. 
Java is very well suited to certain areas where portableness far outstrips other considerations.
Web based apps/other things that need to easily run on 14 different OSs/os versions come to mind.

JAVA was to design to be very portable at the expense of doing anything efficiently.

You can release the same jar to multiple platforms and not worry about anything beyond the version of the JVM. 

For anything that requires serious robustness, you should run, not walk, away from JAVA. 
What you should run to depends on the application at hand.
Harcore math based simulations?  Fortran is a viable candidate.
Hardcore realtime work?  C.
massive DB based work?  Depends on the platform/requirements.  Anymore it is all SQL of some sort.  It is just how you get there in the host language that differs.  ( lightweight requirements can go through anything.  Hardcore stuff tends to get coded up in SQL as a trigger/RPC ).

Never marry yourself to one language and expect it to work for everything.

Just because it is possible to write a brand new shiny app in Befunge does not mean you should.


gome

Logged

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5421 on: February 11, 2014, 02:38:37 am »

Oh, how wonderful.

Code: [Select]
void Update()
{
    Vector3 rotation = transform.eulerRotation;
    transform.eulerRotation = rotation;
}

Sometimes causes objects to flip out crazy in Unity if they are rotated to certain angles.
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5422 on: February 11, 2014, 05:03:47 am »

I'm finding that I really like Python for things that have no relevance to speed (GUIs, orto surprisingly, making calls to a vector graphics library*), rapid scripts that just need to work (reading in tab-delimited files and outputting json), or prototyping stuff. 'S pretty awesome. The biggest downside is portability. I haven't figured out how to make cx_freeze also package required external modules with the executable, and the programmatically-challenged people I wish to show my program to rarely have even the Python interpeter, let alone some obscure non-standard module...

Speaking of portability,  how do you run an executable jar created by Eclipse, one that has required external jars inside of the created executable jar? java <jar name>, java <class name>, and java <package name>. <class name > all fail.

* Graphics libraries are usually C code wrapped in Python, and the C code is usually a call to hardware... The bottleneck is always disk IO rather than processing time o.o
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5423 on: February 11, 2014, 06:08:56 am »

Speaking of portability,  how do you run an executable jar created by Eclipse, one that has required external jars inside of the created executable jar? java <jar name>, java <class name>, and java <package name>. <class name > all fail.

This functionality is not actually available in the Java command line. There are four ways you can resolve this: Either you use a tool such as OneJar to do that for you (caution, slow), or you write a custom classloader that does the entire thing manually (caution, also slow), or you simply merge your jars at the top level to create a single jar containing all the class files, or you just skip the all-in-one-file approach and load the jar files externally. Here's how to run jars with Java:
Code: (Single jars) [Select]
java -cp a.jar your.main.Class

Code: (Multiple jars) [Select]
java -cp a.jar:b.jar your.main.Class
java -cp a.jar;b.jar your.main.Class
For multiple jars, the classpath delimiter is dependent on OS: Semicolon for Windows systems, colon for Unix.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5424 on: February 11, 2014, 07:17:25 am »

java -jar filename.jar seems to have done the trick, actually. xD

edit: Reason is, I'm using Eclipse to "export as executable JAR", which as far as I know packages a classloader that does exactly what you said.

Now, it's time for me to try marrying pycairo and pygtk @_@
« Last Edit: February 11, 2014, 07:53:55 am by Skyrunner »
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Anvilfolk

  • Bay Watcher
  • Love! <3
    • View Profile
    • Portuguese blacksmithing forum!
Re: if self.isCoder(): post() #Programming Thread
« Reply #5425 on: February 11, 2014, 10:20:01 am »

You can tell the jar what it should execute when you call java -jar <filename>. Google META-INF, I think that's where it goes. I was using that at some point :\

Eclipse probably does it for you though!

Also are you calling Python from Java or vice-versa, or just working on different projects?

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5426 on: February 13, 2014, 06:29:02 am »

Two languages, with bash to rule them all.


In another note, is anyone competent/familiar with pygtk/gtk/any GUI framework? I am making a GUI'd app and scrolling the drawn region is so slow that I need advice @_@
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MrWillsauce

  • Bay Watcher
  • Has an ass that won't quit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5427 on: February 13, 2014, 10:24:58 am »

I'm rewriting the Gamma World mutant generator, which I originally made in C++, in Python. This is so much easier.
Logged

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5428 on: February 13, 2014, 10:30:01 am »

Duck typing simplifies a lot of things, yes.
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

ECrownofFire

  • Bay Watcher
  • Resident Dragoness
    • View Profile
    • ECrownofFire
Re: if self.isCoder(): post() #Programming Thread
« Reply #5429 on: February 13, 2014, 03:43:59 pm »

Duck typing simplifies a lot of things, yes.
C++ has duck typing too with templates :P
Logged
Pages: 1 ... 360 361 [362] 363 364 ... 796