What is actual purpose of .thrift file in an Apache Thrift based application? - distributed

Does the .thrift file reside in the Server side or the client side of the application?
What is actual purpose of .thrift file in an Apache Thrift based application?
Is it only used for generating minimal source codes for the application, or, does it have any other use?
Can't I just write client-server codes myself without taking the help of .thrift file?

The *.thrift file is an IDL file, where IDL stands for Interface description language. The main purpose of this file is to generate the service-specific code for the desired target language(s). The like any other IDL file, the *.thrift IDL file is not required to be copied onto server or client end to have a working solution.
Aside from that, making the IDL file publicly available can be useful for documentation purposes for developers that want to use the service.

Related

How can I make a file hard to read like the bellow attached file ( image )

I have some .sh files, this file contains my ssh and scp details.
I would like to encrypt the ssh files, upon encryption It should be able to execute/run.
like the background.js ( attachment ) file is encrypted but still executing in the browser
Background:
There is a difference between obfuscation and encryption.
Obfuscation hides the data or makes it hard to read, but it is still theoretically possible to reverse this and get back the original source data.
Encryption actually uses cryptography to make it near-impossible to decrypt without a key.
I believe the image I'm looking at above is "obfuscated" and not "encrypted" based on the details that you've provided.
Answer:
If you're running this file on a machine and not in a browser, I'd recommend looking at compiling it into an executable which will compile it into bytecode. This will likely accomplish your original intent of hiding the source. Nexe is one tool for NodeJS that can do this.
If you're running this in the browser, then you can only really obfuscate it. Terser is a library for this in NodeJS
And lastly, a common pattern for hiding ssh details is to put them into environment variables and have a script reference the environment variables rather than actually putting the credentials in the code.
In JS, that would be process.env.PASSWORD

Decompressing .lz file

Curiosity is one of my personal keys. I got a folder of an executable c application, this folder include many files some are files.so , files.ini and other files.lz and I decided to try do some kind of reverse engineering, so I have used a reverse engineering online tool for the files.so and files.ini are already opened via notepad as we all know, but now my problem is about opening files.lz, which i already know that it contains libraries to be used for functions on files.so
This is what i want to know and to have some help in it how can I decompress it via a desktop tool or even an online tool?
Should be Lzip.
When you are in the linux-world, one very usefull commands is file:
$ file myFile.lz
myFile.lz: lzip compressed data, version: 1

How to upload image file using cgi program written in c language?

I wanted to upload a jpeg image file on the server.I have a GoAhead web server which supports only cgi c program as a serverside handeling.
Can any one know how to handle http posted image file in program witten in cgi in c language?
The GoAhead web server has a file upload filter for this purpose. The upload filter receives the uploaded file and saves it to disk. It then sets some request variables describing the upload. Those variables are accessible via CGI or via action functions or JST templates.
There is an example in test.c. Search for uploadTest().
See: https://github.com/embedthis/goahead/blob/master/test/test.c
To get POST data just read stdin. Environment variable CONTENT_LENGTH tells you how much to expect but of course you need to make your code robust against whatever a potentially malicious user can throw at you.

Is there an established way to use configuration files for a deployed MATLAB application?

I am working with a MATLAB project, and would like to be able to configure variables and paths without re-creating the executable (currently done by using MATLAB's built-in deploytool). I realize I can create a simple text file, listing key=value pairs, and read that in during run-time. There doesn't seem to be any built-in support in MATLAB for creating configuration files that follow a standard format.
Are there any standard existing ways to use configuration files for MATLAB-generated executables?
1) Add your resource to the package in DeployTool in the shared resources part
2) Read by using:
fullfile(ctfroot(),'config.txt');
Edit : That is suitable if your configuration is "private", that is the user should not edit it. In this case it is deployed together with your program as a resource. If you want a "public" config for the users, I know of no better way than to do what you offered.

How to create a header file for my existing C program in linux to connect with MySql?

it's my first time I use Linux and C programming. I've wrote a file in C language to connect with MySQL and it's working fine now. Now I've to integrate this file into my company web-based system which is written with CGI ( C ). So I guess I should make my file as a header file and call this file from the CGI. How should I create a header file ? Or is there any better way ? I google on the net but not so lucky with CGI. Can anybody help me?
I don't think that putting everything in a header file is the best solution.
Create a header file and put the
function prototypes and structure
declarations in it
Create a C file and put function definitions in it
Then you can either link with the object file obtained or you can create a dynamic library.

Resources