Author Topic: Programming Questions | Repositories  (Read 2322 times)

Offline kitamesume

  • Member
  • Posts: 7223
  • Death is pleasure, Living is torment.
Programming Questions | Repositories
« on: March 17, 2012, 04:25:32 PM »
[reserved]

Question: my USB-to-Serial's commport changes every time i re-plug it, and its pissing me off to edit the script every time, how can i make it automatically connect to the commport by itself?
Answer: N/A (pending for an answer)

Question: i'm searching for a free OS, distributable as well, mainly for VB6 programming and/or executing the program itself, what OS would you recommend and where can i get it? possibly an easy to manipulate OS and least problematic at that.
Answer: N/A (pending for an answer)

Quote
resources:
http://msdn.microsoft.com/en-us/vstudio/ms788232
« Last Edit: March 20, 2012, 12:13:04 PM by kitamesume »

Haruhi Dance | EMO | OLD SETs | ^ I know how u feel | Click sig to Enlarge

Offline kitamesume

  • Member
  • Posts: 7223
  • Death is pleasure, Living is torment.
Re: Visual Basic 6 Questions | Repositories
« Reply #1 on: March 17, 2012, 04:28:30 PM »
i'm having troubles with usb-to-serial on VB6, what i usually do is that:
Quote
install the drivers that come with it; reboot pc; plug in the USB cable (doesn't have to be connected to device on other end); go to Control Panel, "Ports" to confirm it's now enabled in Windows and to see which Comm port it is now - mine was Comm 2. Finally, go to the VB code and edit it to find Comm 2. In my case, the code was originally, "MSComm1.CommPort = 1" I simply had to change it to "MSComm1.CommPort = 2".

now the troublesome part is that when ever i replug the usb-to-serial adapter the CommPort changes ._. , and i have to make it automatically adjust to define MSComm1.CommPort by itself, so how would i do that o.o.
something like:
MSComm1.CommPort = variable1
where as how should i define variable1 to self trace the usb-to-serial adapter...
« Last Edit: March 17, 2012, 04:30:45 PM by kitamesume »

Haruhi Dance | EMO | OLD SETs | ^ I know how u feel | Click sig to Enlarge

Offline rkruger

  • Member
  • Posts: 124
  • #include <bakabt.h>
Re: Visual Basic 6 Questions | Repositories
« Reply #2 on: March 18, 2012, 09:16:08 AM »
My knowledge of the Win32 API is limited, but isn't it possible to make a function to simply search for the serial port?
Just make a for loop and probe all ports from 1 to X and see which one does NOT give errors, then assign that one to your variable.

Offline kitamesume

  • Member
  • Posts: 7223
  • Death is pleasure, Living is torment.
Re: Visual Basic 6 Questions | Repositories
« Reply #3 on: March 18, 2012, 11:37:21 AM »
i think i've heard of that before... can't recall where and how to do it =/

Haruhi Dance | EMO | OLD SETs | ^ I know how u feel | Click sig to Enlarge

Offline rkruger

  • Member
  • Posts: 124
  • #include <bakabt.h>
Re: Visual Basic 6 Questions | Repositories
« Reply #4 on: March 18, 2012, 01:07:12 PM »
can't recall where and how to do it =/
If you can stand the pain, you can start by searching and reading through the entire archaic Win32 API reference on Microsoft's MSDN pages.
http://msdn.microsoft.com/en-us/vstudio/ms788232

Ganbatte kudasai!

Offline kitamesume

  • Member
  • Posts: 7223
  • Death is pleasure, Living is torment.
Re: Visual Basic 6 Questions | Repositories
« Reply #5 on: March 19, 2012, 08:51:36 AM »
i think i found something else, mind if anyone can evaluate it?
from : http://www.codeproject.com/Articles/32330/A-Useful-WMI-Tool-How-To-Find-USB-to-Serial-Adapto
Code: [Select]
//Below is code pasted from WMICodeCreator
try
{
    ManagementObjectSearcher searcher =
        new ManagementObjectSearcher("root\\WMI",
        "SELECT * FROM MSSerial_PortName");

    foreach (ManagementObject queryObj in searcher.Get())
    {
        Console.WriteLine("-----------------------------------");
        Console.WriteLine("MSSerial_PortName instance");
        Console.WriteLine("-----------------------------------");
        Console.WriteLine("InstanceName: {0}", queryObj["InstanceName"]);

        Console.WriteLine("-----------------------------------");
        Console.WriteLine("MSSerial_PortName instance");
        Console.WriteLine("-----------------------------------");
        Console.WriteLine("PortName: {0}", queryObj["PortName"]);

        //If the serial port's instance name contains USB
        //it must be a USB to serial device
        if (queryObj["InstanceName"].ToString().Contains("USB"))
        {
            Console.WriteLine(queryObj["PortName"] + "
is a USB to SERIAL adapter/converter");
        }
    }
}
catch (ManagementException e)
{
    MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}

where as "PortName" is the variable where commport is assigned right?
though this is a C# code, i wonder if theres an equivalent code for VB6.

--------------------------------------------------------------------------------------------------

also a different question, i'm searching for a free OS mainly for VB6 programming and/or executing the program itself.
the problem is that, the system the OS is meant to be installed to is sold to customers in bundled with the program (don't ask what it is, too long to explain) so buying a legal copy of windows is expensive and will cut my profit a lot...
thinking of linux might work so i'm asking if theres any legit site for downloading a legal copy of linux. also which flavor of linux would be the easiest to manipulate and the least problematic at that(noob proof to be precise).
« Last Edit: March 19, 2012, 01:42:18 PM by kitamesume »

Haruhi Dance | EMO | OLD SETs | ^ I know how u feel | Click sig to Enlarge

Offline Bob2004

  • Member
  • Posts: 2562
Re: Visual Basic 6 Questions | Repositories
« Reply #6 on: March 19, 2012, 03:36:54 PM »
i think i found something else, mind if anyone can evaluate it?
from : http://www.codeproject.com/Articles/32330/A-Useful-WMI-Tool-How-To-Find-USB-to-Serial-Adapto
Code: [Select]
//Below is code pasted from WMICodeCreator
try
{
    ManagementObjectSearcher searcher =
        new ManagementObjectSearcher("root\\WMI",
        "SELECT * FROM MSSerial_PortName");

    foreach (ManagementObject queryObj in searcher.Get())
    {
        Console.WriteLine("-----------------------------------");
        Console.WriteLine("MSSerial_PortName instance");
        Console.WriteLine("-----------------------------------");
        Console.WriteLine("InstanceName: {0}", queryObj["InstanceName"]);

        Console.WriteLine("-----------------------------------");
        Console.WriteLine("MSSerial_PortName instance");
        Console.WriteLine("-----------------------------------");
        Console.WriteLine("PortName: {0}", queryObj["PortName"]);

        //If the serial port's instance name contains USB
        //it must be a USB to serial device
        if (queryObj["InstanceName"].ToString().Contains("USB"))
        {
            Console.WriteLine(queryObj["PortName"] + "
is a USB to SERIAL adapter/converter");
        }
    }
}
catch (ManagementException e)
{
    MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}

where as "PortName" is the variable where commport is assigned right?
though this is a C# code, i wonder if theres an equivalent code for VB6.

Well, that seems to use the WMI (Windows Management Instrumentation), parts of which are available in VB6 - I don't know about the specific functions used there, but you should look up the documentation on how to use WMI in VB6, and see if you can find any details on the functions used in that code, or their equivalents. If you can find functions to do the same thing, then you might well be able to make it work using the same structure as that code.

Quote
also a different question, i'm searching for a free OS mainly for VB6 programming and/or executing the program itself.
the problem is that, the system the OS is meant to be installed to is sold to customers in bundled with the program (don't ask what it is, too long to explain) so buying a legal copy of windows is expensive and will cut my profit a lot...
thinking of linux might work so i'm asking if theres any legit site for downloading a legal copy of linux. also which flavor of linux would be the easiest to manipulate and the least problematic at that(noob proof to be precise).

Visual Basic 6 was designed with Windows 98 in mind, and hasn't been used by 99.99% of programmers for years - it does not run on Linux, full stop. There have been a few attempts to port VB6 I think, so it might be worth checking some of them out, but I don't believe any of them have ever reached the point where they're actually suitable for use. And some would probably be so old now that they might not work on modern Linux distributions anyway.

There is a Linux port of the .NET runtime, called Mono, which can run C# and VB.NET programs in Linux, OSX, iOS, and Android - but it does not support VB6, at all. VB6 barely runs in Windows 7 as it is, let alone Linux.

So yeah, it's Windows, or switch to a language that isn't quite so ancient. I'm not sure how easy it is to port VB6 code into VB.NET, and you'd have to do a fair bit of fiddling around with it to get it to work, but if you want to use any OS other than Windows, that's your best bet.

Offline Freedom Kira

  • Member
  • Posts: 4324
  • Rawr™.
Re: Visual Basic 6 Questions | Repositories
« Reply #7 on: March 19, 2012, 03:45:15 PM »
where as "PortName" is the variable where commport is assigned right?
though this is a C# code, i wonder if theres an equivalent code for VB6.

You can probably write an equivalent, but it'd be a pain because of all the code that probably goes into the ManagementObjectSea rcher object that is hidden from you.

VB6 doesn't have any exception try/catch handling afaik, so your equivalent wouldn't be entirely equivalent. Everything else, sans the searcher thing mentioned above, should be rewritable.

Also, what Bob said. If this is for a school project, start complaining to your school about using VB6. If it's for work, start complaining to your boss about using VB6. And if it's neither, you have made a terrible choice for a language. There are plenty of scripting languages out there that are better to learn - Perl, Python, PHP, Ruby, to name a couple.

Offline kitamesume

  • Member
  • Posts: 7223
  • Death is pleasure, Living is torment.
Re: Visual Basic 6 Questions | Repositories
« Reply #8 on: March 19, 2012, 04:11:15 PM »
so if what you guys suggesting is that VB6 is nearly obsolete if not entirely, then which language should i switch to that runs flawlessly on linux? C# maybe?
though thats a fresh start from scratch if its not familar to me, i got too used to VB6.

also, as i've asked before, which flavor of linux would you guys prefer as a programming station? the easier the os can be managed the better and least problematic at that. theres just too many flavors to choose from and its been more than a decade since i last saw a linux system.

i might just end up renaming this whole thread to "programming questions | repositories" hahaha.

Haruhi Dance | EMO | OLD SETs | ^ I know how u feel | Click sig to Enlarge

Offline Bob2004

  • Member
  • Posts: 2562
Re: Visual Basic 6 Questions | Repositories
« Reply #9 on: March 19, 2012, 04:27:47 PM »
The final release of VB6 was early 1998. It was made obsolete in 2005. Extended support ended early 2008. So yeah, it is just a little out of date :P

I made a couple of suggestions for similar languages in my last post which will also run on Linux. VB.NET is very similar to VB6, and C# is also similar (and significantly better). You'll want to program them on windows, with Visual Studio, but porting your application to Linux is possible. For easier portability, you could also try Java - it will run on most desktop OSes without any porting needed at all, and there are good IDEs available for Linux and Windows, too. It's less similar to VB than the other two, and honestly I prefer C#, but it's all a matter of opinion.

You can probably write an equivalent, but it'd be a pain because of all the code that probably goes into the ManagementObjectSea rcher object that is hidden from you.

Actually, the ManagementObject stuff is all part of WMI, so it is quite possible that there will be equivalent functions which can be used in VB6. I think you have to do a bit of configuring to load WMI into your project, but after that it gives you access to a lot of stuff, including COM ports (though the stuff available for Windows 98, and therefore VB6, is more limited). The structure should be broadly similar across all languages it supports, so if that feature is supported in windows 98, then it would probably be implemented in a similar manner.

You'd have to find the documentation for the WMI VB6 plugin, I suppose.

Offline rkruger

  • Member
  • Posts: 124
  • #include <bakabt.h>
Re: Visual Basic 6 Questions | Repositories
« Reply #10 on: March 19, 2012, 04:29:37 PM »
so if what you guys suggesting is that VB6 is nearly obsolete if not entirely, then which language should i switch to that runs flawlessly on linux? C# maybe?
though thats a fresh start from scratch if its not familar to me, i got too used to VB6.
I would definitely choose Python. Easy to learn, and runs on both Linux and Windows flawlessly anyway.
C# is very Microsoft-centric, don't expect it to be easy to setup on Linux.

also, as i've asked before, which flavor of linux would you guys prefer as a programming station? the easier the os can be managed the better and least problematic at that. theres just too many flavors to choose from and its been more than a decade since i last saw a linux system.
You can choose almost whatever you want since most Linux distributions ships with developer tools. (Or they can be easily installed afterwards.)
Ubuntu is a good starting distribution, but I am a little unsure if it fits the role as a "programming station" well. I am afraid that all the graphical augmentation (like touch based interfaces) would just get in the way. Maybe the server edition of Ubuntu is a better choice, or possible Debian, which it's based on.

Offline Bob2004

  • Member
  • Posts: 2562
Re: Visual Basic 6 Questions | Repositories
« Reply #11 on: March 19, 2012, 05:43:06 PM »
Server edition of Ubuntu is just command-line, it doesn't come with any graphical stuff at all. You could install a desktop, but it would be a pain. I used to do Java programming in Ubuntu, and it worked fine, I haven't used it since before this new Unity desktop thing came out, but it shouldn't have changed too much.

Honestly though - and people are going to flame me for this, I'm sure - I much prefer programming in Windows. If I'm using something like C#, Visual Studio is great, and Netbeans in Windows is brilliant for working in Java. It might just be because it's what I'm used to using, but I never found it as easy to get things going in Linux. Too many things to manually configure, too many things to go wrong. You don't have to write a program in Linux to be able to make it run on Linux, so just use whatever OS you prefer.

Re. C# being MS-centric: It is, and I personally wouldn't want to program with it in Linux, since Visual Studio makes things very easy. But the Mono runtimes for Linux are fine, so it's easy to just program it all in Windows, get that working, then do the testing, debugging, and tweaking needed to get the application to run well in Linux afterwards, using the Mono Migration Analyser (a tool for detecting problems when porting to Linux) and MonoDevelop. I've never actually used MonoDevelop myself, but it is a full-fledged IDE, so it could easily be used to develop C# applications entirely in Linux to begin with. I don't know how good it is, of course, but it has a good feature-set, and looks pretty comprehensive

Offline rkruger

  • Member
  • Posts: 124
  • #include <bakabt.h>
Re: Visual Basic 6 Questions | Repositories
« Reply #12 on: March 19, 2012, 06:06:58 PM »
Server edition of Ubuntu is just command-line, it doesn't come with any graphical stuff at all. You could install a desktop, but it would be a pain. I used to do Java programming in Ubuntu, and it worked fine, I haven't used it since before this new Unity desktop thing came out, but it shouldn't have changed too much.
Ok, I haven't used the server edition for many years, so I didn't remember if it had a GUI or not.

Honestly though - and people are going to flame me for this, I'm sure - I much prefer programming in Windows. If I'm using something like C#, Visual Studio is great, and Netbeans in Windows is brilliant for working in Java. It might just be because it's what I'm used to using, but I never found it as easy to get things going in Linux. Too many things to manually configure, too many things to go wrong. You don't have to write a program in Linux to be able to make it run on Linux, so just use whatever OS you prefer.
As you said, it's a matter of preference, but also a question of using the right tool for the job. If you are writing a Windows GUI application, then Visual Studio with C# would be an obvious choice, but for scripting something? That I'm not so sure of.
I find developing in Linux to be very easy, it's after all an OS made by programmers for programmers, unlike Windows. But yeah, that's my preference.

Offline Bob2004

  • Member
  • Posts: 2562
Re: Visual Basic 6 Questions | Repositories
« Reply #13 on: March 19, 2012, 06:49:48 PM »
As you said, it's a matter of preference, but also a question of using the right tool for the job. If you are writing a Windows GUI application, then Visual Studio with C# would be an obvious choice, but for scripting something? That I'm not so sure of.

True, I was mainly thinking of a good programming language, that works, and that is very similar to what he already knows. It all depends on the type and scale of the project, of course, but it's much easier to learn something very similar to VB than it is to learn something totally different like Python. And from what I've heard, Mono is actually an exceptionally good runtime environment; there certainly seem to be a lot of people using it.

It's all a matter of opinion, really. You could make a convincing argument for why pretty much any language is or isn't suitable. The best thing to do is just to experiment.

Offline kitamesume

  • Member
  • Posts: 7223
  • Death is pleasure, Living is torment.
Re: Visual Basic 6 Questions | Repositories
« Reply #14 on: March 20, 2012, 06:17:31 AM »
the only problem with windows is that it'll require me a copy for each unit i'd distribute, that'll cost alot... and its not funny at all.

then C# is my best bet, i guess. how about linux mint? lol.

Haruhi Dance | EMO | OLD SETs | ^ I know how u feel | Click sig to Enlarge

Offline Bob2004

  • Member
  • Posts: 2562
Re: Visual Basic 6 Questions | Repositories
« Reply #15 on: March 20, 2012, 10:11:21 AM »
the only problem with windows is that it'll require me a copy for each unit i'd distribute, that'll cost alot... and its not funny at all.

then C# is my best bet, i guess. how about linux mint? lol.

If you're not going to be using it on Windows at all, then yeah, I guess developing directly on Linux would be better. Linux Mint isn't designed for programming, so it might not have all the development tools you want installed at first, but it should work fine. For C# you'll need to use Mono, and MonoDevelop.

But if you're comfortable working in C#, check out Java too. It's a very similar language, but is much better at cross-platform support (and is generally more popular too, I believe). I prefer C#, but I've only ever used it in Visual Studio, in Windows, so I've no idea how easy it is to work with in Linux - Java performs pretty much the same in every OS. You can do the development in Windows too, and it will work fine in Linux without any porting. Both are good languages; use whichever you prefer, is my advice.

Offline kitamesume

  • Member
  • Posts: 7223
  • Death is pleasure, Living is torment.
Re: Visual Basic 6 Questions | Repositories
« Reply #16 on: March 20, 2012, 11:36:07 AM »
if mint isn't so programming techy oriented then which would be better? all thats left is ubuntu...
i'll check java out.
might check android as well, since its getting popular and all.

well, bah i'm gonna break the rules a bit.

i'm with an R&D team thats assigned to i/o platform development, and i've been assigned to make the projects cheaper without cutting quality, improving it even.
first, the projects is some sort of i/o platform that controls various objects like lets say, a robotic arm.
though we're only one part of a bigger business, no its not a corporation, so to make it short, we're making pre-programmed i/o platform themselves, and a PC is cheaper than micro-controller based i/o when the project gets too big where one micro-controller isn't enough to run it.

right now we're using:
[micro-controller platform]
custom made buttons (20-50$)
parallax HYDRA Development Kit (170$)
some 15.6" monitor (80$)

[PC platform]
windows xp home ed - oem (that we get to buy at bulk for like 50$ each.)
atom D525MW based platform for 250$ (and it can be back-mounted, sweet.)
some 15.6" monitor (80$)



the first solution i've found is ditching windows OS to cut like 50$ of cost. also if the replacement OS isn't so stingy with drive space we could further cut cost via removing the HDD and replace it with a USB stick, then run it in raid-1 with a ramdrive to reduce wear&tear hahaha.
another solution is going for a cheaper PC which tends to not have a serial port, and add a usb-to-serial, or just communicate via usb all together.
and then since you guys said shifting from VB6 to another gives me an edge, then i got to convince my captain to switch to that... damn.

unbelievable isn't it?
« Last Edit: March 20, 2012, 11:38:49 AM by kitamesume »

Haruhi Dance | EMO | OLD SETs | ^ I know how u feel | Click sig to Enlarge

Offline Freedom Kira

  • Member
  • Posts: 4324
  • Rawr™.
Re: Visual Basic 6 Questions | Repositories
« Reply #17 on: March 20, 2012, 12:01:59 PM »
The main difference between C# and VB is that the former is a coding language, while the latter is a scripting language. They operate very differently when they are run. The syntax is probably somewhat similar, which I believe is what Bob was trying to say.

I have looked at VB.NET script before, and if its appearance is any indication of how VB looks, I'd have to disagree on the similarities in syntax. Someone coming from a VB background would have just as much trouble switching to C# as something like Java (after all, C# is often regarded as Java in disguise).

If you really wanna have fun, learn C. It's one of the most powerful languages out there because of the things you can do with it that higher level languages, even those based on C, don't allow. Just be prepared for weeks of banging your head against the wall. =D

Anyway, it's hard to find a suitable recommendation based on your VB knowledge, so I would just scrap it all and start learning a language that is far more useful. I wouldn't say VB has a whole lot in common with any commonly used language today.

Java is one of the main languages used in programs today, mostly because of its portability. You can run Java on anything. Eclipse is also among the best IDEs available, with tons of plugin support and cross-platform compatibility. It's definitely one of the best languages to learn, but not quite the easiest, because of the damn verbose syntax. Java's main drawback, aside from the verboseness, is the requirement of the Java Virtual Machine (JVM) and Java Runtime Environment (JRE) in order to run anything Java, and the just-in-time compiling method it uses that drops performance a bit. The JRE and JVM will install themselves when you install Eclipse, though.

Ruby is also an excellent scripting language to learn. It's beautifully made and is designed to take whatever you throw at it. Your best bet is to use Linux for it, though. Eclipse has a plugin for Ruby called Aptana, which can also be installed separately. It is, however, heavily resource-intensive, and is one of the worst performing scripting languages out there. It's the price you pay for one of the easiest languages to use.

On C# - as mentioned already, it is a Microsoft language. It's basically what Microsoft created in order to compete with Oracle's Java, and the two operate fairly similarly. If you have experience programming in one, you will be able to pick up the other much faster than usual. I haven't seen enough of VB code to really say if you would have a hard time changing to C#. I would, however, start with Java first, and move on to C# when you're comfortable with it. Java, after all, has far more support, whereas C# is largely limited. The main use of C# is backend server code on .NET applications.

C++ is another option for you. Another Microsoft product, but this one has more Linux support than C#. The code you produce in C++ is generally very efficient, but it draws very heavily from its parent language C. C++ simplifies a lot of things though, and has some elements of OO programming, but it is not as heavily OO-oriented as pure OO languages like Ruby and semi-OO languages like Java and C#. C++ is a good stepping stone if you have any intention of learning C but have come from a more OO/scripting background.

I personally have not yet learned Python or Perl, but I have intentions to learn them. Both are excellent languages, but Perl depends heavily on Regex, and is therefore not as friendly to the newbie programmer. I have heard good things about Python and its learning curve, not just from rkruger. Keep in mind though that Python is also a scripting language, so its performance leaves much to be desired. On the other hand, since you come from a scripting background, running Python should be a snap.

Anyway, those are just a few things to think about on the language you choose. If you don't want to think about it, then Java is probably your best choice. If you're going with Ubuntu or Mint, just run the software center and install Eclipse, which requires a download of approximately the size of a CD.  Eclipse will handle all of the background management most of the time, so you should be able to create something and run it without having to do anything else (except maybe selecting your workspace, which is your default save location for all of your projects). It's pretty much the same on Windows. If you're using some other Linux distro, you'll probably have to install Eclipse from the command line, but it should come with a GUI regardless.

Android programming is a mix of Java and XML. It doesn't use its own language. In fact, most mobile devices support Java, and development for mobile devices is almost always done in Java. If you want to code for Android, make sure you're very familiar with Java first. Knowledge of XML is also useful, but Eclipse has some XML tools that should prove helpful if you're not very comfortable with it. There's an Android SDK and plugin available for Eclipse as well, but the Android Virtual Devices are a bit of a pain at first to set up.

Offline Bob2004

  • Member
  • Posts: 2562
Re: Programming Questions | Repositories
« Reply #18 on: March 20, 2012, 02:27:48 PM »
The main difference between C# and VB is that the former is a coding language, while the latter is a scripting language. They operate very differently when they are run. The syntax is probably somewhat similar, which I believe is what Bob was trying to say.

Yeah, they're similar in terms of straightforward syntax and object-orientation. They also both rely heavily on Microsofts .NET library, so a lot of functions are very similar. I'm not entirely sure I agree with you on VB.NET being a scripting language though; it seems to be designed more to be a combination of scripting/programming. VBA is the scripting equivalent (it's what scripts for Excel etc are written in), whereas the VB.NET is more commonly used for creating applications. It could be argued that it's better for scripting than programming though; I haven't used it much, so I can't really say.

Quote
I have looked at VB.NET script before, and if its appearance is any indication of how VB looks, I'd have to disagree on the similarities in syntax. Someone coming from a VB background would have just as much trouble switching to C# as something like Java (after all, C# is often regarded as Java in disguise).

Yeah, I wouldn't necessarily say C# is easier than Java either. Coming from VB.NET it probably would be, due to the similar libraries, but in terms of syntax and the way it works, it is very, very similar to Java.

Quote
If you really wanna have fun, learn C. It's one of the most powerful languages out there because of the things you can do with it that higher level languages, even those based on C, don't allow. Just be prepared for weeks of banging your head against the wall. =D

I wouldn't recommend C myself, unless you really need the fastest performance you can possibly eke out of it. And since you've been using VB6 up to now, that clearly isn't the case :P

Quote
Java is one of the main languages used in programs today, mostly because of its portability. You can run Java on anything. Eclipse is also among the best IDEs available, with tons of plugin support and cross-platform compatibility. It's definitely one of the best languages to learn, but not quite the easiest, because of the damn verbose syntax. Java's main drawback, aside from the verboseness, is the requirement of the Java Virtual Machine (JVM) and Java Runtime Environment (JRE) in order to run anything Java, and the just-in-time compiling method it uses that drops performance a bit. The JRE and JVM will install themselves when you install Eclipse, though.

Personally, the syntax is one of the things I like about Java. Sure, it might take a little bit longer to type, but it's a hell of a lot easier to read than the mess of abbreviations and symbols you get with C/C++. Agreed on the benefits/drawbacks though. the JVM means it has a lot of really cool features, but it does come at a cost. The performance hit for most things isn't quite as bad as a lot of people make out though, and it is possible, in very specific circumstances, to get Java code to run quicker than the native C/C++ equivalent. That's not common though.

Quote
Ruby is also an excellent scripting language to learn. It's beautifully made and is designed to take whatever you throw at it. Your best bet is to use Linux for it, though. Eclipse has a plugin for Ruby called Aptana, which can also be installed separately. It is, however, heavily resource-intensive, and is one of the worst performing scripting languages out there. It's the price you pay for one of the easiest languages to use.

Never used Ruby, so I can't really comment on how good it is. Definitely an option to consider though.

Quote
On C# - as mentioned already, it is a Microsoft language. It's basically what Microsoft created in order to compete with Oracle's Java, and the two operate fairly similarly. If you have experience programming in one, you will be able to pick up the other much faster than usual. I haven't seen enough of VB code to really say if you would have a hard time changing to C#. I would, however, start with Java first, and move on to C# when you're comfortable with it. Java, after all, has far more support, whereas C# is largely limited. The main use of C# is backend server code on .NET applications.

This is true; in terms of compatibility and widespread support, Java blows C# out of the water. But, the Mono runtimes are very good, and it is more than feasible to use C# (and indeed VB.NET) for projects that aren't intended to run on Windows. It's a viable platform for Linux, Mac, and Android development. Java is also a viable platform for all these operating systems, of course, and is more widely supported in environments outside Windows (largely because it works exactly the same in almost all operating systems).

Quote
C++ is another option for you. Another Microsoft product, but this one has more Linux support than C#. The code you produce in C++ is generally very efficient, but it draws very heavily from its parent language C. C++ simplifies a lot of things though, and has some elements of OO programming, but it is not as heavily OO-oriented as pure OO languages like Ruby and semi-OO languages like Java and C#. C++ is a good stepping stone if you have any intention of learning C but have come from a more OO/scripting background.

I'd avoid C++ too, for the same reasons as I'd avoid C. Horrible syntax, poor OO support (compared to Java/C#), and very platform specific. It is generally more efficient than both of those, it's true, but only if you're able to write code in it well, which is a lot harder than with C#/Java. Not to mention you have to deal with pointers etc too, and there's significantly less in terms of pre-included functions and libraries to use.

Quote
I personally have not yet learned Python or Perl, but I have intentions to learn them. Both are excellent languages, but Perl depends heavily on Regex, and is therefore not as friendly to the newbie programmer. I have heard good things about Python and its learning curve, not just from rkruger. Keep in mind though that Python is also a scripting language, so its performance leaves much to be desired. On the other hand, since you come from a scripting background, running Python should be a snap.

Same comment here as for Ruby. But Python and VB are totally different; they have almost nothing in common, in my limited experience with Python. Though I've heard many good things about it, so it might be worth looking into all the same.

Quote
Anyway, those are just a few things to think about on the language you choose. If you don't want to think about it, then Java is probably your best choice. If you're going with Ubuntu or Mint, just run the software center and install Eclipse, which requires a download of approximately the size of a CD.  Eclipse will handle all of the background management most of the time, so you should be able to create something and run it without having to do anything else (except maybe selecting your workspace, which is your default save location for all of your projects). It's pretty much the same on Windows. If you're using some other Linux distro, you'll probably have to install Eclipse from the command line, but it should come with a GUI regardless.

Agreed that Java is the simplest to get going with. Also agreed that Ubuntu or Mint are probably the best Linux distros to use for a Linux beginner to program in (though you can always just use windows if you're using Java). Personally I can't stand Eclipse though - it's slow, hugely bloated, and fairly unreliable. It's been a couple of years since I tried it, but it was fairly buggy. And it completely overwrote the JDK I had installed with its own custom libraries which broke everything else I had set up >:(

Netbeans is the "official" Java IDE, it's a bit more lightweight than Eclipse, and tends to be more stable (in my experience). But both are very popular IDEs, and both have their good and bad points, so my advice is to look at both and see which you like the look of most.

Quote
Android programming is a mix of Java and XML. It doesn't use its own language. In fact, most mobile devices support Java, and development for mobile devices is almost always done in Java. If you want to code for Android, make sure you're very familiar with Java first. Knowledge of XML is also useful, but Eclipse has some XML tools that should prove helpful if you're not very comfortable with it. There's an Android SDK and plugin available for Eclipse as well, but the Android Virtual Devices are a bit of a pain at first to set up.

Android programming uses Java, but from my limited experience with it, the way programs are organised is totally different. In fact, the way the entire OS works is totally different, not just because you're dealing with touchscreens but because of the way applications get paused when they're in the background, shut down at random to save memory, etc. There's a bit of a learning curve even if you have experience with Java. It looks quite interesting though, so if Android is a viable OS for your device, it could be worth checking out. Linux would probably be better though.

Mono also has a runtime and compiler for Android, so you can program for it in C#. No idea how well that works though, or how well it's supported. Probably not worth the effort tbh.

Offline asermax

  • Member
  • Posts: 101
  • Better chew than be chewed
Re: Programming Questions | Repositories
« Reply #19 on: March 20, 2012, 02:58:39 PM »
One comment on Java: given the problem in hand for which he's looking for a new language, i wouldn't recommend using it, since there's not an official library or something remotelly functional to work with USB ports (at least that i know about, i could be wrong).

I would recommend Python; although it may take some more time to learn and adapt to it than other languages given it's sintax and some other pecualiarities, most C and C++ libraries have Python bindings, making a lot of things a lot easier than in other languages.

In regard of the Linux issue, any Debian flavour would work fine (even Debian Base), it's only a matter of installing the packages you need.
« Last Edit: March 20, 2012, 06:56:30 PM by asermax »