Compiling and debugging erlang code- for custom ejabberd modules? - debugging

This is a very specific and niche question- but something that'll probably help people working on existing codebases.
Current Scenario
We are running ejabberd 18.01 on prod- and we can't really change this right away. Our current setup for running custom modules is this- either modify existing modules from the source code, or make our own custom modules that are compiled using the erlang compiler that's bundled in with the installer from here. We use erlide as our IDE in Eclipse.
We compile the custom files in in erlide, into a separate directory from where our ejabberd .beam files are; and then transfer the files manually from there to the ebin folder in ejabberd. This is done so that we have VCS for our modified module files.
We aren't using rebar3, and I have zero clue as to how to implement in a heavily modified existing codebase without breaking something. Our only legitimate way of debugging is to put loggers at every step of the process, compile, transfer files, and restart the server- which drastically increases dev time.
It is a genuine nightmare to work with, and resources on ejabberd as well as erlang is scarce- we mostly have the docs to go by, and barely any SO questions relevant.
Any suggestions, resources that can help me setup something to help especially for debugging, would be highly appreciated. Maybe something in vscode would be great. Transferring files I've still managed with inotify, but debugging makes me want to tear my hair out. Please help. Thank you.
P.S.- This is all on Ubuntu 20.04, if relevant. Erlang/OTP version - 20.02, erts- 9.2. Please ask for any further clarifications if required.

Related

How to create distribution of Python GTK3 app?

I made an application using GTK3 on Windows (Mingw_x64 installation of GTK) and I cannot really figure out how to make a distribution out of this. According to official documentation of PyGObject, it is possible in some way.
I already tried to make a package using setuptools, but PyGObject documentation is not saying much about this process and I was not able to configure setup correctly to make it work. PyGObject has a lot of dependecies and weird imports, that I do not know how to include.
I also tried Pyinstaller, which claims it has GTK support, and it really can pack it into executable, however it is not working. I tried these two options:
make only one file (.exe), but in this situations, it throws an error, that some file is not found (libpixbufloader-ani.dll)
create a directory with all needed files (libpixbufloader-ani.dll and other libs are included this time), but when running exe, another exeption occurs, this time Struct and 2 other libraries are missing (strangely, there is a folder that contains Struct)
Becouse of the missing files, I tried adding as many paths containing needed libraries as possible to Pyinstaller, but without success.
Does anyone have any experience with packaging GTK appliciations in Python? There is definitely a way to do this, but I am not very experienced with packaging. If needed, I can provide more information.
This is an issue that has been brought up on PyInstaller's GitHub page, as others (including myself) have experienced the same issue that you've mentioned.
The last time I tried the dev version of PyInstaller, the issue still wasn't fixed, but I managed to get a working executable by using PyInstaller to find the dependencies that my Python3/GTK3 app needed, and then I used cx_Freeze to generate the final executable.

Eyewriter 2.0 Compiling Errors

I'm currently working on the eyewriter 2.0, with the idea that if I can get it working, we can recommend the DIY to our ALS patients and their families.
However, I've been running into many complications while trying to get the software up and running.
I'm currently running Windows 8.1.
I have installed currently Code::Blocks 12.11 and OpenFrameworks v.0.7.4.
I have the openframeworks additions for Code::Blocks installed.
I have successfully run multiple example programs in openframeworks.
I have tried various combinations of C::B and OF such as the following:
13.12 and v.0.8.4;
13.12 and v.0.8.0;
12.11 and v.0.8.0;
12.11 and v.0.7.4;
10.05 and v.0.6.1 FAT pre-release;
10.05 and v.0.6.2 FAT pre-release;
The most common error I have been getting is "fatal error: gl\glew.h: no such file or directory" for the line #include "GL\glew.h" in the ofConstants.h
I'm able to eliminate this error by finding the file manually and inserting the path (i.e. C:/.../.../.../glew.h). However, there are many, many, more errors similar to this which causes the manual correction to be very tedious.
I'm suspecting that the problem is due to my newb ignorance of the proper file structure. I haven't changed the structure from the zipped file which can be found on github.
Location of Workspace: C:\openframeworks\apps\eyewriter-master\eyeWriterTracker\RemoteEyeTracker.workspace
Location of glew.h: C:\openframeworks\libs\openFrameworks\gl\glew.h
Has anyone had any success building this on a windows machine? Are there any obvious mistakes that I am making? I'm fairly certain that I'm making noobish mistakes, as I'm new to frameworks and my C++ knowledge is moderately limited.
Is this perhaps easier to do in Ubuntu? I do have the possibility of using Ubuntu in Oracle VM, although not ideal as the purpose is to allow ease of communication to ALS patients and this would add another step in the process even after it's built.
I also am aware that there are already pre-compiled versions of the Eyewriter software available, but I would like to use that only as a last resort when all other resources have been exhausted.
Thanks!
Make a new project with projectGenerator(add neccessary addons)
Add files from eyewriter to your new project
That project is really old, so there will be a lot of changes, oF documentation will come in handy
have fun !

