PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label binaries. Show all posts
Showing posts with label binaries. Show all posts

Monday, September 26, 2022

[FIXED] How can I check if a binary dependency is available in Perl?

 September 26, 2022     binaries, cpan, perl     No comments   

Issue

Having volunteered to maintain a stagnant CPAN package (GnuPG) I'd like improve the install files such that they exit gracefully if the gpg binary (which GnuPG is a wrapper for) cannot be found. After a bit of seeking inspiration from other packages, I've come up with adding this to Makefile.PL:

my @paths = grep { -x "$_/gpg" } split /:/, $ENV{PATH}, $ENV{PGP_PATH};

unless ( scalar @paths ) {
    print <<EOD;
I can't find the gpg binary on your system. If it's not installed in your usual PATH, set $ENV{PGP_PATH} to include where it can be found and try installing again.
EOD

    exit(0);
}

WriteMakefile(
    'NAME'        => 'GnuPG',
    'VERSION_FROM' => 'GnuPG.pm',
    'EXE_FILES'    => [ gpgmailtunl ],
    'LICENSE'      => 'GPL',
    'LIBS'         => [ @paths ],
);

Does that look sane?


Solution

The general concept is fine - if what you need to work is not present, don't create the makefile. The CPAN Testers have rules about exiting with a zero status on failure (which annoys me a lot, but never mind; I hate failing with a success status!).

Question: do you keep a record of where PGP was found at install time, so that if somebody else uses the Perl module without the location on their path, the module can still run?

For DBD::Informix, I have rigid dependencies without which the module cannot be compiled; the Makefile.PL is a major production in its own right because of that. It also tries to handle versions of the software covering over 15 years; that complicates its life, too. If the pre-requisites (some Perl modules; some non-Perl software) is not available, it won't install.



Answered By - Jonathan Leffler
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What backend does Jenkins (Hudson) use for archiving build artifacts?

 September 26, 2022     artifacts, binaries, continuous-integration, hudson, jenkins     No comments   

Issue

I've read about the disadvantages (especially this one) of using SVN to store build artificats (large binary files). Hudson was suggested as an alternative.

How does Hudson handle these files?

Edit: My project is not Java-based.


Solution

Hudson is basically using flat file storage. You can find those files within Hudson in the jobs/builds/ folders. I'm not sure I'd say, "Use Hudson as an alternative to checking in file to source control" but using something as an alternative is a decent idea if it provides:

  1. authoritative place to store
  2. versioned binaries access control
  3. checksums for tamper resistance
  4. release meta-data (environment information; approval level)
  5. retention periods

I'm not sure how well Hudson scores on those marks, but I think it does at least some of that. SVN is non-terrible as a solution there as well, but really struggles with retention periods (old builds tend to eat disk space like crazy) and isn't terribly well optimized for large binaries - most SCM systems are optimized for smallish text files.

I stole the list above from this presentation: http://www.anthillpro.com/html/resources/webinars/Role_of_Binary_repositories_in_Software_Configuration_Management.html (registration required)



