Sample GUI - wxWidgest erlang - user-interface

I'm not sure this is the forum but i'm searching for a sample code to download and start with which creates a basic GUI with elementary buttons in erlang.
Sorry again for getting out of scope, please redirect me to the right section/webs if you know any.

It is not the right place to ask this kind of question. The forum is meant to solve coding problem, not to get general information.
Nevertheless, using vxErlang is not always easy. I recommend you to use the wxWidgets documentation, of course it is not applicable directly to wxErlang, but it really helps a lot.
You can also consider to use wxFormbuilder. It is a freeware that can generates xrc files from a wysiwyg interface. The file can then be used by wxErlang and produces very good results. It seems that the project is not really active now, but the current version is pretty complete and stable.
There is a good xrc example in the wxErlang library showing most of the features available.

wxErlang might be what you need.
Other lecture (and google should provide even more):
wxErlang - Getting Started
wxErlang - Speeding Up

Apart from the already mentioned wxErlang URLs mentioned here, the Erlang and with it OTP library installation include the "wx.demo" application which lists several wx-widgets on the left, an example of their appearance and between those two representations the related program-code is available, it can be easily copied and used. Below the steps to start the demo-application and a screen-shot.
PS C:> erl
Eshell V12.0 (abort with ^G)
1> wx:demo().
wxErlang Widget Demo Application - part of the Erlang/OTP installation

Related

FranTK installation

