View Full Version : Cross Language Scripting?
chaos
May 26th, 2007, 02:12
I was talking with one of my programmer friends the other day, and when I asked them how coded the frontend, he said they didn't use Windows forms (like with Visual C++). He said that instead, they write the backend in C, and then "wrap" it in Java so that the end visual element is cross browser. My question is, how would one do that? I am a real beginner with programming, but it's summer so what else am I gonna do? Are there functions that you use to call between the two languages?
inimino
May 26th, 2007, 02:48
"cross browser"? Did you mean cross-platform? Is this an applet or a desktop application?
If you want to learn programming I recommend starting with a specific project in mind. I think the most interesting stuff these days is happening on the Web.
chaos
May 26th, 2007, 02:56
My bad :) All of his projects are desktop apps. I don't have a project in mind for using this, I was just wondering how it worked. The idea of calling code from a different language seems to be very big in modern programming: as I recall Bungie's last video game Halo 2 was written across Java, C++, and a few others. All of my code always winds up in the boring DOS prompt unless it's PHP which I can serve up as pretty HTML. I could use the Visual studio to make my code more pretty, but then I always wanted to know what exactly was making the things show up. Too many languages, but I am getting bored already so I need a summer project. I am thinking about cleaning up the code for the 404_checker you helped me with a while ago. Could you explain to me how I would go about splitting a string of an unknown length (even) into groups of two? This would be a critical part of mapping my own character set. And an even better question: how did you propose I map the 81 possible characters for a url onto a base 10 or even base 16 system? I suppose I could strip the 0's to make it base 9, and then it would work better I suppose.
inimino
May 26th, 2007, 04:27
My bad :) All of his projects are desktop apps. I don't have a project in mind for using this, I was just wondering how it worked. The idea of calling code from a different language seems to be very big in modern programming: as I recall Bungie's last video game Halo 2 was written across Java, C++, and a few others.
When C or C++ code is compiled, the compiled machine code can be called from other languages by using standard conventions for calling functions. A library written in C can be "wrapped" for use by another language like Java or PHP. In Java for example you might provide classes that allow a programmer to use the functionality of a library that was actually written in C. Useful APIs often have language bindings for multiple programming languages.
I am thinking about cleaning up the code for the 404_checker you helped me with a while ago. Could you explain to me how I would go about splitting a string of an unknown length (even) into groups of two?
I have forgotten the details of that thread but I seem to recall you were fairly close to getting it right. Perhaps you can dig up that thread and resurrect it. By "split a string" you mean for example getting "ab" and "cd" from "abcd"? If so you just check the length of the string, divide that by two, and take that many characters from the beginning of the string.
This would be a critical part of mapping my own character set. And an even better question: how did you propose I map the 81 possible characters for a url onto a base 10 or even base 16 system? I suppose I could strip the 0's to make it base 9, and then it would work better I suppose.
Base 9 lacks the digit 9, not the digit 0. ;)
If you have 81 characters, you can simply think of strings from that character set as being representations of integers in base 81. So if your first two characters are 'x' and 'y', with 'x' as zero and 'y' as one, then the string "yx" represents 81. In base ten, we use '0' as zero and '1' as one, and "10" represents 10.
In that other thread I think I suggested a simple algorithm for converting both ways between PHP number variables and strings in an arbitrary base defined by a string of valid characters. (For example, where base ten would be defined by the string "0123456789" and typical hex notation by "0123456789ABCDEF".)
You can even think of entire texts as representing large numbers, and this turns out to be a useful way of thinking about a lot of problems. For example, consider all possible distinct texts composed of 1024 or fewer characters, all of which are among the 95 printable ASCII characters. How many such texts are there? How many are valid HTML documents? How many are Shakespearean sonnets? This is how you solve things like that question about the monkeys and typewriters, and these kinds of questions are relevant in compression and cryptography as well as in the design of data formats like UTF-8, or HTML.
absolethe
May 30th, 2007, 22:48
I've wondered about that before as well (more than one language). Thank you!
miketyson986
October 26th, 2011, 11:54
You can even think of entire texts as representing large numbers, and this turns out to be a useful way of thinking about a lot of problems.
ccda certification (http://www.testkings.mobi/CCDA-guide.html) / ITIL V3 Certification (http://www.testkings.mobi/ITIL-exam.html) / mcsa exams (http://www.testkings.mobi/MCSA-guide.html) / Oracle certifications (http://www.testkings.mobi/Oracle-certification.html) / cisco test answers (http://www.testkings.mobi/Cisco-certification.html) / checkpoint ccsa (http://www.testkings.mobi/CCSA-guide.html) / security+ certification (http://www.testkings.mobi/Security-plus-guide.html) / PMI certifications (http://www.testkings.mobi/PMI-certification.html) /
vBulletin® v3.6.8, Copyright ©2000-2012, Jelsoft Enterprises Ltd.