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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

convert something from Javascript to C# [duplicate]

Okay so I was converting something from JS into C# (chess algorithm) and after some considerable thinking I had no idea how to convert this specific line : children.sort(function(a, b){return 0.5 - ...
Marki1234's user avatar
0 votes
2 answers
80 views

Converting aiohttp script to asyncio + requests (aiohttp not working on ubuntu while asyncio + requests works)

I am using the following script to do queries on a website. It works on macos, however it does not work with ubuntu. I have tried requests and it works, I also tried a simple asyncio + requests with ...
anarchy's user avatar
  • 3,739
0 votes
0 answers
45 views

How can I convert my Python No Console code into An Android Package (APK)

Converting python to apk file. Hello, I have got a Python programme in windows and linux, and I have just prepared it for Android System, and I want to convert my python application into a APK file. ...
NMS's user avatar
  • 1
-2 votes
1 answer
47 views

Format(rs.Fields(1), "#,###.00000") to C#

I'm converting some VBA code from Excel macro into C# and came across with this line of code. VBA: Format(12356, "#,###.00000") How to translate this to C#?
Veck's user avatar
  • 125
1 vote
1 answer
313 views

How to convert 'if the do' from SAS to Pyspark

I've a df like this: Zip City 'River' 'London' ' ' 'Rome' 'River' 'Berlin' 'River' 'Madrid' ' ' 'Munich' ' ' 'Paris' SAS code below which I've converted in Pyspark if Zip = '' then do ...
Marco Pasqua's user avatar
0 votes
1 answer
64 views

Does the method name need to be grammatical? [closed]

I have a question that may seem silly, my english is not very good, I often don't know how to name variables or methods. For example, There is a method, its function is to open a modal for creating ...
undefined's user avatar
0 votes
1 answer
78 views

Translating xtabond call from Stata to R

I am trying to replicate findings from a particular study. The study uses the xtabond command in Stata to run an Arellano-Bond estimator with lags of the dependent variables. The goal of the study is ...
eric andre the gian's user avatar
1 vote
0 answers
142 views

From Solidity To Dart : how reproduce an Solidity Address type construction in Dart