Answered By - EricMinick
Answer Checked By - Cary Denson (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why are generated binaries so large?

 September 26, 2022     binaries, c++, size     No comments   

Issue

Why are the binaries that are generated when I compile my C++ programs so large (as in easily 10 times the size of the source code files)? What advantages does this offer over interpreted languages for which such compilation is not necessary (and thus the program size is only the size of the code files)?


Solution

Modern interpreted languages do typically compile the code to some manner of representation for faster execution... it might not get written out to disk, but there's certainly no guarantee that the program is represented in a more compact form. Some interpreters go the whole hog and generate machine code anyway (e.g. Java JIT). Then there's the interpreter itself sitting in memory which can be large.

A few points:

  • The more sophisticated the commands in the source code, the more machine code operations might be required to execute them. Thus, higher level language features tend to have a higher ratio of compiled-code to source code. That's not necessarily a bad thing: think of it as "I only have to say a little about what I want done and it infers all those necessary steps". The challenge in programming is to ensure they are necessary - that requires good library and program design.
  • The compiler often deliberately decides to trade some executable size for faster expected execution speed: inline vs out-of-line code is part of this compromise, though for small functions neither may be consistently more compact.
  • More sophisticated run-time environments (e.g. adding support for C++ exceptions) can involve a bit of extra code that runs when the program first starts to construct the necessary environment for that language feature.
  • Libraries feature may not be comparable. As well as the sort of add-on libraries you're very likely to have had to track down yourself and be very aware of using (e.g. XML, PDF parsing, OpenGL), languages often quietly use supporting libraries for what seem like language features and functions. Any of these can be suprisingly large.
    • For example, many interpreters just expose the C library's printf() statement or something similar, while for output formatting C++ has ostream - a more complex, extensible and type-safe system with (for better or worse) persistent state across function calls, routines to query and set that state, an additional layer of customisable buffering, customisable character types and localisation, and generally a lot of small inline functions that can lead to smaller or larger programs depending on the exact use and compiler settings. What's best depends on your application and memory vs performance goals.
  • Inbuilt language statements may be compiled differently: a switch on an integer expression and have 100 case labels spread randomly between 1 and 1000: one compiler/languages might decide to "pack" the 100 cases and do a binary search for a match, another to use a sparsely populated array of 1000 elements and do direct indexing (which wastes space in the executable but typically makes for faster code). So, it's hard to draw conclusions based on executable size.

Typically, memory usage and execution speed become increasingly important as the program gets larger and more complex. You don't see systems like Operating Systems, enterprise web servers or full-featured commercial word processors written in interpreted languages because they don't have the scalability.



Answered By - Tony Delroy
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to rsync files matched by .hgignore between two hg repositories

 September 26, 2022     binaries, mercurial, rsync     No comments   

Issue

How would you rsync files that are not tracked by mercurial between two repositories?

My .hgignore looks like this:

 
syntax: glob

*.mat
*.pdf
*.asv
*.bz
*.tar
*.zip
*.7zip
*.rar
*.gz
*.wmv
*.png
*.jpg
*.jpeg
*.bmp
*.tif
*.tiff
*.gif
*.avi
*.mpg
*.node
*.ncb
*.pdb
*.ele
*.hh
*.html
*.htm
*.xsl
*.log
*.o
*.ilk
*.cvs*
*.vproj
*.proj*
*.mex*
*.sln
*.run
*.make
Makefile
*.ignore_dirs
*.d

Thank you


Solution

you can produce a list of ignored files that exist in the repository with hg st -ni. nonversioned files with hg st -nu.



Answered By - just somebody
Answer Checked By - Marilyn (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What are the reasons for not hosting a compiler on a live server?

 September 26, 2022     binaries, compiler-construction, deployment, pip, python     No comments   

Issue

Where I currently work we've had a small debate about deploying our Python code to the production servers. I voted to build binary dependencies (like the python mysql drivers) on the server itself, just using pip install -r requirements.txt. This was quickly vetoed with no better explanation that "we don't put compilers on the live servers". As a result our deployment process is becoming convoluted and over-engineered simply to avoid this compilation step.

My question is this: What's the reason these days to avoid having a compiler on live servers?


Solution

In general, the prevailing wisdom on servers installs is that they should be as stripped-down as possible. There are a few motivations for this, but they don't really apply all that directly to your question about a compiler:

  • Minimize resource usage. GCC might take up a little extra disk space, but probably not enough to matter - and it won't be running most of the time, so CPU/memory usage isn't a big concern.
  • Minimize complexity. Building on your server might add a few more failure modes to your build process (if you build elsewhere, then at least you will notice something wrong before you go mess with your production server), but otherwise, it won't get in the way.
  • Minimize attack surface. As others have pointed out, by the time an attacker can make use of a compiler, you're probably already screwed..

At my company, we generally don't care too much if compilers are installed on our servers, but we also never run pip on our servers, for a rather different reason. We're not so concerned about where packages are built, but when and how they are downloaded.

The particularly paranoid among us will take note that pip (and easy_install) will happily install packages from PYPI without any form of authentication (no SSL, no package signatures, ...). Further, many of these aren't actually hosted on PYPI; pip and easy_install follow redirects. So, there are two problems here:

  • If pypi - or any of the other sites on which your dependencies are hosted - goes down, then your build process will fail
  • If an attacker somehow manages to perform a man-in-the-middle attack against your server as it's attempting to download a dependency package, then he'll be able to insert malicious code into the download

So, we download packages when we first add a dependency, do our best to make sure the source is genuine (this is not foolproof), and add them into our own version-control system. We do actually build our packages on a separate build server, but this is less crucial; we simply find it useful to have a binary package we can quickly deploy to multiple instances.



Answered By - akgood
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] What does "Failed to zip binaries" mean?

 September 26, 2022     binaries, c     No comments   

Issue

I have successfully compiled my code, but it says this:

Note: You can also run your application by typing 'run' followed by any command line arguments.
Starting application without args...
Checking Libraries...
Copying files...
Processing Files...
Compiling...
Failed to zip binaries!

Application Exited.

I want my code to have the user enter three numbers, with spaces in between, and have them be multiplied, so here is my code:

#include <stdio.h>
#include <stdlib.h>

int mult( int x, int y, int z) {
    return x * y * z;

int main()
    {
    int x;
    int y;
    int z;

    printf("Input two integers to be multiplied: ");
    scanf("%d", &x);
    scanf("%d", &y);
    scanf("%d", &z);
    printf("The product of the three numbers is %d\n", mult( x, y, z) );
    getchar();
}

int mult (int x, int y, int z)
{
return x * y * z;
    }
}        

I am using compilr.com as my development platform.


Solution

Your code contains syntax errors. mult is defined twice, and there are problems with braces. Besides, if you are using C89, main should return a value.



Answered By - md5
Answer Checked By - Terry (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to call C/C++ binaries (ported on linux server) from Android application

 September 26, 2022     android, binaries, c, c++, linux     No comments   

Issue

I have developed C/C++ binaries and I have android app. I have ported binaries on linux base server and now I would like to use this binaries in my android app. Can i call this binaries from my app? Is it possible, please excuse me as I don't have any idea about this.


Solution

Here you will find a nice tutorial to implement C code into your Android Project:

JNI tutorial



Answered By - user2143600
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to write and read bytes from unsigned variable

 September 26, 2022     binaries, c++, short, unsigned     No comments   

Issue

Here is what I'm trying to do:

I have two integers

int a = 0; // can be 0 or 1
int b = 3; // can be 0, 1, 2 or 3

Also I want to have

unsigned short c

to store that variables inside it.

For example, if I would store a inside c it will be looking like this:

00000000
^ here is a

Then I need to store b inside c. And it should look like following:

011000000
 ^^ here is b.

Also I would like to read that numbers back after writing them. How can I do this?

Thanks for your suggestions.


Solution

Assuming those are binary representations of the numbers and assuming that you really meant to have five zeros to the right of b

01100000
 ^^ here is b

(the way you have it a and b overlap)

Then this is how to do it

// write a to c
c &= ~(1 << 7);
c |= a << 7;

// write b to c
c &= ~(3 << 5);
c |= b << 5;

// read a from c
a = (c >> 7)&1;

// read b from c
b = (c >> 5)&3;


Answered By - john
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] how to find path from where current binary running?

 September 26, 2022     binaries, embedded-linux, linux, ps     No comments   

Issue

After somewhere searching finally not getting what i want.

I am working on some embedded board with linux system. And many users access it by telnet.So each user suppose copy some binary somewhere and executed like ./binary.So i can see this process running by simply ps command but from where it's running i don't know.

somewhere found that, use which command but as per my understanding(if i am not wrong) which command find only path of that binary whether it's currently executing or not.

And what if multiple users copied same binary in different path?

Also looked another solution use readlink but limited busybox binary supported in my target board. So readlink is not there.

One another solution like

file /proc/"proess id"/exe but here file command not present because of custome linux in my board which contain only limited functionality and binary.

So any other solution is there?


Solution

Try ls -l /proc/"proess id"/exe. ls utility from GNU coreutils shows links with -l option, but I don't have exact information about ls from busybox.



Answered By - osgx
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why does the Numpy community provide 32bit binaries installer but not 64bit?

 September 26, 2022     binaries, numpy, python     No comments   

Issue

The Numpy community provides 32bit binaries installer here

enter image description here

but no 64bit binaries installer.


If they were no binaries installer at all, it would be coherent, and I would understand it as a deliberate choice meaning "You should compile and build it yourself." But this is not true, as 32bit binaries installers are provided.

Is there a technical reason why 64bit binaries installers for Numpy are not officially available?

PS: I know http://www.lfd.uci.edu/~gohlke/pythonlibs/ but here is only Numpy-MKL, and I'm not sure if this works on every machine because of Intel MKL.


Solution

According to WinPython creator :

There is no decent open-source (free) Fortran compiler for the Windows 64bit platform. As a consequence, it's impossible to build NumPy on this platform using only free and open-source tools. That's why there is no official Windows 64bit binaries for this library .

The only ready-to-use installers available out there are the ones you have mentioned ,they use Intel Fortran compiler and these are clearly unofficial binaries.

refer to discussion regarding this matter .

Edit: If you are concerned about performance of the MKL version , both testing and real world experience show that Intel compilers and MKL usually provide the best performance even on AMD systems.



Answered By - Alexander
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to get the code display proper rows and columns in .csv format

 September 26, 2022     binaries, bufferedwriter, csv, io, java     No comments   

Issue

I have the following code. The problem is that its displaying back to back in columns. Here is a picture from my excel file:
enter image description here

I want it to start over from next row once the record for single execution is filled from column to column.

Here is my code:

public class panel extends OrderSystem {

               final JTextField items;
               final JTextField number;
               final JTextField cost;
           final JTextField amount;




          public panel() {

              JFrame myFrame = new JFrame();    
                myFrame.setLayout( new FlowLayout() );

                myFrame.setTitle("GUI Demo - ISTE-121");
                myFrame.pack();
                myFrame.setLocation(600,300);
                myFrame.setSize(400,200);
                myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                myFrame.setVisible(true);

          JPanel order = new JPanel();
          order.setLayout(new GridLayout(5,5,2,2));

          myFrame.add(order, BorderLayout.CENTER);

          order.add(new JLabel("Item no:", SwingConstants.RIGHT));
          order.add(items = new JTextField(3));

          order.add(new JLabel("Number of:", SwingConstants.RIGHT));
          order.add(number = new JTextField(3));

          order.add(new JLabel("Cost", SwingConstants.RIGHT));
          order.add(cost = new JTextField(3));

          order.add(new JLabel("Amount owed:", SwingConstants.RIGHT));
          order.add(amount = new JTextField(10));
          amount.setEditable(false);


          JPanel buttons = new JPanel();
          buttons.setLayout(new GridLayout(1,1,2,2));

      myFrame.add(buttons ,BorderLayout.CENTER);

          JButton calculate;
          buttons.add(calculate=new JButton("Calculate"));

          calculate.addActionListener(new ActionListener() 
          {
            @Override
            public void actionPerformed(ActionEvent e) 
            {
                // TODO Auto-generated method stub
                double cost1 = new Double(cost.getText().trim()).doubleValue();
                double number1 = new Double(number.getText().trim()).doubleValue();

                double result =  cost1*number1;
                amount.setText(String.valueOf(result)); 

            }

          });

          JButton save;
          buttons.add(save = new JButton("Save"));

          save.addActionListener(new ActionListener()
        {
            @Override
            public void actionPerformed(ActionEvent e) { 



                try{

                        // Assume default encoding.
                        FileWriter fw = new FileWriter("data.csv",true);
                        BufferedWriter bufferedWriter = new BufferedWriter(fw);



                        bufferedWriter.newLine();
                        bufferedWriter.write(',');

                        bufferedWriter.write("\"ItemCode:\""+"\""+ items.getText() +"\""+",");
                        bufferedWriter.write("\"ItemNumber:\""+"\""+number.getText()+"\""+",");
                        bufferedWriter.write("\"ItemCost:\""+"\""+cost.getText()+"\""+",");
                        bufferedWriter.write("\"AmountOwned:\""+"\""+amount.getText()+"\""+",");
                        bufferedWriter.newLine();

                        bufferedWriter.close();


                }  

                    catch(IOException ex) {
                        System.out.println(
                            "Error writing to file '"
                            +  "'");
                        // Or we could just do this:
                        // ex.printStackTrace();
                    }





            }}  
            );



          JButton clear;
          buttons.add(clear=new JButton("Clear"));

          clear.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                 items.setText(null);
                 number.setText(null);
                 cost.setText(null);
                 amount.setText(null);
            }});

          JButton exit;
          buttons.add(exit= new JButton("Exit"));

           exit.addActionListener(new ActionListener()
           {

        @Override
        public void actionPerformed(ActionEvent e) 
        {
            // TODO Auto-generated method stub
          System.exit(0);

        }


           });



           JPanel buttons2 = new JPanel();
              buttons2.setLayout(new GridLayout(1,1,2,2));

          myFrame.add(buttons2 ,BorderLayout.SOUTH);

              JButton load;
              buttons2.add(calculate=new JButton("Load"));

              calculate.addActionListener(new ActionListener() 
              {
                @Override
                public void actionPerformed(ActionEvent e) 
                {
                    // TODO Auto-generated method stub





                }

              });




                  JButton next;
                  buttons2.add(calculate=new JButton("Next>"));

                  calculate.addActionListener(new ActionListener() 
                  {
                    @Override
                    public void actionPerformed(ActionEvent e) 
                    {
                        // TODO Auto-generated method stub





                    }

                  });




                      JButton prev;
                      buttons2.add(calculate=new JButton("<Prev"));

                      calculate.addActionListener(new ActionListener() 
                      {
                        @Override
                        public void actionPerformed(ActionEvent e) 
                        {
                            // TODO Auto-generated method stub





                        }

                      });

    }

}


