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
6 answers

translation of vb code to c#

I have some code from the 4guysfromrolla website which gives a tutorial on logging in as another user with admin credentials. I have most of it working but i'm having some trouble translating this part of the code from VB to C#. The part I'm having…
Stuart
  • 1,544
  • 5
  • 29
  • 45
-3
votes
1 answer

is there any way to convert this python code into php

what i need to accomplish is to reach a way in which i can convert the basics on any python code into php functions and conditions and so on def BitmapHoles(strArr): bitmap = {} for i in range(len(strArr)): for j in…
-3
votes
1 answer

How do I translate my code from C# to C++ for a CRC function?

I have the following code in C# to calculate a CRC and it works like I want it to. public byte crc_8(byte[] byteArray) { ushort reg_crc = 0; for(int i = 0; i
user9964422
  • 119
  • 3
  • 15
-3
votes
1 answer

Translating matlab into python

I'm trying to translate a matlab code, and I'm strugeling to translate this part of the code: [data;SS(ind-1:-1:ind-9)'] In the following context: SS = 1:288 year = 1:288 data = []; for ind = 10:length(year) data =…
PeCaDe
  • 277
  • 1
  • 8
  • 33
-3
votes
1 answer

LUA shows errors where there are not

I have managed to "translate" an entire code written in C to LUA, the source code permits to drive an 5110/3110 LCD and I have tried not to modify the code, but the port names, because I will run it on a router and use the LED as GPIO…
Fusseldieb
  • 1,324
  • 2
  • 19
  • 44
-3
votes
1 answer

iText Java to Objective-c using j2objc

Has anyone tried with success translating or porting iText Java source code to Objective-c? Is it possible at all ? If not, how can one programmatically sign PDFs on ios?
-3
votes
2 answers

Convert code from Objective-C to Swift: ADBannerView

I am trying to manually convert some code from Objective-C to Swift, but I only know how to use Swift. ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 50, 320, 50)]; [self.view…
-3
votes
2 answers

Translation Dispatcher.Invoke delegate from C# to VB.NET

Hi Was wondering wheher anyone could shed some light on translating the below code to vb.net. Any help will be greatly appreciated. void ShowNewPage() { Dispatcher.Invoke((Action)delegate { if (contentPresenter.Content != null) …
-4
votes
2 answers

I need some help to convert a little code from C to Java

I have a question and this one will be quick. I just need to convert this little snippet from C to Java. Here is the C code (source: cip-labs.net) Here is what I have done so far. I put $$$$ sings where I was super confused. float benford10(int…
ohGosh
  • 539
  • 1
  • 7
  • 10
-4
votes
1 answer

Can't translate foreach from C# to Java

I'm trying to translate a Boolean Retrieval Model search engine and can't translate this piece of code to Java. C#: foreach(KeyValuePair> p in documentCollection){} Java: for(Map> p :…
Rapharel
  • 33
  • 5
-5
votes
2 answers

How To Convert C++ loops into C style loops?

How can I translate a loop like the below one to C style? for (auto element : vector) { Do_Somethin(); }
Hazem Abaza
  • 331
  • 4
  • 21
-5
votes
2 answers

Exact C equivalent of Java Random.nextInt(int bound) method

I am working on a project that I port some Java code into C. Everything has gone well until now but I'm stucked at porting Random.nextInt(int bound) method into C. My Java code is: int arr[] = new int[100000]; Random r = new Random(0); for (int i =…
sanchop22
  • 2,729
  • 12
  • 43
  • 66
-10
votes
1 answer

translate lambda expression c# in c++

I have to normalize a list of values in range [-1;1]. I have found this code in c# but i don't know this language. Someone can help me to translate this in c++? List list = new List{-5,-4,-3,-2,-1,0,1,2,3,4,5}; double scaleMin = -1; //the…
1 2 3
25
26