I am trying to work with FranTK in order to make some examples to work for class. But cant go further the installation process (cabal install may be to mainstream).
I've gotten it from http://src.gnu-darwin.org/ports/x11-toolkits/hs-frantk/work/
in the readme a directory above it says i need to compile TclHaskellSrc, then FranSrc, then FranTkSrc. but i dont know how.
It also says it works with ghc-5, will it work with ghc-7?
has someone already use it successfully?
FRAN is outdated, bitrotted, and will almost certainly not compile under GHC 7. (See Conal Elliott's page for confirmation of this.) It was supposed to have been followed up with successors Reactive and FieldTrip, but, if I remember correctly, these projects hit a snag over OpenGL implementation issues.
If you're looking for good demos of FRP animation, then you'll be better off with one of the following:
elerea - it's simple, and has several good examples
sodium - also simple, and also has several good examples
reactive-banana - More complex than the other two, and more intended for GUI programming than for animation. Still worth a look, as it is well-documented and actively maintained.
The state of the art for FRP used to be Yampa, but I'd recommend against using either it or its recent fork Animas, not because they're bad in any way, but rather because they use Arrows, which tend to overcomplicate an already-difficult subject.
Hope this helps.
Old thread, I know, but Elm (elm-lang.org) has come along in the meantime. It compiles down the JavaScript, supports animations easily, and is under active development.

Is there a website to look up common, already written functions?

I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Sure there are certain libraries you can use, but where do you find these libraries and when they are absent, is there a site like I'm describing?
Possibly a wiki of some type that contains free code that anybody can edit and improve?
Edit: I can code things fine, I just don't know HOW to do them. So for example, right now, I'm trying to localize a robot/car/point in space. I KNOW there is a way to do it, just based off of range and distance. Triangulation and Trilateration. How to code that is a different story. A site that could have psuedo code, step by step how to do that would be ridiculously helpful. It would also ensure the optimal solution since everybody can edit it. I'm also writing in Matlab, which I hate because it's quirky, adding to my desire for creating a website like I describe.
StackOverflow.com. No, I'm not joking.
At its best, people come here saying "hasn't some library done X already", and very often the Collective Wisdom answers "yes". But the biggest obstacle is lack of a description language: even here, a big problem for many posters is describing the problem clearly enough for others to recognize it as something they've seen before.
And if people can't understand what you're trying to do, no search engine will.
Firstly, two caveats:
Copy and pasting code you don't understand is a bad idea. Make sure you understand exactly what the code does before you use it.
Make sure you respect the license of the code you are copying. This is important!
Those caveats aside, it's often language dependent. Languages with an open development ethos (not just an open source implementation, think Python as compared to Java) tend to have official archives of open source libraries. For example:
Perl (which probably started this trend) has CPAN
Python has PyPI and Python Cookbook
PHP has PEAR
C++ has boost
Ruby has gems
R has CRAN.
Haskell has Hoogle and Hackage
Furthermore, don't forget to look in your languages standard library. Some modern languages have massive standard libraries, which have often contained the functionality I am looking for:
Java has its API documentation
C# and VB.NET have the massive MSDN
Non-openly developed languages often have non-official community archives. For example:
C# tends to have a lot of code at CodePlex and CodeProject
MATLAB has the Matlab Central File Exchange
A third category of sites are language agnostic. They are often best search through POG (plain old-fashioned Google). For example:
Stack Overflow
SourceForge
The confusingly language agnostic Java2s
Planet source code
Github
Finally, a fourth category of sites that I find increasingly useful are source-code search engines:
Google Codesearch
Koders
You may also be able to find useful source code, or at least get help writing something, through various pastebins.
Pastebin is language-agnostic
HPaste is mostly Haskell, but has a little in other languages.
Often, at the end of the day it is easiest just to google it, though.
There is a wiki that contains free code that anybody can edit and improve:
Rosetta Code.
As a means of an overview there is the "Solutions by Programming Task" page.
From the former page:
"Rosetta Code is a programming chrestomathy site. The
idea is to present solutions to the same task in as
many different languages as possible, to demonstrate
how languages are similar and different, and to aid a
person with a grounding in one approach to a problem
in learning another."
Cutting and pasting code you find on the Internet into production code would be like chewing gum found in the street. - Mike Johnson
With that in mind, try sites that host opensource projects like GitHub, CodePlex, code.google.com, etc.
I'm not sure this question is language agnostic, but I use GitHub this way ;) Other languages may have places where this is possible.
Safari Bookshelf from O'Reilly has many, many books that contain many implementations from which to choose.
http://my.safaribooksonline.com/
I was a subscriber for a few years before coming to my current job, where we have a corporate account! It's one of the best perks, and one of the best resources I have available. I haven't bought a computer book in years.
Aside from sites like this (Stack Overflow) I don't think there's many, maybe CodePlex, but I almost marked you -1 for assuming that code found on the Internet is yours to copy.
I'd suggest reading about software licencing, I hope you'd at least comment where you got it from.

Creating a scripting language

Can somebody please guide me in the right direction of creating a scripting language that targets the WSH (Windows Scripting Host)?
I have googled for it, but there seem to be far fewer links related to this than when I originally searched for it a few months back.
THank you
The product is now called "Windows Script Host". The MSDN documentation suggests that what you want is a Windows Script Engine, about which the documentation claims that you can create one for any programming language or environment—presumably including one you create yourself. Beyond that, the documentation is not terribly clear.
You should be able to find all necessary information about creating Windows Script engines on MSDN; other than that there seems to be no resources available (at least I couldn't find any). You can also take a look at some open-source engine implementations to get the idea of what your code should look like:
PHPScript
ActiveScriptRuby
Open Object Rexx
If you have any specific questions about implementing Windows Script interfaces, feel free to ask them here. Good luck!
Topic starter need to carefully read the script56.chm, which can be found on MSDN. This help file describes WSH engine specification.

Methods for debugging NSIS installers?

Although NSIS allows you to build quite powerful installers, the "so low level language that it reminds me of assembly" that NSIS uses is quite prone to making mistakes and therefore, when you want your installer to do something more complex other than writing files, debugging is a must.
Until now I've used the following Dr Printf-like debugging technique:
In a .nsh file that I include everywhere, I define a NSIS_DEBUG_MSG macro according to the value of a DEBUG define
if DEBUG is on, the macro will trigger a MessageBox with the debug message
if DEBUG is off, the macro will do nothing
This method has served me well but it presents some disadvantages:
it requires me to fill the code that I feel it's the one failing with calls to NSIS_DEBUG_MSG and rebuild the installer several times until I get enough info to allow me to solve the problem
it will do me no good if my problem is that the installer itself fails (if the installer program dies)
So what I wanted to know is what debugging methods do you use for these installers so that hopefully I can improve mine.
During my time using NSIS, there is these things noticeable:
I have found out that nothing is more powerful than parsing !verbose 3 level output with self-made tool ;)
I have found out that you can NOT depend on any NSIS-based debugging method. It may crash .. and your installer will crash along with it. No pretty, eh'? :(
I have found out that enabling/disabling debugging on-demand is also very powerful weapon against idsses as it allows to distinguish between unstable and failed NSIS build ( it is easier to use CI terminology though... :) ).
I have found out that verbose output w/o realtime automated NSIS testing is like driving Cadillac with bicycle engine :)
Hope it helps for those accidentally visiting this question :)
EDIT: It's always good idea to start with 3rd party tools. For example, no need to hassle around GUI as it is always easier to use tools like:
EclipseNSIS ( I do not like it though :P )
NSIS Dialog Designer (http://nsis.sourceforge.net/NSIS_Dialog_Designer)
Self-made static code analyzer. I have made one for myself :P
EDIT #2: I have found out that pretty effective method for debugging is to use direct documentation automatization. Currently I use the following components:
http://nsis.sourceforge.net/NsScreenshot_plug-in ( See IMPORTANT NOTES to have no unexpected surprises... )
http://www.dokuwiki.org/cli#dwpagephp ( See this link for more information: http://www.microsoft.com/web/platform/phponwindows.aspx )
The result is that I got screenshot after nsDialog:Show plus I got updated images in wiki :) .. only stuff left is to fetch info from svnlook :)
EDIT #3: And the need of svnlook is also worked-around by building a svn log --xml exporting DLL using NSIS v2.44 header for Delphi and Lazarus IDE 0.9.30.2 :) Kudos to Lazarus!
Woohoo! :)
EDIT #4: Hit this small discussion here: http://forums.winamp.com/showthread.php?t=325521
What have saved me much time is to use the logs that are created by NSIS. Both the log while compiling the scripts, and the installation log. They allows me to check that the macros I have defined is in use, and that the installation actually run the scrips they should.
It might seem too little, but this is actually everything I need to keep my installation software of 50+ nsh files running, along with the divide an conquer principle.
You can download one of the special builds of NSIS from the official site that has advanced logging. This will give you very detailed logging information that makes debugging easier.
I use the DumpState plugin a lot, much better than a basic messagebox for stack issues. I alse tend to use a macro that sets all registers; $0=r0,$1=r1 etc so I know the stack is in the correct state. This is of course only useful during the design phase and not so much for debugging on the end users system...

