JavaFX, Flex and not default languages - silverlight

Can I write programs in JavaFx or Flex with other languages (not ActionScript and JavaFX Script) like in Silverlight?

JavaFX can call Java and thus can call any code that generates Java classes. So you could in theory write code using JRuby or Groovy.
However, I would suggest that is not really how you could should JavaFx (or Flex). Rather you are really using these languages to build great UI using technologies that should be more reliable than AJAX/browser nightmares.
And that their real power comes when you are able to integrate them with back-end data sources (via REST/SOAP) that can be written in whatever language you want.

The question would be easier to answer if we understood why you would want to do this?
For JavaFX the answer is both yes and no, depending on what it is you want to achieve. JavaFX compiles to Java classes and in theory you can call the compiled JavaFX classes from any JVM language that can call Java classes. However, this isn't as simple as it sounds because some of the stunts they are pulling to implement the JavaFX language features make the implemented classes quite complex and the name mangling is not defined and subject to change. Any solution written this way would be very fragile.
However, much of the JavaFX functionality is based on pure Java libraries such as JMC (Java Media Components) for the media support and the scenegraph project (https://scenegraph.dev.java.net/) for the 2D scenegraph. These projects are written in Java and are much easier to call from Java and other JVM based languages.
I don't have any experience of Flex but as far as I know, you are stuck with MXML and ActionScript.

For flex you can only do MXML and Actionscript although there's an option to compile C/C++ code using Alchemy

Related

Template based C / C++ code generation

Any suggestion for template base code generator for C / C++ specifically to generate repetitive code generation? (Not UML / MATLAB model based or other advanced stuff). For a newbie in this field any good generic tutorial (not tool based)?
I came across GNU Autogen looks good but looks like it needs a steep learning curve. I would prefer some plug-in for eclipse like IDE, easy to use and most importantly good tutorials.
The basic concept of code generation is simple enough - and people's needs are varied enough - that there are quite a few options out there.
Boost.Preprocessor is a library of functions built on top of the standard C / C++ preprocessor that makes it much easier to use the preprocessor to do code generation. It's not as flexible as other options, and figuring out preprocessor errors can be tricky, but the fact that it uses only standard language features greatly simplifies using it and integrating it into your builds.
If you know Python, there's Cog.
Some of Google's projects use Pump.
There are many general-purpose templating solutions (Python's Genshi, eRuby, etc.). These are often designed for generating HTML and XML but also work for code.
It's also easy enough to hack something together in the scripting language of your choice.
Without knowing more about what your needs are and what tools you're comfortable with, I can't give a more specific recommendation.
I'm not familiar with anything that provides an Eclipse plugin.
If you know Python, then Cog could be considered as light-weight solution: http://www.python.org/about/success/cog/
Look at my answer for a similar question for Java classes using M2T-JET, an eclipse based, lightweight templating generator. JET is language agnostic and you can see from the example that it's fairly easy to use.
I appreciate using Lua for this task, with something like Templet or one of another myriad of Lua-based preprocessors. The benefit of using Lua over something like Python is that you can, if necessary, include the source code to your template processor and a basic Lua installation along with whatever it is you are shipping. You may then add the compilation of Lua and subsequent template files to the build process as usual.
I would advise not using Python-based solutions for one reason: juggling various pythons to satisfy every developer's use of a completely different yet incompatible version is annoying. If you choose to use a language which you can't embed in your trees, you'll want to make sure pre-computed versions are available.
Late to the party but I would recommend Codeworker Its the only tool I found that does everything the above tools do and more. It has the Python Cog like functionality for embedded generation, it has the template based generation like Templet or Pump. And it has the rather useful feature of protected areas so you can customise your code as needed and re-generate.
I have used it for generating all the boiler plate c++ code as well as configuration for projects like SQL, config, javascript etc.

How cross-platform is Monotouch/Mono for Android development?

I am a python programmer looking to make my first mobile app. I'd like to make make an app for both iOS and Android that looks and feels native. I thought I'd start with a simple iPhone app, just to see how everyting works. Mono seems like the obvious solution. However, I was surprised to find that almost all of the example Monotouch code I found, as well as the answers here on Stackoverflow, relied heavily on the IOS frameworks, essentially making the code not cross-platform at all. For example, I was looking into using a timer. All the examples I read use NSTimer. Surely this is possible to do in C# itself so that that part is cross platform? But then, why do all these people use NSTimer?
So, my question is, how cross platform is Mono development for IOS/Android? Is it still worth considering for smallish apps, or only for very large apps with lots of business logic?
Your question is too general. I'll answer it for two scenarios:
Specific examples
If you are looking for how do create timers, create arrays, traverse lists, then why not just look for regular .NET examples and compile this into a single class library that can be in both projects.
Sharing code as a whole
If you just mean in general sharing of code between the two platforms, you should look at frameworks that already have the templates and examples created for you. Two such patterns are http://www.monocross.net/ (MVC) and mvvmcross (MVVM). This can help you architect your project from the beginning to support cross-platform development (iOS, Droid, Wp7, desktop, etc).
There are timers, arrays, and strings in the .NET Base Class Library. As you have seen, there are some in the Cocoa library that MonoTouch wraps. For example you have your regular run of the mill string in .NET, but in monotouch you also have the option of NSString. I think to answer your question, the reason people may use the iOS specific types sometimes, is either because they weren't trying to make that code cross-platform and it was a matter of preference, or they had to do something specifically that required the use of that type which wouldn't be the case for everyone.
Mono's purpose isn't just to help with cross-platform development. I come from a C#/.NET background so even if I was building an app with one screen and two buttons, I would use MonoTouch because I would rather use C# with the .NET BCL than Obj-C. But that is my own personal choice and enough of a deciding factor, for me.
EDIT
I added the links.
I think the key point is that in order to use Mono and NOT use platform specific types etc like NSSTring you need a platform specific wrapper (abstraction layer) that lets you write code that only uses Mono types.
i.e. You are asking about using Mono but what you actually need are MonoTouch and MonoDroid (the frameworks referenced by #valdetero, depend on having those wrappers underpinning them).

User Interface for C-code

I've written a code in linux OS which produces prog.out as output file.
Now I've to write GUI for the code.
what are best ways to write it?
PS - I wanted to choose between Java Swings and openGL.
Which is best for writing a simple GUI and integrating it with my C- Application
Thanks in advance
OpenGL is a rendering library, not a UI toolkit. Comparing it to Swing doesn't make sense. And you can't choose Swing for a C application, unless you'd rather do the UI in Java and interact with a C "backend".
For a pure C solution, the best choice would probably be the GTK+ toolkit.
Try Anjuta...
http://projects.gnome.org/anjuta/
If you are prepared to use another language (you mention Java) then you may find C++ and Qt to be a good fit. Linking to the existing C code will be trivial and Qt works well on a great many platforms should you ever wish to support other platforms in addition to Linux.

ruby inside silverlight functionality over c#

Having just found out that you can use Ruby or Python inside a SilverLight application..
link here
..I wonder if its possible to bypass some of the SilverLight limitations with use of these languages instead of C#.
I know that the Ruby Engine inside the SilverLight application is trimmed down, just as the .NET CLR is, so I would like to know that even without all the functionality of a full Ruby or Python Engine:
Can I still be able to do something
with the use of these dynamic
languages that I wouldn't be able to do
in C# SilverLight?
.
If we need to download something built
by the community to extend the cut
down Ruby implementation (to support
Interop calls for instance?), what's
the impact on deployment?
.
If not, if you cannot do anything
you wouldn't be able to with c#, with these engines, besides
the typical benefit of a dynamic
language, and not really circumventing
some of the restrictions of the
SilverLight's CLR, why would one
choose to use Ruby in a SilverLight
application?
One of my interest points is use of sockets, socket usage in SilverLight is improving in each version, but it can still be troublesome because of the xml authorization file required on the server side..would ruby be able to make this unnecessary?
Thanks,
Ric
I suspect you won't be able to work around that. Keep in mind that it's not the language imposing the limitations here but the runtime. TO be precise, it's Silverlight itself. Since both C# and Ruby are compiled to CIL in this case you're left with more or less the exact same capabilities (except some differences in the typing system).
I'm not sure what you're getting at. Regardless of language you are still running inside the same "sandbox", security model and limited with the same cutdown libraries in Silverlight. You can extend the bits that you feel are "limited", assuming your code doesn't violate the security model, with any language.
You might be able to do things differently using another language, but the same basic constraints still apply.
You need to make sure the files are included in the xap or use the silverlight 3 slvx system to stream the assemblies defined in C# or VB etc.
The ruby language should be a complete ruby implementation so you can use all the language features ruby offers like metaprogramming etc.
All source files need to be included in the xap to work.
If you're using ruby then you get gestalt too and you can include ruby source files in the same way as you include javascript files in an html page today.
One of the best scenario for the usage of dynamic languages in .NET is to let the users extend the application with their own code, so that's the main reason I use IronPython in my Silverlight application. It's so nice to have that available in the limited .NET runtime of Silverlight. It's really easy to integrate (although I had a hard time making C# extension methods visible to Python) and it can be very powerful for the users.

Rich GUI OS X Frameworks?

What would you recommend for OS X development of a graphical application like those possible in WPF?
My specific background is in Smalltalk & Java, but I currently work mostly in DHTML/.NET (ASP.NET/C#).
Cocoa. Considered by many to be the best application framework ever. The language is Objective-C, SmallTalk-like language that inspired the creators of Java.
Really, there is no reasonable alternative to Cocoa for OS X development, unless you have specific needs like wanting to be cross-platform.
Aside from Interface Builder which is included as part of the Xcode tools, you can also use QT, GTK+, AWT & SWING (for your Java background), Tk, Squeak (for your Smalltalk background), Shoes (very cool little Ruby GUI toolkit), FXRuby (more Ruby), wxWidgets, XULRunner, and others I'm sure I've forgotten. For the most native-like apps, however, Interface Builder is your best bet.
Cocoa is the primary framework to use on Mac OS X. It's what Apple uses, it's what most new development uses, and it's where new features are principally added.
If you're coming from WPF, I think you might find quite a few of the concepts in Cocoa familiar. (Despite the fact that Cocoa is just a bit older.) It's built entirely around MVC, there are property-change notifications and bindings, there's animation support, there's a persistence and object-graph management framework, and so on.
(Also, you might want to add "mac" to the tags.)
With your Java background, don't get sidetracked by the now deprecated Cocoa-Java bridge. Early in OS X history, Apple provided a (laboriously hand-maintained) Java interface for the Cocoa libraries. Because of the semantic differences between Java and Objective-C, many of the most powerful features of Cocoa, including Key-value binding (upon which many other features are built) is very difficult, leading to divergence of Objetive-C and Java capabilities and the eventual deprecation of the bridge. All Cocoa development is best done with Objective-C or one of the many (automatically generated) bridges to dynamic languages such as Python or Ruby.
With your background in smalltalk, I would expect you could pick up Objective-C in a day or two.
I'm not sure what WPF is, but most development for the OSX platform is done in Objective-C with Cocoa. You can use the deprecated Carbon APIs with other languages like Java, but new applications for OSX really should be developed in Objective-C. You can start with Apple's guide with Xcode as your IDE.
To put it a different way than previous posters: if you are not designing your interface in InterfaceBuilder and manipulating it with Objective-C, then you are going to end up with an application that does not look, feel, act, or work the way a Macintosh application should, and it will stick out like a sore thumb to users. It will be an unpleasant experience for the user compared to other apps, and they will likely desire a different application because of it.
Toolkits like QT are acceptable if your application already uses QT and you want to port it fast, but if you're writing a new application (or a separate GUI) then write it in Cocoa using ObjC or ObjC++.
You might have a look at PyObjc which is a bridge between the Python programming language and Objective-C, including bindings for Mac OS X components, including Cocoa.
With a Smalltalk background, I'd recommend straight Cocoa and Objective-C. However, if you're leaning towards a dynamic language, RubyCocoa will let you use Ruby which I think you'll find easier to pick up than Python.

Resources