Questions tagged [code-translation]

For questions regarding the translation of code from one programming language to another. NOTE that asking to have your code translated is not suitable for Stack Overflow.

Translating code from one programming language to another can be as tricky as translating between natural languages. This is due to the fact that languages implement different sets of features and are often designed with very different goals. What comes as a built-in function in one language may have to be developed from scratch (or at least require a library) to achieve the same functionality in another.

An appropriately formed question might be "How do I translate this statement", or "What are the differences between these two statements in different languages". It is not appropriate to ask for your code to be translated.

388 questions
2
votes
2 answers

Help me move from prototype to jquery

window.onload = function() { $A($('draggables').getElementsByTagName('p')).each( function(item) { new Draggable( item, { revert: true } ); } ); …
eleon
  • 23
  • 7
2
votes
1 answer

How do I reference Classes in Swift?

As far as iOS languages go I really only know Swift, but I'm trying to learn how to translate from Objective C. I'm doing ok at it (helps that I know C#) and using this as a guide for translation but I'm getting stumped at certain points that aren't…
Nathan McKaskle
  • 2,926
  • 12
  • 55
  • 93
2
votes
3 answers

Any progress with programming Java for iOS?

After seeing this question I realized that now it's around 5 years later, and I kept hearing that translators are getting better and better. Is there CURRENTLY really any professional way of developing in java for iOS mobile systems? Thanks
Vlad Ilie
  • 1,389
  • 1
  • 13
  • 37
2
votes
1 answer

U combinator on a fibonacci : how would you translate this code to python?

I am trying to learn about combinators and I am having trouble understand the example given at (Y overriding self-application). I think I am beginning to grasp the concept but I am still far from understanding. I would like to translate the…
JPCosta
  • 1,237
  • 10
  • 15
2
votes
0 answers

Equivalent 'cubic' method for interp3 MATLAB in python

I am very frustrated because I cannot find a solution: I have to do a 3D interpolation in python using a cubic method. The MATLAB equivalent is Vi = interp3(x,y,z,V,xi,yi,zi,'cubic') where x, y, z are 3D arrays in [N x N x N] V is a 3D array in [N…
overcomer
  • 2,244
  • 3
  • 26
  • 39
2
votes
1 answer

Transpiling dynamic ES6 System.import to ES5 (amd or other)

I'm stuck with dynamic requering es6 modules by invoking them through: System.import('SOME_PATH').then(function (MODULE_FROM_SOME_PATH) {}); It works well with es6-module-loader and babel runtime compilation in browser, but when i want to…
Erik
  • 23
  • 4
2
votes
1 answer

Translating new C++ to old C++

C++11 and C++14 introduce a lot of new features that make programmers' lives easier. However, in various environments (e.g. CUDA), support for the most modern C++ features may be weak or nonexistent. Many of these features (e.g. auto, decltype,…
user1084944
2
votes
1 answer

Re-writing simple jQuery into pure JavaScript

I'm building a JavaScript plugin which will bolt onto other websites. The whole thing is written with pure JS but there's one bit I haven't been able to get away from jQuery with: var key = "some_key"; var selector = "#my_input,…
Adam Nicholson
  • 320
  • 3
  • 10
2
votes
1 answer

Language Design issues with including libraries

I'm writing a compiler that will compile a language I made (called SLang (currently those files are a few pushes behind, not that its important)) into C++ (eventually ELF, Mach-O, and PE but that will come later). This is my first compiler, and was…
DTSCode
  • 1,062
  • 9
  • 24
2
votes
1 answer

Inserting extra lines of code using Antlr4

The target is to insert codes to monitor the entry and exit of Java synchronized block. i.e. enteringSync(); synchronized(lockObj){ enteredSync(); ... leavingSync(); } leftSync(); My original thought was to implement the enter/exit listener…
2
votes
1 answer

Translate ActionScript 3 code I've wrote to C#

recently I have discovered C#, which is really what I want. Before C# I was coding with AS3. I've recoded all my old program using C# but I am blocked with this : public function Envoie_Serveur(param1:String) : void { var _loc_2:* =…
Knoweldges
  • 72
  • 8
2
votes
3 answers

use IEnumertor or IEnumerable c# interface?

I am porting some Java code to C# and my question is One of my Java class declarations looks like this: private class PseudoEnumeration implements Enumeration Should this be translated to private class PseudoEnumeration : IEnumerator or private…
avgn
  • 982
  • 6
  • 19
2
votes
1 answer

need help translating a code snippet from java to C# equivalent

Here's the code snippet I'd like to translate from Java to C#. I'm not sure what's causing the error but I've never used ArrayLists and vectors before. Thanks in advance!! //Java class definitions, constructors, fields, methods etc here. //sphbasis…
avgn
  • 982
  • 6
  • 19
2
votes
2 answers

Encryption Algorithm from PHP to Ruby (Vignere variant)

I am a bit stuck with this. I have to interface with an api that uses a version of an encryption algorithm that they seem to have ripped from Typo3 written by Ari Kuorikoski. I need to create a ruby lib to interface with their api, so have to port…
J. Martin
  • 1,683
  • 2
  • 17
  • 33
2
votes
1 answer

Given this same piece of code, why is the python version 100x+ slower than C?

I'm doing project euler Q14. Which starting number, under one million, produces the longest collatz chain? I was very surprised to see someone who could get a result in 0.7sec. More surprised when I see it is merely a naive brute force solution. I…
Sam
  • 487
  • 1
  • 6
  • 9