What real-world projects would you suggest as code examples to study?

What real-world projects would you suggest looking through the sources?
As I'm learning Java Swing, mucommander seems to be a decent example. The code is excessively commented though.
EDIT: No shameless plugs plz :).
I learned a lot from looking at the source code to GoGrinder. It's well thought out, uses MVC correctly, and the comments are helpful (and no, I didn't write it). It's also a fun program to use if you want to learn how to play Go.
For Gui design, Patterns and general good advice I highly reccomend Jeremey Miller's series of articles on building a better CAB. For C#, but equally applicable to Java. Also using
the MVC style which Stackoverflow follows, and Apple uses for Interface Builder.
Build your own CAB
Jeremy's articles/ideas are followed in his own project, which you can download and inspect at http://storyteller.tigris.org/
Take a look at the Windows version of truecrypt. It is one of the best organized open source projects I've ever seen. You can almost tell how the whole thing works just from the directory and file layout.
What I've done to learn some new technologies over the years is to look to open source projects that both match the criteria you're looking for and also interest you.
I'm not a Swing guy, but I'd suggest finding a project that uses Java Swing, does not appear too complicated, and then start digging through the source. The nice thing is you can then see the app before you start poking through it, and then you can see what happens as you change stuff.
The idea behind picking something that interests you is that it will keep you engaged. I am intrigued by content management systems, so I might download a CMS that I can then see how stuff works, and I'm engaged because the problem domain of the project fits in with an interest.
I've done this once or twice when I had to get up to speed on C# and I think it works will. YMMV....
Some of the most well thought out source code ( c++ ) I have seen in an open source project is the Ogre3D graphics engine, I've learned a lot about OOA&D just by looking at the structure and reading the comments. It is also well maintained and the community is very active.. http://ogre3d.org

Resources