DSPRelated.com
Forums

OT: Nomad programmer needs tools

Started by Rune Allnor July 6, 2006
"Rune Allnor" <allnor@tele.ntnu.no> wrote in message 
news:1152185703.381435.283130@m73g2000cwd.googlegroups.com...
> Hi all. > > The last few weeks have revealed that I need to learn a > programming > language that fits a nomad lifestyle. By "nomad" I mean > > - The code needs to be portable to most/all relevant OS/HW > platforms > (Windows, Mac, Linux)
Java is probably the most portable "serious" programming language that meets all your other requirements, but Java is, so far as I can determine, highly under-represented in the embedded world, where a lot of DSP is done. Another consideration is that if you are trying to squeeze the last drop of performance out of some critical code, your direct access to native machine language (JNI) is "circuitous" at best and mostly painful.
> - Compiling the programs ought to be possible without > major amounts > of $$$ spent on compilers
If you want to do Java, get the Netbeans 5.0 IDE. It comes bundled with the latest JDK from Sun, it's a serious development environment, it runs equally well on Linux and Windows, and it's free. http://java.sun.com/j2se/1.5.0/download-netbeans.html
> - The programming language needs to be able to handle > complex data > structures and objects > - The programming language should be clearly defined as a > *language*, > not a shell script, that could be confused for an OS > add-on by > owners of computer systems > - The programming language ought to be able to handle COM > objects > to manipulate excel files and word documents
You might consider the latest versions (Version 2.3+, or 2.4+) of Python. The IDE is still clunky, but the language is highly under-rated (it *rocks*). It can be installed on a Microsoft web server as a COM object and used to write highly sophisticated server-side web pages.
> - The programming language needs to be easy to learn for > me, who is > familiar with C++ > > The one language that springs to mind is Java. Are there > others?
I taught myself C# in about two weeks to a level of proficiency where I could use it to write services for Windows 2003 server. But, C# is a Microsoft-only proposition, so far as I know, it isn't cheap, it isn't fast, and I already had a lot of experience developing Java and C++ under various IDE's.
> Does anybody have suggestions for first-read books or > other literature > for C++ programmers to learn Java?
Start with http://java.sun.com/ There's a lot of material available online. For example http://java.sun.com/docs/books/tutorial/index.html The books that I consult most are: (1) Geary, David M., Graphic Java Mastering the AWT 2nd Ed. ISBN 0-13-863077-1 (2) Niemeyer, Patrick and Peck, Joshua, Exploring Java 2nd Ed. ISBN 1-56592-271-9 (3) Gosling, James, Arnold, Ken, and Holmes, David, The Java Programming Language Third Edition ISBN 0-201-70433-1 (A Fourth Edition is available)
> > Rune >
John E. Hadstate wrote:
> "Rune Allnor" <allnor@tele.ntnu.no> wrote in message > news:1152185703.381435.283130@m73g2000cwd.googlegroups.com... > > Hi all. > > > > The last few weeks have revealed that I need to learn a > > programming > > language that fits a nomad lifestyle. By "nomad" I mean > > > > - The code needs to be portable to most/all relevant OS/HW > > platforms > > (Windows, Mac, Linux) > > Java is probably the most portable "serious" programming > language that meets all your other requirements, but Java > is, so far as I can determine, highly under-represented in > the embedded world, where a lot of DSP is done. Another > consideration is that if you are trying to squeeze the last > drop of performance out of some critical code, your direct > access to native machine language (JNI) is "circuitous" at > best and mostly painful.
Run-time performance is not a consideration here. It's a matter of getting any performance at all, the alternative is to do things manually.
> > - Compiling the programs ought to be possible without > > major amounts > > of $$$ spent on compilers > > If you want to do Java, get the Netbeans 5.0 IDE. It comes > bundled with the latest JDK from Sun, it's a serious > development environment, it runs equally well on Linux and > Windows, and it's free.
Brilliant. It's a bit too big to download right now (~150 MB), but I'll definately have a look at this.
> http://java.sun.com/j2se/1.5.0/download-netbeans.html > > > - The programming language needs to be able to handle > > complex data > > structures and objects > > - The programming language should be clearly defined as a > > *language*, > > not a shell script, that could be confused for an OS > > add-on by > > owners of computer systems > > - The programming language ought to be able to handle COM > > objects > > to manipulate excel files and word documents > > You might consider the latest versions (Version 2.3+, or > 2.4+) of Python. The IDE is still clunky, but the language > is highly under-rated (it *rocks*). It can be installed on > a Microsoft web server as a COM object and used to write > highly sophisticated server-side web pages.
Web servers is not something I am very concerned about right now.
> > - The programming language needs to be easy to learn for > > me, who is > > familiar with C++ > > > > The one language that springs to mind is Java. Are there > > others? > > I taught myself C# in about two weeks to a level of > proficiency where I could use it to write services for > Windows 2003 server. But, C# is a Microsoft-only > proposition, so far as I know, it isn't cheap, it isn't > fast, and I already had a lot of experience developing Java > and C++ under various IDE's.
Three good reasons to stay away from C#, then...
> > Does anybody have suggestions for first-read books or > > other literature > > for C++ programmers to learn Java? > > Start with http://java.sun.com/ There's a lot of material > available online. For example > http://java.sun.com/docs/books/tutorial/index.html > > The books that I consult most are: > > (1) Geary, David M., > Graphic Java Mastering the AWT 2nd Ed. > ISBN 0-13-863077-1 > > (2) Niemeyer, Patrick and Peck, Joshua, > Exploring Java 2nd Ed. > ISBN 1-56592-271-9 > > (3) Gosling, James, Arnold, Ken, and Holmes, David, > The Java Programming Language Third Edition > ISBN 0-201-70433-1 (A Fourth Edition is available)
Thanks. I'll have a look at these. Rune
Andrew Reilly wrote:
> Hi Rune, > > On Thu, 06 Jul 2006 10:09:52 -0700, Rune Allnor wrote: > > Jack Klein wrote: > >> On 6 Jul 2006 04:35:04 -0700, "Rune Allnor" <allnor@tele.ntnu.no> > >> wrote in comp.dsp: > >> > >> > Hi all. > >> > > >> > The last few weeks have revealed that I need to learn a programming > >> > language that fits a nomad lifestyle. By "nomad" I mean > >> > > >> > - The code needs to be portable to most/all relevant OS/HW platforms > >> > (Windows, Mac, Linux) > >> > - Compiling the programs ought to be possible without major amounts > >> > of $$$ spent on compilers > >> > - The programming language needs to be able to handle complex data > >> > structures and objects > >> > - The programming language should be clearly defined as a *language*, > >> > not a shell script, that could be confused for an OS add-on by > >> > owners of computer systems > >> > - The programming language ought to be able to handle COM objects > >> > to manipulate excel files and word documents > >> > >> What Excel files and Word documents on Linux, Solaris, UNIX? For that > >> matter, what COM objects on these platforms? > > > > Ah, sorry. > > > > Right now I need to work with Excel and MSWord on the PC. But I want to > > > > use a portable language. I'm too old and jaded to learn more > > programming > > languages than absolutely necessary. > > Now I see your original post, I can perhaps equivocate a little about my > previous statement: > > The first and last conditions might come close to being incompatible, COM > being a strictly Microsoft thing. Most people using a lot of COM seem to > prefer Visual C++ or Visual Basic, neither of which fit the portability > constraint. A spot of googling has found this project page: > http://sourceforge.net/projects/jacob-project/ which claims to be a > java-com bridge, which naturally only runs on Windows platforms, as it > uses JNI to do the COM access stuff.
Thanks.
> The other place to look might be the OpenOffice.org development web site > and source code: OOo is both cross-platform and knows how to play with COM > data in Excel and Word documents, and I believe that the COM import/export > facilities are written in Java (although I could easily be wrong about > that: I haven't looked.) I don't know how reasonable it would be to > extract the necessary classes to use in your own projects; there could be > too many dependancies on the rest of the OOo infrastructure to make that > worthwhile.
I use C++/Qt or matlab for my own stuff. This thread was started because I see a need to bring tools I am familiar with, that are portable between platforms as well as can handle COM objects when needed, when I work on other people's systems. It's not an option to install my own matlab lisence and C++ compilers, and I don't want to intrude on/mess up the host system more than absolutely necessary. I believe it is easier to get permission to install the Java development kit on a host system, than mess around with OpenOffice, cygwin and what not.
> Regarding Java books: I picked up "Just Java2, 6th ed" by Peter van der > Linden because it appeared to cover the useful stuff and because it was > there on the local bookshop shelf. It's a reasonable book, but I found > that I didn't actually use it much. Instead I wrapped my brain > around the standard library class set by just starting coding, with the > class documentation open in a browser on my desktop. The language itself > is so simple that it doesn't needs much study to figure it out. The > standard class library is big, though. There are a lot of good tutorials > on the web too, although some are getting a bit out of date now, with > respect to the current versions of the language and GUI libraries.
Again, I'm of that generation (I was born before man first set foot on the moon...) who tend to prefer books. Online stuff is OK when you want to find out the order or format of the arguments to some function. For reading, I prefer text on paper.
> Other relatively popular, free, cross-platform GUI programming > environments include C++ (gcc) with wxWindows, Python + wxWindows and > Python + tk. (For DSP work, you probably also want the Python Numeric > package, or numpy, or SciPy or whatever it is now, or something like > Atlas+FFTW under C++.) The main trouble with all of these, IMO, is that > it takes quite a bit of effort to put all of the pieces together from > their different respective sources, and they have incompatible version > upgrades often enough that maintaining a stable platform over a long > period of time can be painful. I did a little control GUI in Python + > wxWindows about a year ago, and while it was fun to write, it was hard to > deploy on other people's Windows machines (I'd done the development on Mac > OS X and FreeBSD), and when I came back to it a year later I discovered > that the then-current versions of Python (and more significantly > wxWindows) had changed so much that my code didn't work any more. That > experience pushed me towards Java...
Ease of use and a minimal system mess-up-factor is essential here. I am not at all interested in starting pieceing lots of tiny fragments together.
> Java isn't perfect either, by any stretch of the imagination, but I think > that it's the least broken option available at the moment. With the most > recent Sun JVMs performance on numerical code is, IMO, reasonable to > excellent, and my coding productivity is significantly higher than under > C++, thanks largely to the wealth of abstract data structure libraries and > the convenience of using them that garbage collection offers.
Thanks. Rune
On Thu, 06 Jul 2006 20:16:09 -0700, Rune Allnor wrote:
> Again, I'm of that generation (I was born before man first set foot on > the > moon...) who tend to prefer books. Online stuff is OK when you want to > find out the order or format of the arguments to some function. For > reading, > I prefer text on paper.
I'm not as young as all that: I remember hearing the moon landing on the radio, myself. In this particular case, though, the issue is/was just that the on-line class API documentation is well structured and heavily hyperlinked, and I found that invaluable. Because of the hierarchial nature of class inheritance, you don't really want to be repeating documentation for base class methods and members in the description of each derived class, but when you're learning the system, you do need to easily get to those definitions quickly. Clicking on a "supplied by base class" link, or using the multi-frame indexes walks all over any paper reference manual, IMO. Unlike a tutorial, there's no linear narative that could meaningfully be imposed on the reference. Sure, for tutorials, paper could be the way to go. I got more out of "Just Java2", faster, than I did from the collection of tutorials on the web, and it was all up-to-date. I found, though, that it didn't take the book/tutorial long to get me into the "Java mind-set", at which point I found the API reference more useful. I think that happened by the time I was about a third of the way through the book. Cheers, -- Andrew
"Rune Allnor" <allnor@tele.ntnu.no> writes:

> Martin Blume wrote: > > (I personally dislike Excel very much) and > > word documents. > > So do I. But dealing with excel and MSWord is part of the job. > If I can do what I want in C++/java/something else, and then > export the end product to excel -- as opposed to work > solely with excel as I do now -- I'll be a lot happier. >
Python has some good PDF libraries, which may obviate the need to do Word (if all you need to do is create reports). I;ve used them to convert Gerber PCB data to PDF for example... Numerical stuff, I tend to create CSV files with python and then use Excel for presentation if required. I do this by linking to the CSV file, that way I don't have to drive Excel direct from python, but I can use it to present data in ways people are familiar with. Cheers, Martin -- martin.j.thompson@trw.com TRW Conekt - Consultancy in Engineering, Knowledge and Technology http://www.trw.com/conekt
"Rune Allnor" <allnor@tele.ntnu.no> wrote in message 
news:1152240715.726782.175440@m73g2000cwd.googlegroups.com...
> > John E. Hadstate wrote: >> "Rune Allnor" <allnor@tele.ntnu.no> wrote in message >> news:1152185703.381435.283130@m73g2000cwd.googlegroups.com...
>> > - The programming language ought to be able to handle >> > COM >> > objects >> > to manipulate excel files and word documents >> >> You might consider the latest versions (Version 2.3+, or >> 2.4+) of Python. The IDE is still clunky, but the >> language >> is highly under-rated (it *rocks*). It can be installed >> on >> a Microsoft web server as a COM object and used to write >> highly sophisticated server-side web pages. > > Web servers is not something I am very concerned about > right now. >
What I was trying to point out is that Python 2.3 or later does both sides of COM. That's probably what I should have said. By the way, I've never done COM through Java. I'm pretty sure that Java's equivalent, RMI, is not compatible with COM. Microsoft may support access to COM through J++/J# but neither of those enjoys the advantages of Java.
Rune Allnor wrote:
> I use C++/Qt or matlab for my own stuff. This thread was started > because > I see a need to bring tools I am familiar with, that are portable > between > platforms as well as can handle COM objects when needed, when I work > on other people's systems. It's not an option to install my own matlab > lisence and C++ compilers, and I don't want to intrude on/mess up the > host system more than absolutely necessary. I believe it is easier to > get > permission to install the Java development kit on a host system, than > mess around with OpenOffice, cygwin and what not. >
Hey Rune, Have you considered the possibility of using one of the "Live" Linux CD's? Basically, the PC boots from the CD, runs Linux, and leaves the hard drive alone (although it /can/ read and write it if you ask it to). Knoppix is the most popular of these distributions, and it comes with gcc. I dunno if it comes with Qt or not, but if it doesn't, I'm SURE there is a variant out there that does. Damn Small Linux is another possibility, and it lets you install pacakges to a hard drive (or USB drive), and then create a new ISO image you can burn to CD including all the goodies you've added. Knoppix coupled with a USB flash drive to store your work will get you a portable system that won't disturb anyone's installation (it will require a reboot though). That probably does preclude the use of Matlab, but you can probably find (or make) a CD with Scilab. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Hope springs occasionally.
"John E. Hadstate" schrieb
> > I taught myself C# in about two weeks to a level of > proficiency where I could use it to write services for > Windows 2003 server. But, C# is a Microsoft-only > proposition, so far as I know, it isn't cheap, it isn't > fast, and I already had a lot of experience developing Java > and C++ under various IDE's. > >
AFAIK, C# was invented by Microsoft, but is now entered as a international standard (ECMA?) and there exists also a Linux C# compiler. Together with MONO, a .NET implementation of the MS .NET framework on Linux, this might achieve some platform independence (at least between MS Windows and Linux, but apparently also others). For more information, have a look at www.mono-project.com. But for applications, where most of the work is done parsing more or less well-defined ASCII text input and then doing only a little (< 5 min) computation, I prefer Perl, Python or AWK. Regards Martin