Dependency solution when make/compile error from source code

Very often we need to install software from its source code. Most of the time I just hit "make world" or "make all" then it will work like a charm. But some other time we see make errors, and we need to install other packages in order to let the make go through. This is particularly a problem for compiling low-level systems, such as a Linux kernel or Xen hypervisor.
I have one experience with Xen 3.4. Maybe it has been documented in some corner documents, but it depends on udev-125 to work properly. The weird thing is it functions well most of the time when udev version is 160+, it only breaks in certain cases! It took me a few MONTHS to find out it was because of the wrong udev version!
To make developers' life easier, when a source code is made successfully in one machine, is there some tools to record the list of packages and versions of that machine? Such a 'snapshot' should be shipped with the source code as well, so that when someone meets the make error they at least have a successful 'snapshot' for reference.
Is there such a tool already?
If your software depends on a specific version of a dependency, you should write a check for your configure script/cmakefile/etc. that tests the version of the dependency and bails out if the wrong version was found.
Comparing the output of config.log (a file created by a configure script) can also help diagnose problems like you encountered.

Starting an Existing Java project that has not been documented

I have only worked on projects that I started from scratch, but now I got to work on a pre-existing project(Web applicaation) with no documentation and no guidance. All the folks that worked on the project are gone, and my client wants me to start working on the project.
I need the best Steps to do this, and start running it in my IDE.
Is there any efficient and non-time consuming method to start out? Any tools that might help?
All I got so far-->
1)Project.EAR file --> (module) one War file. (backup exported from server)
2)Versions used--> Java1.4, Websphere app server v5.1, Sapjco Connectors.
3)jars in lib folder(Frameworks) list.
acegi-security-1.0.2.jar
activation.jar
antlr.jar
antlr-2.7.6.jar
asm.jar
aspectjweaver-1.5.2.jar
cglib-2.1.3.jar
chartengineapi.jar
clickstream-1.0.2.jar
com.ibm.icu_4.0.1.v20090415.jar
commons-beanutils.jar
commons-cli-1.0.jar
commons-codec-1.3.jar
commons-collections.jar
commons-dbcp.jar
commons-digester.jar
commons-fileupload.jar
commons-io.jar
commons-lang.jar
commons-logging.jar
commons-logging-1.1.jar
commons-pool.jar
commons-validator.jar
coreapi.jar
crosstabcoreapi.jar
dataadapterapi.jar
dataaggregationapi.jar
dataextraction.jar
displaytag-1.1.jar
dom4j-1.6.1.jar
dteapi.jar
dwr.jar
ehcache-1.2.3.jar
emitterconfig.jar
engineapi.jar
flute.jar
itext-1.3.3.jar
jakarta-oro.jar
jaxen-full.jar
js.jar
jstl.jar
jta.jar
log4j-1.2.11.jar
mail.jar
modelapi.jar
modelodaapi.jar
odadesignapi.jar
org.apache.commons.codec_1.3.0.v20080530-1600.jar
org.eclipse.emf.common_2.5.0.v200906080927.jar
org.eclipse.emf.ecore_2.5.0.v200906080927.jar
org.eclipse.emf.ecore.xmi_2.5.0.v200906080927.jar
org.w3c.css.sac_1.3.0.v200805290154.jar
oscache-2.3.2.jar
sapjco.jar
saxpath.jar
scriptapi.jar
servletapi-2.3.jar
sitemesh-2.2.1.jar
spring.jar
spring-batch-infrastructure-1.1.2.jar
spring-mock.jar
standard.jar
struts.jar
struts-el.jar
struts-menu-2.4.2.jar
taglibs-datetime.jar
taglibs-mailer.jar
taglibs-string.jar
urlrewrite-3.0-beta.jar
utility.jar
velocity-1.4.jar
velocity-tools-view-1.1.jar
I know starting out is always time consuming. But i need better way to start this project
NEED:--
1) What frameworks used in this project.
2) Whats the best way to start. (Clear steps please)
3) Which (open source)Server I can use as alternative to Websphere v5.
Regards.
Edited
Jars added (sorry i forgot to mention some jars in lib)
"Write once, run anywhere" unfortunately doesn't mean you can compile the source code or start the result without errors.
The first step is probably to identify which IDE was used to develop the project with. Look for some specific files:
.project and .classpath -> Eclipse
*.ipr -> IDEA
pom.xml -> Maven
Import the project using the original IDE (make sure you use the same version if you can) so you can start and compile the project without errors.
If there are no such files, curse the people who did it. If they still work at your place, get in touch with their manager and give them input for the next performance interview ("leaves project zombies behind").
If you run into big trouble doing this step: Ask colleagues for help. Web projects are all similar but there are many subtle problems to get them working, so it's much more effective to pair with someone than, say, asking here.
You can also try to locate the original team members; they probably haven't all left the planet. Google is your friend here and maybe someone at your company stayed in contact.
Now your questions:
What frameworks used in this project.
Lots. Apparently, they just took whatever they needed. That said, this list looks pretty common for most web projects that go beyond "hello world."
Whats the best way to start.
See above.
Which (open source)Server I can use as alternative to Websphere v5.
WebSphere has a lot of .... "features" which can't be found anywhere else.
I suggest to try to get the app working with WebSphere first and then try Tomcat or Jetty.
In order not to get insane with WebSphere's startup times, get a powerful machine with lots of RAM, install it locally and use scripting to configure/control WebSphere (at the bottom of the page are scripts for WebSphere 5).

Any existing pure PHP "make" tools?

Let me elaborate on the question...
I have a custom CMS (built on codeigniter FTW) that includes many different types of modules.
Every time we have a new project come through the door, it is a variation and amalgamation of a few of the existing modules.
Sometimes a project comes through with requirements that are not satisfied by the existing modules, in that case I will write a new module...
All the modules are separated out in folders and the code is VC-ed using GIT. Every module has it's own Model, View, Controller, SQL and Javascript files. All the dependencies are also separated and folder-ed nicely...
The next step for me is to create some sort of installer script that will take me through the "scaffolding" process step by step, allowing me to choose from the existing modules. A glorified "makefile" if you may...
Rather than rolling my own, does anyone know of any such thing out in the wild.
I know of Apache ANT (java), what I need is something in pure PHP with very low or no dependencies...
I would like something as simple as running a git pull and then php make.php
Thanks.
The "Ant-like" alternative I am aware of in PHP land is phing it is written in PHP and it will allow you to perform several tasks for packaging, deploying and testing your web applications. The documentation is a great starting point if you want to hit the ground running.
It is can also be extended to define new tasks if needed (examples and explanations are provided in the documentation)
Reading through the doco it appears to be possible to install Phing without PEAR as documented here you would have to correctly setup the environment on each machine you wish to use Phing on. I can not confirm this method though as I use PEAR for all my installs.

Resources