Solution

Android: How to write newline in CSV file?

Here is written that you can use write.print("\r\n") so use to "\r\n" to make a new line

instead of writing

bufferedWriter.newLine();

you write

bufferedWriter.write("\r\n");

or

bufferedWriter.write("\r");
bufferedWriter.newLine(); 

since bufferedWriter.newLine(); only writes "\n" into your file as far as i know. hope it will help you



Answered By - Gorock
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How does the same source code generate binaries for different platforms?

 September 26, 2022     binaries, build-process, compilation, multiplatform     No comments   

Issue

Many multi-platform applications seem to have common source code. How do builds generate platform specific binaries?
Is it possible to build say, a windows binary on linux or mac?


Solution

It's possible if you have an appropriate cross-compiler and libraries. For example, many programs which are available on both Linux and Windows use the MinGW toolchain on Windows, which includes a library that emulates POSIX functions using Win32 functions.



Answered By - geekosaur
Answer Checked By - Robin (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to read binary file data into arrays?

 September 26, 2022     arrays, binaries, file, python, python-2.7     No comments   

Issue

Attempt to read a binary file in python. From the dataset page:

The pixels are stored as unsigned chars (1 byte) and take values from 0 to 255

I have tried the following, which prints (0,), rather than a 784,000 digit array.

# -*- coding: utf8 -*-
# Processed MNIST dataset (http://cis.jhu.edu/~sachin/digit/digit.html)
import struct

f = open('data/data0', mode='rb')
data = []

print struct.unpack('<i', f.read(4))

How can I read this binary into either a 784,000 digit array (28 bytes x 28 bytes x 1k samples), or a 28x28x1000 3D array. I have never worked with binaries before, and am quite confused!


Solution

f.read() will get you an immutable array of 784,000 bytes (called a str in Python 2). If you need it to be mutable, you can use the array module and its array type capable of storing various primitives, unsigned bytes (represented by the B code) included:

from array import array

data = array('B')

with open('data/data0', 'rb') as f:
    data.fromfile(f, 784000)

This can be sliced as necessary:

EXAMPLE_SIZE = 24 * 24
examples = [data[s:s + EXAMPLE_SIZE] for s in xrange(0, len(a), EXAMPLE_SIZE)]


Answered By - Ry-
Answer Checked By - Clifford M. (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] Why can't a Java application load library binaries from its own .jar?

 September 26, 2022     binaries, java, libraries     No comments   

Issue

While looking for a way for my Java project to load library binaries that are packed with the project, I see several people stating things like:

before you can use the DLLs you need to actually extract these from the JAR and dump these on the hard disk somewhere otherwise you won't be able to load these

Is this statement true? And why?


Solution

DLL (dynamic link libraries) are operating system specific. The operating system needs to be able to directly find the files in order to load them. A jar file is essentially a zip file and the operating system does not go hunting inside of zip/jar files to find DLLs.

In order for the operating system to find a DLL it needs to be accessible directly on the file system, and also in the DLL path for the OS.

Note that jars are Java specific entities, and Java is distinct from the operating system. By depending on an OS-specific DLL (or .o file in Linux) you are restricting your program to work on operating systems compatible with the library - even the bitness (32bit or 64bit) would matter for a DLL.

That being said, if you do need to include and use DLLs, then you'll need some kind of installation procedure or instructions to get the files in place before being able to run.



Answered By - Always Learning
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to build two binaries .net core 2 console app

 September 26, 2022     .net, binaries, c#, csproj, docker     No comments   

Issue

I am new in .Net core and c sharp. i would like to build two binaries in the same namespace. It's two console apps, one server and one client. I'd like to share some objects like "Scores" and think like that. Actually I have created two apps (via the "dotnet new console" command) but i can change and start again. I am working inside a docker container with a simple text editor (emacs). No visual studio or visual studio code there :)

