Is there a way to translate or migrate prg (foxpro) to sql language? - postgresql

I have some programs (.prg) that operate using .dbf files, as i am migrating to postgresql (personal preferences) i really would like to know if there are ways to "translate" commands from one language to another.
Translating to python would be another possibility
Thank you

There isn't. Visual FoxPro the language is fairly tightly tied into its own object model, and when you start bringing UI elements into the equation the time and work involved in automatic migration means that it's always quicker to re-implement on the new platform.
If you're interested in Python you could take a look at Dabo. This is a Python framework aimed at desktop and web apps, but developed by some long-time Visual FoxPro experts. In that respect it is conceptually similar to Visual FoxPro in a lot of ways.
Dabo's authors, Ed Leafe and Paul McNett, have strong backgrounds in
database application development using the awesome and underrated
Microsoft Visual FoxPro development environment.
While Visual FoxPro shines at developing data-centric applications, it
has one limitation that cannot be ignored: it only runs on Microsoft
Windows, and Ed and Paul both have clients that want their
applications to run on Linux and Macintosh. We are sure we are not
alone in this regard: it is a multi-platform world with more diverse
needs than one vendor can fulfill.
Ed and Paul got to talking one day: Paul had been researching various
multiplatform GUI toolkits for about 18 months, and Ed has lots of
experience developing the Visual FoxPro Codebook framework. We decided
to work together to make a framework for developing robust
data-centric applications for multi-platform deployment. We've come up
with a design that is simple, flexible, and robust, and we've begun
developing our own client applications using the Dabo framework.

Related

Script hosting in .Net 4.5

We were using IronRuby in our applications for some simple scripting of biz logic and rules.
We are trying to upgrade everything to .NET 4.5 - and our ScriptRuntime/IronRuby code is not happy with that. It does not lok like IronRuby has had a lot of traction lately, so we are wondering what would be a good scripting engine to switch to that is best supported by a .NET 4.5 environment. We prefer simple - the less third-party stuff we have to bring in the better. OUr scripts are also simple - not a big effort to convert.
Suggestions?
If converting your scripts to C# isn't a problem, I would recommend looking into the Microsoft "Roslyn" CTP and its Scripting API.
Because the .NET compiler developers are currently rebuilding their compilers in the Roslyn architecture and the Visual Studio team intends to consume the Roslyn compilers in the future, it's a safe bet that support for this scenario will remain for quite some time.
If you're not looking to consume the Roslyn architecture, you could also leverage Windows PowerShell by writing a custom host application that can execute PowerShell scripts that contain your business logic.

Is there a cross-platform framework for C?

I am curious to know if there is any kind of programming library/framework for the C language for cross-platform programming of course. I mean there are already frameworks like Wxwidgets, Boost, Qt, U++ and etc for C++ available but I have not yet found any for C .
Updated Info:
We are trying to build an underlying Framework/library to be used in our project. We are going to eliminate the dotnet and instead provide a counterpart for those libraries which is fast and less demanding.
We will be working on a server/client based project, and thus the underlying services must be fast and also portable. GUI is not our priority now, but libraries providing threading capabilities is of importance to us.
And for the ANSI part, I think we are fine with that at the moment unless something changes that in the future.
if you write plain ANSI C, it should work on every POSIX system.
The most successful example of cross platform C library is standard C library itself (IMHO).
If you're looking for GUI toolkit GTK is the answer,
if you're looking for terminal UI, ncurses is pretty portable.
If you're looking for general use libraries, as long as they're written in ANSI C, should work almost everywhere, as long as it doesn't use system level APIs.
Can you just tell us, what kind of library/framework you are looking for ?
GTK+ is long established and actively maintained cross-platform C-only (or primarily) toolkit. You'll find not only on-line documentation but also books written about it. It is the framework backing up the GNOME project.
GTK+ is meant to build applications with UI, first of all. However, even if you don't need UI you'll find that some GTK+ components, namely GLib, provide general multiplatform support comparable with Qt. Actually, I needed a framework without UI at first and chose GLib over APR because I was able to find documentation and tutorials easier.
GTK+ was initially developed on UN*X an X-Windows which remains the platform where you can get it running the most easily. I wouldn't say that it is more difficult on Windows; it is just that you have more compiling environment options. I started with prepared GTK+ packages and MinGW but ended up integrating GTK+ with MSVC.
GTK+ exists for a long time and some people may find it old-school. On the other hand, it shows that it has proven to be stable and useful. There are also bindings for C++ and C#.
As with every big framework, the more you need from it the longer you will have to learn. But the other way round it works too; the more you learn the more you'll be able to do with it. Consistent coding style helps getting used to it.
--- Ferda

How to code sharing between Android and iOS

I'm moving away from strict Android development and wanting to create iPhone applications. My understanding is that I can code the backend of iOS applications in C/C++ and also that I can use the NDK to include C/C++ code in Android apps. My question however is how? I've googled quite a bit and I can't find any clear and concise answers.
When looking at sample code for the NDK, it seems that all the function names etc. are Android (or at least Java) specific and so I would not be able to use this C/C++ backend to develop an iPhone frontend?
I'd appreciate some clarification on this issue and if at all available some code to help me out? (even just a simple Hello World that reads a string from a C/C++ file and displays it in an iOS and Android app).
Thanks guys
Chris
Note that I almost exclusively work on "business/utility/productivity" applications; things that rely heavily on fairly standard UI elements and expect to integrate well with their platform. This answer reflects that. See Mitch Lindgren's comment to Shaggy Frog's answer for good comments for game developers, who have a completely different situation.
I believe #Shaggy Frog is incorrect here. If you have effective, tested code in C++, there is no reason not to share it between Android and iPhone, and I've worked on projects that do just that and it can be very successful. There are dangers that should be avoided, however.
Most critically, be careful of "lowest common denominator." Self-contained, algorithmic code, shares very well. Complex frameworks that manage threads, talk on the network, or otherwise interact with the OS are more challenging to do in a way that doesn't force you to break the paradigms of the platform and shoot for the LCD that works equally badly on all platforms. In particular, I recommend writing your networking code using the platform's frameworks. This often requires a "sandwich" approach where the top layer is platform-specific and the very bottom layer is platform-specific, and the middle is portable. This is a very good thing if designed carefully.
Thread management and timers should also be done using the platform's frameworks. In particular, Java uses threads heavily, while iOS typically relies on its runloop to avoid threads. When iOS does use threads, GCD is strongly preferred. Again, the solution here is to isolate the truly portable algorithms, and let platform-specific code manage how it gets called.
If you have a complex, existing framework that is heavily threaded and has a lot of network or UI code spread throughout it, then sharing it may be difficult, but my recommendation still would be to look for ways to refactor it rather than rewrite it.
As an iOS and Mac developer who works extensively with cross-platform code shared on Linux, Windows and Android, I can say that Android is by far the most annoying of the platforms to share with (Windows used to hold this distinction, but Android blew it away). Android has had the most cases where it is not wise to share code. But there are still many opportunities for code reuse and they should be pursued.
While the sentiment is sound (you are following the policy of Don't Repeat Yourself), it's only pragmatic if what you can share that code in an efficient manner. In this case, it's not really possible to have a "write once" approach to cross-platform development where the code for two platforms needs to be written in different languages (C/C++/Obj-C on iPhone, Java for Android).
You'll be better off writing two different codebases in this case (in two different languages). Word of advice: don't write your Java code like it's C++, or your C++ code like it's Java. I worked at a company a number of years ago who had a product they "ported" from Java to C++, and they didn't write the C++ code like it was C++, and it caused all sorts of problems, not to mention being hard to read.
Writing a shared code base is really practical in this situation. There is some overhead to setting up and keeping it organized, but the major benefits are these 1) reduce the amount of code by sharing common functionality 2) Sharing bug fixes to the common code base. I'm currently aware of two routes that I'm considering for a project - use the native c/c++ (gains in speed at the expense of losing garbage collection and setting targets per processor) or use monodroid/monotouch which provide c# bindings for each os's platform functionality (I'm uncertain of how mature this is.)
If I was writing a game using 3d I'd definitely use approach #1.
I posted this same answer to a similar question but I think it's relevant so...
I use BatteryTech for my platform-abstraction stuff and my project structure looks like this:
On my PC:
gamename - contains just the common code
gamename-android - holds mostly BatteryTech's android-specific code and Android config, builders point to gamename project for common code
gamename-win32 - Just for building out to Windows, uses code from gamename project
On my Mac:
gamename - contains just the common code
gamename-ios - The iPhone/iPad build, imports common code
gamename-osx - The OSX native build. imports common code.
And I use SVN to share between my PC and Mac. My only real problems are when I add classes to the common codebase in Windows and then update on the mac to pull them down from SVN. XCode doesn't have a way to automatically add them to the project without scripts, so I have to pull them in manually each time, which is a pain but isn't the end of the world.
All of this stuff comes with BatteryTech so it's easy to figure out once you get it.
Besides using C/C++ share so lib.
If to develop cross-platform apps like game, suggest use mono-based framework like Unity3D.
Else if to develop business apps which require native UI and want to share business logic code cross mobile platforms, I suggest use Lua embedded engine as client business logic center.
The client UI is still native and get best UI performance. i.e Java on Android and ObjectC on iOS etc.
The logic is shared with same Lua scripts for all platform.
So the Lua layer is similar as client services (compare to server side services).
-- Anderson Mao, 2013-03-28
Though I don't use these myself as most of the stuff I write won't port well, I would recommend using something like Appcelerator or Red Foundry to build basic applications that can then be created natively on either platform. In these cases, you're not writing objective-c or java, you use some kind of intermediary. Note that if you move outside the box they've confined you to, you'll need to write your own code closer to the metal.

Migrating to Visual Basic to perl - working with user interfaces

I've been around Visual Basic for years in high school, and I've grown up with the IDE supplied by Microsoft. It'd wonderful, but the educational and "working-model" editions of VB available to me through school don't allow me to redistribute software, as part of the EULA with Microsoft.
I instead find myself working in perl to design programs for friends and family, and it works fairly well, but I don't have a firm grasp on building user interfaces yet. I understand I could design user-interfaces with tcl/tk for perl, but the notion of coding all of that by hand is a bit daunting to me. That brings me to my question.
Do you have any suggestions for a tool I could use that would allow me to build GUIs for my perl programs?
Thanks in advance!
In addition to what tsee suggested, you can have a look at :
Perl/Qt (using Qtdesigner) and Perl::GladeXML (using Glade)
With Glade and Qtdesigner, you can generate a XML file that will describe your user interface and it will be a matter of hooking your perl code to widget's events.
I don't think you will find something as simple and well integrated for Perl as the Visual Basic GUI builder. A couple of pointers:
wxGlade can be used to design GUIs for the Wx GUI toolkit (for Perl, not only Python).
For Win32::GUI, you can use the GUI Loft to achieve something similar.
I think there's a bunch of other GUI builders including at least one for Tk, but I don't remember the name.
Either way, I believe you will have to accept that you have to do more coding vs. designing when compared to VB. The upside is that if you use Tk or Wx, your programs may well be portable to all major operating systems.
For a Perl-specific development environment, you might want to check out Padre, which is itself written in Perl using Wx. It's under active development, so eventually, somebody will probably integrate a GUI builder, too.
Frankly, having thought about GUIs for years and never getting round to them, I've found the best way to distribute GUI apps with perl is to use Catalyst, its built in server and for windows users, distributing it with Strawberry Perl (the professional edition comes with Catalyst included). For Linux or Mac users a local::lib installation to pull in the required cpan modules. Optionally bundle in a copy of portable firefox if you want not to have the usual web development pain caused by internet explorer.
tl;dr; Sidestep the whole issue by going for web development with a framework that comes with its own standalone server.

What languages can be used to make dynamic websites?

So, there are several languages which will allow you to create a website, as long as you configure the server(s) well enough.
To my knowledge, there is:
PHP
ASP.NET
Ruby(on rails, what is
that all about?)
And thusly, my knowledge is limited. Ruby and ASP, I've only heard of, never worked with. If there are other languages, I suppose they have some way to make files containing the needed html. It would then suffice to add a line to the Apache config to associate the file-extension.
And if other languages: are there any notable characteristics about the one(s) you mention?
ANY language can be use to make a dynamic website - you could do it in COBOL or FORTRAN if you were twisted enough. Back in the olden days (about 10 years ago) most dynamic websites were done with CGI scripts - all you needed was a program that could read data from standard input and write data (usually HTML) to standard output.
Most modern languages have libraries and frameworks to make it easier. As well as the languages you have already mentioned, Java, C# and Python are probably the most common in use today.
Typically a web framework will have:
a way of mapping URLs to a class or function to handle the request
a mechanism for extracting data from a request and converting it into an easy to use form
a template system to easily create HTML by filling in the blanks
an easy way to access a database, such as an ORM
mechanisms to handle caching, redirections, errors etc
You can find a comparison of popular web frameworks on wikipedia.
How can you forget Java ? :)
Python
It runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.
Python is a perfect scripting language for web applications, e.g. via mod_python for the Apache web server. With Web Server Gateway Interface a standard API has been developed to facilitate these applications. Web application frameworks or application servers like Django, Pylons, TurboGears, web2py and Zope support developers in the design and maintenance of complex applications. Around libraries like NumPy, Scipy and Matplotlib, Python is a standard in scientific computing.
Among the users of Python are YouTube and the original BitTorrent client. Large organizations that make use of Python include Google, Yahoo!, CERN, NASA,and ITA.
This could be for your interest.
Virtually thru CGI all programming languages that produce output may use for web page generation.
Basically, you can use any language (if you are hosting your own server)
Very closely related and very interesting is this article where LISP has been used to build a very succesfull website.
Python has a 3rd party module CherryPy which can be used with or without a http server.
Amongst others: Erlang (YAWS, Mochiweb), Python
JSP has the advantage that it automatically wraps your code in a servlet, compiles that to bytecodes, then uses the just-in-time Java compiler to recompile critical sections into native object code. Not aware of any alternative which allows optimizes your work automatically in this way.
Also allows you to develop and deploy on any combination of Windows, Mac OS X, or Linux.
If you'd like to choose one for the beginning, you should check out PHP first. It gives you the basic clues about how dynamic sites work in general.
After you've become familiar with the basics, I recommend ASP.NET.
Fist off, you should know that ASP.NET is a technology and not a language. (It actually supports any language that can be used on the .NET platform.) Also it is not to be confused with classic ASP. (The old ASP was much more like PHP.)
ASP.NET is very easy to begin with, and after you have some clues about its concepts, you can always dig deeper and customize everything in it. The http://asp.net site is a very good starting point, if you are to learn it. I think it is really worth the effort, because even if you choose not to stick to it, it will give you some interesting ideas and concepts.
I tell you its most important advantages:
The code is compiled (and NOT interpreted like PHP), and it has a very good performance. (In a performace comparsion, it is 10-15 times faster. http://www.misfitgeek.com/pages/Perf_Stat_0809.htm)
It can be run on Windows without effort, and on Linux / Mac / etc using the Mono project.
It implements the Separation of Concerns principle very well.
It has most of the general functionality you'll need built-in. (Such as membership, roles, database management, and so on.)