I have not managed to convert a line of code I have in one a Smart Contract of the back end of my DAPP into the Dart syntax for the front end part of it. SOLIDITY : address account = address(uint160(...
krizalyde's user avatar
0 votes
1 answer
172 views

Converting C++ API Post Request into Delphi Code

I am programming in Delphi and I'm having a hard time converting a C++ API POST Request into delphi. I have tried using Indy as I have before with previous API's but this one seems to not work with ...
robhercarloz's user avatar
-5 votes
1 answer
73 views

trouble understanding list.begin() | list.end() | list<int>::iterator i [closed]

void Graph::max_path(){ for(int i=0; i <N; i++){ cost[i]=0; cam_max[i]=999; } // Percorre todos os vertices adjacentes do vertice int max = 0; list<int>::...
BLNFR's user avatar
  • 1
0 votes
1 answer
414 views

Convert NodeJS code snippet into Java code for encryption/decryption

I want to convert this below piece of code into java but I am unable to do, Basically I have to implement 'crypto' module in Java. Thanks in advance! let encKey = "...
alice menon's user avatar
2 votes
2 answers
988 views

What is the equivalent of the SQL function REGEXP_EXTRACT in Azure Synapse?

I want to convert my code that I was running in Netezza (SQL) to Azure Synapse (T-SQL). I was using the built-in Netezza SQL function REGEXP_EXTRACT but this function is not built-in Azure Synapse. ...
John E.'s user avatar
  • 137
1 vote
1 answer
548 views

Translating "Bodies to Parts" Macro in CATIA V5 from VBA to C#

I'm trying to convert the Bodies from Parts to Parts in a Product in CATIA. I found a VBA script that works fine, but I have to translate it to C#. The VBA script is the following: Sub ...
madalandria's user avatar
0 votes
2 answers
63 views

Convert json query to insert a variable and re-convert it to json query

I am kinda frustrated. I copied the following Metabase query string from the network tab in the browser: query = "{\"database\":17,\"query\":{\"source-table\":963,\&...
ALL's user avatar
  • 3
0 votes
0 answers
650 views

Convert http request for vb.net to http client

I have this request in VB.NET (NET framework) that I need to convert to C# ASP.NET Core Http Client. The code in VB.NET looks like this: Public Function PostRundown(data As String) As String Dim ...
Pettanord's user avatar
-1 votes
1 answer
186 views

after converting c# to vb.net there is an error Syntax error ,Identifier expected,etc

is there a best code solution so that there is no error in the vb.net?. is there a possibility of an error in the conversion? I provide a share link because I failed continuously to post the code c #. ...
roy's user avatar
  • 693
1 vote
1 answer
58 views

How to convert a condition check from C# to Java?

I am attempting to convert this line of code from C# TO Java and I am having quite a hard time wrapping my head around it. isEqual = !dbCertDict.Keys.Any(x => !String.Equals(dbCertDict[x], ...
Flats's user avatar
  • 81
-2 votes
1 answer
169 views

How would I rewrite PCRE regular expressions so that they're compatible with JavaScript?

As part of a security related project written in Node.js, I'm looking at some of the work done by the team behind PHPIDS, specifically their filter list, which is composed of a large amount of regular ...
André Ekeberg's user avatar
0 votes
1 answer
434 views

Installation without Root Access in Linux

I have to compile Locally Aware NMS (lanms) in my remote server LINUX based with an user account without root access. In lanms there is a script named adapter.cpp , I have to convert it to .pyd so ...
Akash Chakraborty's user avatar
0 votes
0 answers
35 views

What's the alternative to TAILQ_HEAD in Delphi?

The code I'm trying to convert from C is this: struct DebugEventQueueElement { TAILQ_ENTRY(DebugEventQueueElement) entries; DebugEvent de; }; #pragma pack() TAILQ_HEAD(debugEventQueueHead, ...
TheK0tYaRa's user avatar
0 votes
1 answer
114 views

VB .NET to C# Error: 'As' is not a member of 'Task(Of IFlurlResponse)'

I'm converting this C# line return await _serviceUrl.WithOAuthBearerToken(bearerToken) .AppendPathSegment($"api/v1/accounts/{accountId}/identities/{identityId}&...
Claus Fuss's user avatar
0 votes
1 answer
91 views

What does binary plus operator do to int Array in C

I am porting an obscure library form C to dart. a property is defined on a struct like this unsigned char payload[256]; I interpret that as an array of chars. So I converted it to List<int> ...
xerotolerant's user avatar
  • 2,015
1 vote
1 answer
260 views

Convert a parameteric plot from mathematica to python

I have a small parametric plot that I am trying to convert to python from Mathematica. The problem is that my python script does not match this, I am struggling to get the list plot to work as it ...
user4933's user avatar
  • 1,515
-2 votes
1 answer
138 views

VBA object to delphi declaration

I have the below VBA code from a vendor website. I managed to import the TLB libraries into a Delphi project and made references to the corresponding unit files. However, I'm struggling to convert the ...
jimsweb's user avatar
  • 1,082
0 votes
1 answer
197 views

Isuues after converting project from java to kotlin

Hello there after a long time thinking about converting my project from java to kotlin , today I shift from java to kotlin , and as expected and warned by the community that the project will not ...
Vasant Raval's user avatar
0 votes
1 answer
253 views

Converting c++ to c# code for image color matching script

I'm trying to create a script to match the colours between two images using EmguCV. I've managed to find code that does exactly what I want to, here, however it's written in C++ which I'm not very ...
Oliver Spencer's user avatar
0 votes
1 answer
264 views

How can I evaluate pre-defined symbolic variables array in Python?

I have a MATLAB code and I'm trying to convert it to Python. I used the eval() to evaluate my symbolic arrays in MATLAB. But I couldn't find how to solve this in Python. Here's a simple example: ...
max's user avatar
  • 15
0 votes
2 answers
76 views

How do i convert kotlin code into java [Android]

This is the code that I'm trying to convert into java but I don't understand it,actually I get this code as an answer but he/she gives me in kotlin Glide.with(context) .load(url) ...
user avatar
0 votes
2 answers
445 views

URL encode data RFC-3986 in vb.net

How do I convert this code to VB? /// <summary> /// Returns URL encoded version of input data according to RFC-3986 /// </summary> /// <param name="data">String to be URL-...
neilsbennett's user avatar
0 votes
2 answers
512 views

How to tranform the following TensorFlow code to PyTorch?

I was searching for loss functions for a GAN model and then this one came out: gd_loss = tf.reduce_sum(tf.square(tf.abs(dx_real) - tf.abs(dx_fake))) + \ tf.reduce_sum(tf.square(tf.abs(...
André Ferreira's user avatar
0 votes
1 answer
319 views

Convert C# `using` and `new` to PowerShell [closed]

There are many codes in C# that use the keywords using and new. They look very simple! How to achieve that in in PowerShell elegantly! For example I want to change the following C# code to PowerShell ...
tianyi's user avatar
  • 357
-1 votes
1 answer
37 views

This code outputs different values for Python 3 and Python 2, how to get same result for both?

def mod_inverse_iterative(a, b): x, y, u, v = 0, 1, 1, 0 while a != 0: q = b / a r=b % a m = x - u * q n=y - v * q b, a, x, y, u, v = a, r, u, v, m, n ...
Vernon Nabibya's user avatar
0 votes
2 answers
209 views

The name 'Fix' does not exist in the current context

In my project I am converting some vb.net to c# and I came to this line: int thisdigit = Fix(countervalue / (Math.Pow(10, (numdigits - j - 1)))) - Fix(countervalue / (Math.Pow(10, (numdigits - j)))) * ...
bgmCoder's user avatar
  • 6,245
2 votes
1 answer
166 views

IntStream equivalence in Swift

I am investigating some of the components in Java and wondering what is the best practice to convert the following Java code snippet to Swift. public void doTest(ArrayList<Double> items) { //...
thus's user avatar
  • 1,374
0 votes
1 answer
169 views

How to replace a Word in DF Column with another Word using Python -without including the substring

I am trying to achieve the functionality of SAS TRANWRD Function in Python to replace a 'WORD' with another 'WORD'. I have tried using str.replace and replace method available in Python but these ...
jayantyad's user avatar
0 votes
1 answer
118 views

After converting from C# to vb.net it shows an error

I am trying to convert C# code to Visual Basic. This is the C# code: public static string RequestServer1(string methodName, List<string> parameters) { return RequestServer(methodName, ...
Hamita's user avatar
  • 61
0 votes
0 answers
98 views

I need help converting this C# Linq query to VB.net. I dont really understand the certain aspects

I am converting an MVC C# application to VB. I'm running across problem converting Linq. I've got to do a number of these, so prefer a nice explanation. When I convert to VB I seem to get null int ...
Rakesh Patel's user avatar
0 votes
1 answer
224 views

What's the equivalent of MATLAB's 'dbstack' in Python 3?

I am trying to convert a code written in MATLAB to python. In it a function called 'dbstack' is heavily used. This function return the name of the calling function, its file name and the line number ...
Pratik Dash's user avatar
0 votes
0 answers
137 views

how to create object type in c++ like object type in javascript

I wanna create various objects like this in c++ and use them as function parameters. Is it possible? How can I do that ? example = { "name": "example_name", "values" : [{"key": "value"},{"...
Milad Zahiri's user avatar
-2 votes
1 answer
34 views

Not Able To use for-loop

** I want to use two for-loops instead of two while-loops ** i = 7 while i >= 1: j = i while j <= 7: print(j, end =" ") J += 1 i -= 1 print()
Aamir's user avatar
  • 2,390
2 votes
5 answers
4k views

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 ...
Abdul Rehman's user avatar
1 vote
2 answers
905 views

How to use/convert sed to Python?

Any idea to convert the given line below into Python? sed 's+forwarding_link+'$link'+g' first.html > index2.html
Adarsh's user avatar
  • 25
1 vote
2 answers
283 views

How to convert "Set functions" such as removeAll and addAll from Java to C++? Can it be done using erase or insert?

I've been trying to convert a Java code to C++ and I stumbled upon this part of a code which repeats a couple of times. //JAVA TreeSet<String> currentState = new TreeSet<String>(); ...
user avatar
0 votes
3 answers
185 views

How to convert this jQuery code to plain JavaScript?

I'm trying to get the focus method (touch, mouse or keyboard) on links setting a data-attribute. $(function() { var i, r = document.getElementsByTagName("a")[0]; if ("ontouchstart" ...
Arthur Otaviano's user avatar
0 votes
0 answers
583 views

C# equivalent of MSXML2.DOMDocument in VBA

I am new to VBA, tasked to convert VBA code to C#. I am trying to convert the following code from VBA to C#: Dim xml As New MSXML2.DOMDocument Dim node Set node = xml.createElement("base64") node....
Zhu's user avatar
  • 3,751
1 vote
1 answer
215 views

What shall be the Python3 equivalent for useragent and http libraries in perl?

I'm quite new to Perl and Python. I have to convert some old functions created in Perl to Python. I am struggling to find the python equivalent for modules like -HTML::Form->parse() -{ua}->...
Navdeep Singh's user avatar
0 votes
2 answers
274 views

How to get details of a JSON Server response parsed into list/dictionary in Python

I am new to Python. I have been trying to parse the response sent as parameter in a function. I have been trying to convert a function from Perl to Python. The Perl block looks something like this: ...
Navdeep Singh's user avatar
0 votes
2 answers
166 views

How to translate from C# to VB.net

For a project written in VB.net I want to use the PropertyChangeNotifier class from this article, at least I'd like to try if it can help. Since the original class is written in C# I tried to ...
Nostromo's user avatar
  • 1,207
0 votes
0 answers
365 views

Can I change as400 data area with c#

I have been asked if I can turn a java program into c#. In the java program it reads and edits the data area //get the value for the sysavail dtaara String dtaara_path = "/QSYS.LIB/QGPL.LIB/SYSAVAIL....
CodingPenguin's user avatar
1 vote
1 answer
67 views

How to map a List to a Set while applying a method(Java to Kotlin code conversion)?

I have this code snippet in Java (this is an MCVE; actual code is more complex but has exact same issue): enum StatusEnum { A, B, C; } [...] final static Set<String> names = Arrays.asList(...
Alex R's user avatar
  • 11.4k

1
2 3 4 5 6