It is possible or not ?

edit: Okay, I will try to be more precise. I have to create two programs: one is a server and the other is client. Clients have to be connected to play a game (multiplayer). Does I have to create two distinct project (with their own namespaces/types/tests) or I can a simple project (just call "dotnet new console" command once) and share a same namespace, share some types between the server and the client (like a score class) and tests ? here is my curent directory (client and server are two directories created via the "donet new console" command :

├── README.md
├── client
│   ├── client.csproj
│   ├── obj
│   │   ├── client.csproj.nuget.cache
│   │   ├── client.csproj.nuget.g.props
│   │   ├── client.csproj.nuget.g.targets
│   │   └── project.assets.json
│   └── srcs
│       ├── Program.cs
│       └── Types
│           └── user.cs
├── docs
│   ├── rfc
│   │   └── donotremove
│   ├── text
│   │   └── donotremove
│   └── uml
│       └── donotremove
├── server
│   ├── obj
│   │   ├── project.assets.json
│   │   ├── server.csproj.nuget.cache
│   │   ├── server.csproj.nuget.g.props
│   │   └── server.csproj.nuget.g.targets
│   ├── server.csproj
│   └── srcs
│       ├── Program.cs
│       └── Types
│           └── server.cs
└── tests
    └── tests.cs

Solution

If I understood the question correctly, all u have to do is to change the namespace on every class.

For example, lets say that one of your binary is called Yourappname.Server and other is called Yourappname.Client. And if we assume that the common namespace that u need to share is Yourcompany.Yourapp. Then simply change the namespace of your classes to Yourcompany.Yourapp.It will do the work.

One more tip..you even can import classes in other namespaces using import statement using the using statement or can use the fully-qualified class name with the namespace.

using Yourcompany.Yourapp;

or

Yourcompany.Yourapp.Score score =new Yourcompany.Yourapp.Score();

Anyhow in both of the scenarios, you need to add references to binaries.You can do that using the .csproj file.

<ItemGroup>
    <ProjectReference Iclude="path to .csproj" />
</ItemGroup>


Answered By - nandithakw
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to install Apache Ignite web-console modules in binary distribution

 September 26, 2022     binaries, ignite, installation, web-console     No comments   

Issue

I have installed Apache Ignite-binaries apache-ignite-fabric-2.6.0 .

As part of the Apache Ignite-web-console-pre-requsite steps : It mentioned

Download the following dependencies:

For backend:
cd $IGNITE_HOME/modules/web-console/backend
npm install --no-optional

For frontend:
cd $IGNITE_HOME/modules/web-console/frontend
npm install --no-optional

However when i go to IGNITE_HOME , i am unable to find the modules directory or /modules/web-console/frontend /modules/web-console/backend directory.

Am I missing something as part of the ApacheIgnite-installation or web-console installation. Please advice.


Solution

You need the source Ignite download rather than the binary one.



Answered By - Stephen Darlington
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can we apply versioning to executable/binaries in C++?

 September 26, 2022     binaries, c++, cmake     No comments   

Issue

I have a big C++ application which we are compiling through Jenkins and generating zipped artifacts containing binaries, headers, config and other relevant files. The build is deployed in the form of services on the client. The problem is how can apply version on those binaries to keep a tract of which build is deployed on which client?

Like with earlier C# application we used make changes to AssemblyVersion file with the tags that we apply on GIT and then compile and we could see the executable have the version applied. Is there a way to do the same in C++?

We are using CMakeLists.txt file for generating builds. We have linux based environment (CentOS 7.5) the application is developed in C++.

Thanks in advances!


Solution

Since you're using CMake, what you can do is use the configure_file() function in your CMakeLists.txt to create a C++ source file which includes your Git version information as a string, then include the created file into your target.

You can get the Git version information into a CMake variable by calling the git executable from CMake, although there are prewritten modules out there to do the heavy lifting.

You can then use the command-line strings and grep tools to find the version string in the binary, or some other method to get it programmatically, depending on if you're making an executable or library.



Answered By - aiusepsi
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How can Godot add Code to Export Templates

 September 26, 2022     binaries, executable, game-engine, godot, macos     No comments   

Issue

One feature that I find impressive about the Godot Engine is how it is so lightweight and quick to compile. I realize that Godot exports using its precompiled export templates but I am confused about how it does so. I am working on macOS so that's mostly what I'm curious about. How is Godot able to add code to a precompiled executable. I've spent hours looking through the source code but can't figure it out.


Solution

Godot's export templates are compiled binaries that use a specific set of SCons options. They're always built using tools=no which disables editor functionality, and official export templates use either target=release_debug or target=release optimizations (for debug and release export templates respectively).

Note that Godot doesn't compile native code when exporting a project -- it just bundles data, scripts and the export template together. Game data and scripts are packed into a PCK file, which is a custom archive format that can store arbitrary files (without compression). The export template then runs the main script contained in the PCK file.

Scripts are compiled to bytecode when exporting a project in release mode, which speeds up loading times but otherwise doesn't affect the script execution speed.

See this page on compiling binaries for macOS.



Answered By - Calinou
Answer Checked By - Marilyn (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to compile NPM modules to binaries for all platforms

 September 26, 2022     binaries, node.js, npm     No comments   

Issue

how to convert NODE MODULES into binaries to support all platform.

  • Windows x86
  • Windows X64
  • Linux
  • OS X

and load those binaries in Node application instead of npm modules. ?


Solution

A good starting point might be to take a look at http://cylonjs.com/blog/2014/11/19/creating-multiplatform-precompiled-binaries-for-node-modules/

It would help if you could clarify your question, since I'm not sure exactly what you are trying to achieve. I answered on the assumption that you have binaries you want to include for node modules on multiple platforms (see link above). Otherwise, just having node modules installed as part of an application should be the same as adding them as a dependency in the package.json.



Answered By - ryzngard
Answer Checked By - Pedro (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to deal with the "platform specific dynamic library" problem with uploading to PyPI?

 September 26, 2022     binaries, dynamic-library, language-interoperability, pypi, python     No comments   

Issue

I have a Python package that depends on binaries. I've build the linux version and it is available on PyPI. The key was setting the package_data argument to ensure the *.so files were also uploaded to PyPI.

Now I want to do the same thing with Windows, which obviously require *.dll dependencies, rather than *.so. When uploading my package to PyPI, is it possible to upload *.so files for when a user downloads my package on a linux platform and *.dll files for when a user is on windows. The issue I'm foreseeing is that if I have to upload all binaries for all platforms, my package will quickly exceed the size limit for PyPI.


Solution

This is what compatibility tags for built distributions are for.

For example, consider https://pypi.org/project/numpy/#files. It publishes the following wheels:

  • numpy-1.18.5-cp38-cp38-macosx_10_9_x86_64.whl
  • numpy-1.18.5-cp38-cp38-manylinux1_i686.whl
  • numpy-1.18.5-cp38-cp38-manylinux1_x86_64.whl
  • numpy-1.18.5-cp38-cp38-win32.whl
  • numpy-1.18.5-cp38-cp38-win_amd64.whl

Each of these contain the platform-specific dependencies for the given platform.



Answered By - Dustin Ingram
Answer Checked By - Willingham (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing