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

Converting 8 bit CRC function written in C to PHP

I am trying to convert a C function to PHP that does 8 bit CRC calculation. The original C code: uint8_t CRCCalc (uint8_t* pointer, uint16_t len) { uint8_t CRC = 0x00; uint16_t tmp; while(len > 0) { tmp = CRC << 1; …
Amitabh Kant
  • 145
  • 2
  • 6
2
votes
2 answers

Convert function template to function overload set

Assuming this is my library. And it is a very huge library: library.hpp template void function_name(usertype aaa) { } This is my main int main() { int x=3; function_name(x); double y=3.5; function_name(y); return…
barej
  • 1,330
  • 3
  • 25
  • 56
2
votes
2 answers

What is the equivalent of this snippet of Java code in C#?

I stumbled upon this website and I am trying to test the idea, I don't know Java so I tried converting it to C#. Everything seems trivial but I get some exception while executing the sample. I guess there must be something I am doing wrong here.…
Hossein
  • 24,202
  • 35
  • 119
  • 224
2
votes
1 answer

ADO.NET Data Services Query Interceptor - can anyone tell me the VB syntax of this C#?

I am pretty new to VB.NET - and I'm struggling to convert the signature of the method in the following code snippet. The Expression<...>> bit. Thanks in advance. [QueryInterceptor("Orders")] public Expression> OnQueryOrders() { …
Eric Nelson
  • 328
  • 1
  • 3
  • 9
2
votes
1 answer

Convert JavaScript code to VBScript code?

I have been given a task to convert code that is written in JavaScript over to VBScript. It is actually quite basic code and it is really just the syntax that needs to be converted. For example if (str == "string text") { foo = "foo"; } else { …
Michael Galos
  • 1,065
  • 3
  • 13
  • 27
2
votes
0 answers

Setting hessian threshold in android

How to set hessian threshold value for surf detectror in opencv library. In C++. I can set it as: int minHessian = 100; SurfFeatureDetector detector( minHessian );** But in android, surf detector is created as: FeatureDetector…
Mehul Thakkar
  • 12,440
  • 10
  • 52
  • 81
2
votes
1 answer

.NET to Java code transform

I know about IKVM.NET that converts Java bytecode to .NET CIL. Is there a tool that performs reverse conversion? either with or without support for translating WinForms to JavaFX/Swing GUIs. Thanks.
lmsasu
  • 7,459
  • 18
  • 79
  • 113
2
votes
3 answers

Convert code to C# from VB script

I am attempting to transition from VB script to C# with some legacy code that a colleague has. I cannot seem to determine how to transfer this line over. Any assistance would be helpful. Set objShell = CreateObject("wscript.shell") objShell.Run…
steventnorris
  • 5,656
  • 23
  • 93
  • 174
2
votes
1 answer

Matlab to OpenCV conversion - optimization?

I am converting Matlab code to OpenCV "C/cpp" code. And I have some doubts as below. A = [ 2; 10; 7; 1; 3; 6; 10; 10; 2; 10]; ind = [10; 5; 9; 2]; B is a submatrix of A ; Elements of matrix B are elements of A at locations specified in ind. B…
2vision2
  • 4,933
  • 16
  • 83
  • 164
2
votes
3 answers

How to translate RETRIEVAL_POINTERS_BUFFER structure to Delphi?

I'm working with Windows API and have to recreate a structure inside a Delphi record. I think I have it down, but this one was a little confusing and I need to make sure I did this right. Here's the original C++ structure: typedef struct…
Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
2
votes
6 answers

Need a little more help converting a CRC function from VB.NET to C#

I probably should have just put all this in one question, sorry for that :( Second error Ok, this should be the end of errors (hopefully): private static string getCRC(string input, bool appendDate) { string toEnc = string.Format("{0}{1}",…
Anders
  • 12,088
  • 34
  • 98
  • 146
2
votes
3 answers

How do you return 'not uint' in C#?

I have some code written in VB that reads as follows: Return (Not (crc32Result)) I am trying to convert it to C#, and this is what I have: return (!(crc32Result)); However I get a compiler error: Compiler Error Message: CS0023: Operator '!'…
Anders
  • 12,088
  • 34
  • 98
  • 146
2
votes
8 answers

Need some help converting VB.NET code to C#

I have a CRC class written in VB.NET. I need it in C#. I used an online converter to get me started, but I am getting some errors. byte[] buffer = new byte[BUFFER_SIZE]; iLookup = (crc32Result & 0xff) ^ buffer(i); On that line, the compiler gives…
Anders
  • 12,088
  • 34
  • 98
  • 146
2
votes
2 answers

Java class to objective-C class

i need to know what is the equivalent code for the code below in Objective-C public MyClass(int x, int y) { xCoOrdinate = x; yCoOrdinate = y; } public int getXCoOrdinate() { return xCoOrdinate; } public int…
Bobj-C
  • 5,276
  • 9
  • 47
  • 83
1
vote
1 answer

How to convert "-?" from Perl Regex to c# regex

I couldn't find any documentation on this symbol. What does "-?" mean when it precedes a parenthetical expression? Update - The example I saw is the integer and float regex constraints on the WebIDL specification. Here is a direct link to the…
smartcaveman
  • 41,281
  • 29
  • 127
  • 212