Questions tagged [code-conversion]

The process of converting the logic of some source code from its original language/framework to a different language/framework. Not to be confused with porting, which deals with architectures/platforms.

272 questions
2
votes
5 answers

Problems with Converting R Code to Python

from pyensae.languages import r2python print(r2python(rscript, pep8=True)) I have problems converting filename.R into pythonfilename.py because these libraries are not useful for converting as it generates the error 'module not found' even if I…
Abdul Rehman
  • 167
  • 2
  • 14
2
votes
1 answer

OWIN startup class in VB.NET

I'm trying to create an OWIN startup class for Azure AD authentication using a sample project from Microsoft as reference. The sample is in C# but the project I'm adapting it to is in VB.NET so I need to convert the following C# to VB.NET: public…
TheIronCheek
  • 1,077
  • 2
  • 20
  • 50
2
votes
0 answers

Convert Eigen to numpy matrix

I have the following code in C++ that uses the Eigen library, need help to translate to python (numpy) Initialization double b = 20.0; Eigen::Vector3d C(1.0/10.2, 1.0/10.2, 1/30); Eigen::MatrixXd U(5200, 3); int i = 0; for (double x = 10.2/2.0; x <…
okkhoy
  • 1,298
  • 3
  • 16
  • 29
2
votes
1 answer

Need help converting Ruby code into F#

I have the following code in Ruby which takes a list of 'melds' and creates a Tree Structure in order to find the best combination of melds and returns that. I am wanting to convert this code into a F# equivalent but I am having a hard time thinking…
TJ8
  • 121
  • 5
2
votes
0 answers

how to convert sql query to eloquent laravel?

how to convert simple mysql query to eloquent laravel? in fact I want to convert down query : SELECT temp.* FROM (SELECT * FROM avilableproducts ORDER BY avilableproducts.count DESC) AS temp GROUP BY temp.products_id, temp.color HAVING…
2
votes
2 answers

How can I convert a synchronous post request to an asynchronous post request?

As it's widely known that an asynchronous post request is better since the user won't get a perception that the app has "crashed" while it's loading the long process. However, I'm not sure where to start to convert a synchronous post request to an…
Panda
  • 6,955
  • 6
  • 40
  • 55
2
votes
2 answers

Convert if ((loc = [player locateCardValue:8]) > - 1) to Swift 3

How would you convert this Objective-C if ((loc = [player locateCardValue:8]) > -1) { to Swift 3? [player locateCardValue] returns an integer of the location where the card '8' was found. Returning -1 means it didn't find the card '8'. I could …
Johnne
  • 143
  • 10
2
votes
1 answer

Converting class to struct

I have an assignment where I have to convert a c++ like program to a c program. If I have something like class B { int var; int somefunction(){ some code here } } it would get changed to struct B{ int var; } int…
FreeStyle4
  • 272
  • 6
  • 17
2
votes
1 answer

Convert SQL code to R (using dplyr)

I am trying to convert SQL code to R using dplyr. I almost did it but I have an issue with the last part of the code. I have to display only the counties (denloc) where the sum of fines (valamenda) to be greater than the sum (valamenda) in…
2
votes
7 answers

string vs System.String, int vs System.Int32 : another Alias vs Type Name question

Quite often I see source code where language's keyword are replaced with full type names: System.String, System.Int32, System.GUID etc. Moreover, people who do this write complete type names everywhere, making source full of such declarations:…
Dmitry Karpezo
  • 1,054
  • 11
  • 26
2
votes
2 answers

Convert Pentium II timing code into inline assembly?

I am trying to use the following code in GCC. It is throwing errors(I guess because of __asm). Why is this simple and easy format is not working in GCC? Syntax of extended assembly is provided here. I am getting confused, when it comes to use of…
ANTHONY
  • 333
  • 5
  • 18
2
votes
1 answer

1D Random Walk from Matlab to Python

I have a Matlab code that generates a 1D random walk. %% probability to move up or down prob = [0.05, 0.95]; start = 2; %% start with 2 positions(1) = start; for i=2:1000 rr = rand(1); down = rr1; up =…
Spica
  • 127
  • 2
  • 10
2
votes
5 answers

how does vbscript evaluate string greater than string?

i'm converting some vbscript from an asp app and ran across a line in the form of If sCode > "" Then where I expect sCode to contain a string. i know enough vbscript to plod through it but i'm not sure of the behavior of some quirkier statements.…
lincolnk
  • 11,218
  • 4
  • 40
  • 61
2
votes
0 answers

how can i convert the url to curl and use it.this url is giving xml response so i dont know how to get data from xml code

i am trying to use some API which gives the response in XML file. i got the url for the response. how can i convert the url to curl and use it.it is giving xml response so i do not know how to get data from xml code.how can i get the data from xml…
Paras
  • 240
  • 1
  • 13
2
votes
2 answers

Rewrite part of javascript with C#

I'm writing this program in C# which should display Google Maps. I'm using the Google Maps JavaScript API which is the best one I could find. With the program you should be able to search for places. The code: window.onload = function() { …