lua curses example using luaposix - lua

As I understood curses are integrated into the luaposix project.
Since I am using a OpenWRT which is very limited linux environment,and it runs ash for shell, I would like to develop some curses text-based menus, or better to say a textbased user interface that runs on OpenWRT.
I have found that luaposix 35.1.1 is available as an opkg (already compiled) for the OpenWRT device.
The OpenWRT system does run LUA v5.1.5.
My questions is where can I found a curses example that utilizes luaposix for making a simple text based menu?
I have googled and found nothing to start with.
In order to learn and code the curses finding a relevant tutorial or a guide is really handy.
Please note I do not want to use other libraries, or solutions other than luaposix.

As I understood curses are integrated into the luaposix project.
lcurses is not integrated into luaposix anymore:
For a while, luaposix contained support for curses functionality too, but now it has its own lcurses repository again, where it is being maintained separately.
- https://github.com/luaposix/luaposix
An example is given on the documentation site.

Related

Create interactive GTK interface through Lua

I'm building an application heavily reliant on plugins. These are coded in Lua for easier and faster development.
I now want to add GTK user interfaces for the plugin's configurations. The problem right now is that I need a way to interact with the interface through external code (signals and callbacks basically). And I'm not sure how to implement that behaviour with only an external Lua script.
Is my approach correct or should I instead implement a native solution in my framework for UI?
If you are on linux or BSD, Lua is a perfectly valid choice for GTK. Just take a look to the lua-lgi project. Once installed, you can start building an UI in a matter of seconds:
lgi = require'lgi'
Gtk = lgi.require'Gtk'
dialog = Gtk.MessageDialog { text = 'This is a text message.', buttons = 'CLOSE' }
dialog:show_all()
Gtk.main()
The greatest feature of lgi is that it works for every GObject based library, e.g. cairo, goffice, gnome-db and many more.
If you are on Windows you are out of luck. I have built a working installer but it is more a proof-of-concept than a real project. The road to that has been really tough, expecially because gobject-introspection (widely used by lgi) is not cross-platform friendly yet.
I have no experience on other OS.

Running R within an iOS application

I'm trying to figure out if this is doable
I know there's a way to run Python or Lua scripts within iOS. Also, I know there are already projects that make this easy to do with libraries and bridging components.
The question is - has this also been done for the R language? I've been looking around online but have only seen posts by people that have done this on a jailbroken environment. Also according to my understanding this does not go against the iOS developer license agreement as section 3.3.2 has been altered to allow running any code that's bundled along with the application binary.
Any suggestions? Directions to try?
https://itunes.apple.com/us/app/r-programming-language/id540809637?mt=8
Also you can run windows applications on iOS:
http://www.technobuffalo.com/2013/10/17/microsoft-app-turns-your-ios-device-into-a-windows-8-1-device/
http://www.net-security.org/secworld.php?id=12872
However, I have not tried these personally.

Clojure iOS Development

Over the past months, I've pretty much fallen in love with Clojure and refuse to use anything else.
I am aware that there is ClojureScript, which uses Google Closure to compile a subset of Clojure to JavaScript.
Is there anything similar in the works for Objective-C/Cocoa?
I would love to be able to prototype applications in Clojure, and then get an iOS app out of it.
[I'm perfectly fine if this prevents me from all the low level details of iOS -- I don't need access to any low level details (say pointer arithmetic) that I can't do in Java -- I just want to be able to easily transform my Clojure Apps onto the iOS]
You can run clojure on iOS by compiling clojure to scheme, https://github.com/takeoutweight/clojure-scheme
There's one more option (warning: haven't tried it yet):
https://github.com/oakes/lein-fruit
This Leiningen plugin translates Java bytecode to native code for iOS. And there's even IDE that has it built-in:
https://github.com/oakes/Nightcode
I've just discovered las3r which is a Clojure port to the ActionScript (the language behind Flash) runtime. Since Flash/ActionScript can now develop for iOS (I'm in the process of writing a game right now. It's not wonderful, but it's quite usable), this may present a path to writing Clojure applications for iOS.
DISCLAIMER: I haven't tried this. I've just barely discovered las3r, haven't even downloaded it. and have no idea if it's good or terrible. I don't know how awful the speed will be. I know nothing.
Still - it's an intriguing idea, isn't it?
There is Re-Natal a simple command-line utility that automates most of the process of setting up a React Native app running on ClojureScript.

Starting Lua, what to use?

I'm trying to learn Lua, but I don't really know which binary to download. There's 2 choices:
Lua Binaries
Lua for Windows
The second option Lua for Windows seems to be the recommended option, but the installer weighs in at 26.6Mb, which is pretty hefty for what is supposed to be a v.lightweight language.
I'm thinking of using Lua as a scripting language for games, and perhaps as a fast development language for file processing like how Python or Ruby does it. So it must be something lightweight, not a 26.6Mb file.
Which is the appropriate one to download and start?
Luaforwindows, no doubt. It's simpler, easier and faster.
The installer comes with lots of stuff (Scite editor & several extra libs if I remember well). But the installer asks you before installing all those extra stuff. Just install the minimum and you will be fine.
Lua for Windows includes a handful of other, useful libraries and tools. The actual Lua executable included is still tiny, in the 1-2MB range as expected.
Having the extras there already will only make things easier, and disk space is cheap: go with Lua for Windows.
You may also want to check ZeroBrane Studio, which is only 4M download on Windows and is based on the same editor as SciTE that comes with Lua for Windows. ZBS also comes with 50+ Lua examples and few simple lessons to get started quickly with Lua programming.
Quoting from here.
Installation
The LuaBinaries files are intended for advanced users and programmers who want to incorporate Lua in their applications or distributions and would like to keep compatibility with LuaBinaries, so they also will be compatible with many other modules available on the Internet.
If what you want is a full Lua installation, please check other projects such as the Lua for Windows and LuaRocks.
Seems quite clear to me that you should download Lua for Windows.

Building cross-platform Delphi applications

I downloaded Lazarus, but have worked with Embarcadero Delphi IDE too. I have a question about building cross-platform Delphi applications.
How can I build them under win32 environment? I read the wiki from Lazarus site, that explains how to do it, but I still do not understand it. Is is possible to build and compile application under win32 environment for Linux and MacOS? If it is possible, can someone explain ste-by-step how to do it exactly.
EDIT:
Now is the time for talking about the new XE2 version of the Delphi IDE I think :)
Thanks
What you're asking for already exists in the lazarus wiki site, you need to read these articles.
Multiplatform Programming Guide
Cross compiling
Cross compiling for Win32 under Linux
How to Write Portable Code (nice doc from Marco van de Voort)
Buildfaq
While crosscompiling to a non windows target is possible (and not that hard), getting used to fpc/lazarus and crosscompiling in one first step is a bridge too far. This because Linux is not a very homogenous target and dealing with this variation requires some understanding how libraries and linking works on Linux. This defeats one-button downloadable cross-compile setups to "general" linux. I know, such one-button thingies that work out of the box for everyone would be great, but it is just not going to happen (or only forvery limited distribution-version combinations)
Crosscompiling with FPC is not extremely difficult or rocket science, but the amount of jargon and details can flabbergast uninitiated people, and without background knowledge it is hard to diagnose problems as a result of minor misconfigurations
I recommend to first familiarize yourself with Lazarus/FPC, and only then make the crosscompilation leap. (and the already mentioned buildfaq names some reasons).
Bottomline: install lazarus on Windows and start porting your app. If that succeeds, start using a linux install (or VM) to familiarize yourself with Linux, and Lazarus under it. You'll need a linux install anyway to test.
Only then start thinking about crosscompiling to speed up the process.
CodeTyphon is a powerful Lazarus/FPC one click easy installation package for cross platform native development. It already supports 4 CPU/OS hosts (Win32, Win64, Linux32, Linux64), and 16 CPU/OS targets (arm-Wince, arm-Linux, arm-Embedded, arm-gba, arm-nds, i386-Win32, i386-Linux, i386-FreeBSD, i386-Haiku, x86_64-Win64, x86_64-Linux, x86_64-FreeBSD, powerpc-Linux, powerpc64-Linux, sparc-Linux, sparc-Solaris). More are supported in Lazarus/FreePascal, but others are not yet integrated in CodeTyphon. Did I mention that it is free? One code to rule them all ;-)
The point is that you don't have to waste days for setting up your cross platform environment, since someone has already done the hard work for you.

Resources