Can I develop from the BNA file of an existing hyperledger system? - hyperledger-composer

I've been tasked with adding features to an existing hyperledger system. But all I've been given is the .bna file. I can clearly see it contains javascript source as well as models, but is this really enough to develop from? All my experience is going from .cto and .js files and configs to building the .bna archive. How do I go about doing that in reverse? Am I likely to run into problems because I'm missing something necessary not normally packaged in the .bna? Should I insist on getting the actual source tree that was used to build the .bna file? I already asked specifically for that and NOT the .bna file, but was ignored. Am I the ignorant one here?

The BNA file contains everything the networks needs to execute. The only things you are missing is things like build scripts, unit and system tests, documentation. So, I would keep trying to get the original source if you can, if you can't you do have enough to get going.

Related

How do I make a GitHub repository into an exe?

I am new into software developing. I have found this GitHub repository which I plan to modify. Let's just say I fork this repository and modify it. How would I then be able to export it from there. By export it I meant turn all of those files into one windows executable file. Thanks.
In general, building a project is a project-specific task unless the project is written in a language (such as Rust) that has a built-in build tool. If you're unclear about the steps to build a project, you should look in the documentation or the wiki for steps about how to do so, and failing that open an issue asking them to document the procedure for building the project.
Just looking at the project, it does not seem obvious that it should produce a binary executable of any sort since it's written mostly in JavaScript.
Usually you use a compiler to turn source code into machine code (exe files).
As bk2204 mentioned, this project is based on Javascript and Node.js.
Javascript is interpreted instead of compiled, so another program (Node.js) reads the source code and executes it directly every time instead of first compiling it into an exe file. That other program itself may be in an exe file.
The project you have linked is a fork of this project, and that one seems to have a Windows launcher/installer exe file (that probably installs or contains Node.js, but I haven't checked).
That installer is available here in both exe and source code form. So you could modify the launcher and rebuild it, but the main app is not in the launcher, instead it's in all the JS files. You may be able to edit the JS files and just use the same launcher without modifying it. There may be a packaging step required after editing the JS files, to package them into a form that the launcher expects. You would need to run this build step after every time you modify the JS files, to provide the new code to the launcher.
You would have to explore the project's structure and build process to find out the exact steps.
If you're very new that may be exceedingly difficult.
You may want to practice by learning Javascript and Node.js.
You could after that try Java which is compiled, and possibly more powerful than Javascript. Just for fun.
Maybe you could do 30 of these practice projects, then you'll have a chance of being able to modify this project successfully.

Ship Golang binary with dynamic(config.toml) configuration file

I have a simple go server that works, and gets most of its configuration settings from a toml file.
The current process involves restarting the go build source every time the settings are changed.
What is the correct/most preferred/tested and working way to ship only binary and the config.toml file?
I am still a newbie when it comes to compiling, and i have been reading a lot of texts and still not having a clear understanding on this issue.
Any useful comments will be appreciated.
Config files aren't meant to be embedded in executables. It'd be better to have them reside alongside executables. Since I couldn't get your point on rebuilding complete app just for reloading configuration, I made up my former sentences presuming you're hardcoding.
If we get to the “reloading” topic, I would surely restart my program or send a signal to re-load the configuration. You don't have to do this, because there is a nice library doing this: https://github.com/spf13/viper. It is easy to use and supports live watching for changes on config file. Besides supporting JSON, YAML, TOML and HCL, it can read from environment variables, remote config systems (like Consul and etcd). It's trusted and used by big projects, such as Kubernetes.

Better management for large number of shared files between TypeScript projects

I've been writing bots that run on a platform I do not have control over. Essentially, I can upload a single file, and it only has access to basic JS and the site runtime. I chose to actually develop in TypeScript and transpile, to make things easier (imo). Since the initial bot was written for an individual, I've been asked for a few other customized variants. I do not mind this as there is very little in the bots that need to be changed per person. I have been hardlinking the common files between the projects, so as to not have to update in multiple places. This is, without a doubt, a bad solution. I am developing this in Visual Studio 2015, although I also have Visual Studio Code available, if anyone knows of a better build method. I am not very familiar with either, however. I would prefer being able to keep the common files in one project, and import them as dependencies. Maybe I missed something obvious, but attempting the same as I would do for C# did not seem to work.
From the way you are describing things, it sounds like you need to use some sort of custom build.
I would keep each of your bots in the same project and make sure that they share code appropriately, and then after tsc transpiles your files, concatenate them for each bot. So, each bot will get the files that it needs all stuffed into a single, gargantuan file.
You will need to do some trickiness, like parsing import/require statements, or include some kind of directives in each file that describes what other files are needed.
This doesn't sound too tricky to do and is the approach that I would take given the problem description you have provided.
As it turns out, you can declare a tsconfig.json file, and in there, specify things like included directories and specific files. This wound up being exactly what I needed, and was remarkably easy to set up. I've been updated the apps/bots for a while now using this system, and all the common files are effortlessly "shared" between then, with only recompilation necessary.

Mono fo Android - One Solution for many clients

I have created three different solutions for three different clients, but those solutions are for an app that have the same features, classes, methods, resolution, except for the images, XML resource files, and a web service reference, that are specific for each one.
I would like to have just one solution for all those apps, that I could open in VS2010 IDE for edition, without errors. So, when I need to build or publish an specific app, I just set the client which one I need to, and go ahead to building or publishing.
It is important to consider that XML file names will be the same, as classes and images names too. The difference will be the content, but the name will always be the same.
My intention is to reduce my effort to maintain many solutions, having just one solution to work with.
In my company, we will have more than those three clients soon, so I am worried about how to maintain that. The best way will be have just one solution and when I need to generate a new app for a new client, I have just to change/include a few things (like some resources and images) and compile to a new client folder.
Is it possible? If so how?
One option would be to have a master solution which had the following
A "Template" project that contained your actual application and all of the shared code
Projects for all of your clients
In the projects for your clients, you could have links to the files in your files that come from your shared project. Then, in each of those projects, you could add the files that are only specific to them.
With this kind of structure, whenever you made a change to your Template project, all of the client projects would be updated as well because they just have pointers back to the Template project.
A good reference for this kind of setup would be the Json.Net Code Base. There he has a solution and project for all of the different configurations, but they all share the same files.
In terms of ensuring that the xml files are named properly, you might just want to put some checks into your main application to ensure that it has all of the files needed or potentially add a check into your build process.
There are many ways you could look to tackle this.
My favorite would be to run some sort of pre-build step - probably outside of Visual Studio - which simply replaces the files with the correct ones before you do a build. This would be easy to automate and easy to scale.
If you are going to be building for many more than three customers, then I think you should look to switch from Visual Studio building to some other automated build system - e.g. MSBuild from the command line or from something like TeamCity or CruiseControl. You'll find it much easier to scale if your build is automated (and robust)
If you don't like the file idea, then there are plenty of other things you could try:
You could try doing a similar step to above, but could do it inside VS using a pre-Build step.
You could use Conditional nodes within the .csproj file to switch files via a project configuration
You could look to shift the client-specific resources into another assembly - and then use GetResourceStream (or similar) at runtime to extract the resources.
But none of these feel as nice to me!

XCode: Project portability: How to handle code files shared between applications?

As I create more applications, my /code/shared/* increases.
this creates a problem: zipping and sending a project is no longer trivial. it looks like my options are:
in Xcode set shared files to use absolute path. Then every time I zip and send, I must also zip and send /code/shared/* and give instructions, and hope the recipient doesn't have anything already at that location.
this is really not practical; it makes the zip file too big
maintain a separate copy of my library files for each project
this is not really acceptable as a modification/improvements would have to be implemented everywhere separately. this makes maintenance unreasonably cumbersome.
some utility to go through every file in the Xcode project, figure out the lowest common folder, and create a zipped file structure that only contains the necessary files, but in their correct relative folder locations, so that the code will still build
(3) is what I'm looking for, but I have a feeling it doesn't as yet exist.
Anyone?
You should rethink your current process. The workflow you're describing in (3) is not normal. This all sounds very complicated and all basically handled with relative ease if you were using source control. (3) just doesn't exist and likely never will.
A properly configured SCM will allow you to manage multiple versions of multiple libraries (packages) and allow you to share projects (in branches) without ever requiring zipping up anything.

Resources