Author

Topic: [WTB] Programming Reference Material (See details inside) (Read 1179 times)

sr. member
Activity: 440
Merit: 251
Here's the command line output from actually compiling AND running OT in PHP mode:

http://pastebin.com/cwuS97n6
sr. member
Activity: 440
Merit: 251

Hello, I just noticed this thread...

1) There is no need to write an OT server, as the OT server is already written (it's in the transaction folder.)  Read the instructions that come with OT, they will show you how to RUN the server.

2) If you wish to play with OT, I recommend building it in Java mode (see the instructions) and then use the Moneychanger GUI.

3) If you want to write your own GUI, you can copy what Moneychanger does.  For exact instructions, see this link: https://github.com/FellowTraveler/Open-Transactions/wiki/Use-Cases
(Now you have instructions AND sample code.)

FYI, you don't have to learn the internal objects to use OT, just call the API.

newbie
Activity: 35
Merit: 0
Quote
-- Open Transactions is open-source, written in C++, object-oriented, and includes a high-level API in Java, Ruby, Python, C, D, C++, Obj-C, C#, Lisp, Perl, PHP, and Tcl.

Once you compile it you should be able to use it in the language of your choice.  For python you would "import namespace" for C# you will need to add the the DLL you built to the references then use the "using namespace".  PHP would add it to the global namespace I think.  C/D/C++/Obj-C you would need to copy the headers and library and link against it.  That is if you intend to use their implementation of the protocol rather then starting from scratch.

I see. I don't know how I would start from scratch as this project looks way more complex than I can just "jump into." I believe I would be able to write a client okay after about 192 hours of playing around, but with the server I have no idea. I've never done any formal networking course work or programmed on the network stack.

How I think a server works:

while (1)
wait for connection

I guess I just need to dive in at this point because the more specific abstract issues come up, the less that reference material .

And I have no idea of where to get started making daemons or windows services.

Also thanks for the discussion everyone.
member
Activity: 70
Merit: 10
if (pContract = (*ii).second) // if not null

When I looked at that piece of code it made me go WTF, but essentially it assigns a value to a pointer and if the pointer isn't null it executes the code.

You have to break it down.

- First (*ii) is evaluated.  I think that is transforming the iterator (integer?) into a pointer to an object.  My C++ is rusty.
- Then the expression (*ii).second returns the "second" member from the object.
- It gets assigned to pContract.
- The if statement will only execute if pContract is not 0 which is also the "null" value in C++

This works because you can do expressions like x = y = z where x and y get the value of z.  The value just gets passed to the left.

Quote
-- Open Transactions is open-source, written in C++, object-oriented, and includes a high-level API in Java, Ruby, Python, C, D, C++, Obj-C, C#, Lisp, Perl, PHP, and Tcl.

Once you compile it you should be able to use it in the language of your choice.  For python you would "import namespace" for C# you will need to add the the DLL you built to the references then use the "using namespace".  PHP would add it to the global namespace I think.  C/D/C++/Obj-C you would need to copy the headers and library and link against it.  That is if you intend to use their implementation of the protocol rather then starting from scratch.
newbie
Activity: 35
Merit: 0
I already know C++, C#, and a little Python and C. I'm a CS major at my university, I'm just struggling with third party libraries and how to use them.

Which libraries?  Or more specifically what do you want to do?

"Server Side Requests" can be either with a web server or writing your own implementation from scratch.

I'm attempting to write a server and client for Open Transactions.

https://github.com/FellowTraveler/Open-Transactions/

I can get the general point to most of the code as I have been taking notes on it little by little.

https://github.com/Romoku/OT-Documentation

It's just hard trying to figure out how his code works as he uses some unorthodox methods (at least that I have never encountered) such as:

if (pContract = (*ii).second) // if not null

When I looked at that piece of code it made me go WTF, but essentially it assigns a value to a pointer and if the pointer isn't null it executes the code.

I don't know if that is the "right" way of doing it or if it will cause issues down the line.
member
Activity: 70
Merit: 10
I already know C++, C#, and a little Python and C. I'm a CS major at my university, I'm just struggling with third party libraries and how to use them.

Which libraries?  Or more specifically what do you want to do?

"Server Side Requests" can be either with a web server or writing your own implementation from scratch.
newbie
Activity: 35
Merit: 0
Learn a language.  You can't start writing scientific papers without first knowing english.

I would recommend python.

- Comes with a terminal/command prompt that allows you to evaluate expressions.
- Lots of shortcuts to make life easier along with a strong set of built in libraries.
- The python community within bitcoin is fairly strong so you will have a lot of code examples.
- The module interface is fairly easy to understand compared to say the imports in C.  Also tons of libraries that are easy to use and install via easy_install or pip.

I would recommend learning C at some point because it is fairly important to know and understand.  The problem with C and C++ is implementing 3rd party libs are funky at best.  The amount of pain needed to build a bunch of libraries for a programs dependencies is agonizing.  Also development on windows with C/C++ is god aweful.  Some programs/libraries will only build on GCC and others only MSVC.  >_<

Erlang will leave you frustrated but it is an interesting language.  Functional languages are nifty but the library support is lacking and often times the syntax is extremely verbose and frustrating.

C# is ok.  Especially if you start out using linq as it will make life easier.  Only downside is you are limited to windows only then unless you take special care to be compatible with mono.



I already know C++, C#, and a little Python and C. I'm a CS major at my university, I'm just struggling with third party libraries and how to use them.
member
Activity: 70
Merit: 10
Learn a language.  You can't start writing scientific papers without first knowing english.

I would recommend python.

- Comes with a terminal/command prompt that allows you to evaluate expressions.
- Lots of shortcuts to make life easier along with a strong set of built in libraries.
- The python community within bitcoin is fairly strong so you will have a lot of code examples.
- The module interface is fairly easy to understand compared to say the imports in C.  Also tons of libraries that are easy to use and install via easy_install or pip.

I would recommend learning C at some point because it is fairly important to know and understand.  The problem with C and C++ is implementing 3rd party libs are funky at best.  The amount of pain needed to build a bunch of libraries for a programs dependencies is agonizing.  Also development on windows with C/C++ is god aweful.  Some programs/libraries will only build on GCC and others only MSVC.  >_<

Erlang will leave you frustrated but it is an interesting language.  Functional languages are nifty but the library support is lacking and often times the syntax is extremely verbose and frustrating.

C# is ok.  Especially if you start out using linq as it will make life easier.  Only downside is you are limited to windows only then unless you take special care to be compatible with mono.

newbie
Activity: 58
Merit: 0
Hey guy, check PM please.
full member
Activity: 168
Merit: 100
The OP mentioned that he is not very experienced yet in programming so telling him to find bugs in someone's code is not the greatest of advice. If either of you two are programmers, just think back of the time when you were first starting into the most basic of programming. You were most likely not even able to find your own mistakes, let alone others. Even with the debugger it can be a pain for amateur developers.

To the OP, there are plenty of tutorials online for pretty much every language and most third-party libraries. If you are having problems with the tutorials, or your own little projects, check out programmingforums.org. This is a site I used to read up on quite frequently back when I first started programming.

C++ was my first language aside from PHP here and there with a buddy of mine when I was still in high school. I recommend C++ for newbies if you tend to quickly catch on to things, but even if you don't you can just trial and error until you understand (i suppose). The reason why I suggest C++ as a first language is that it is a very good "foundation" language and once you get to be moderate with C++ you shouldn't have much issue at all getting into other languages. C++ is also object oriented which will give you a good understanding of how to properly develop clean, readable code which is a plus if you plan on later working on collaborated projects. If you were interested in Java, I would say start there prior to C++ for a good foundation on the basics of programming as it is also OO and much easier to get into than C++ though it is not quite as powerful.

In the end, it is completely up to you and which style you like best, what you want to do, etc. All I have to say is don't waste your money on books when you've got the entire resources of the interweb at your disposal. I tried reading books when I was first starting to learn and it taught me nothing I didn't already know from tutorials and personal experience. Since then I've done work in range from chat clients/servers, smartphone development(both games and apps), simple 3d worlds for PC, etc. I've also created some dummy "viruses" and other fun stuff used for my own personal education on process injection, services and whatever else.

Hope this helps in some way.
hero member
Activity: 588
Merit: 500
Agreed. You need experience, not more "theory." Go read some code. For some good experience, find a project you're interested in, find a simple bug (in their bug tracker!) and fix it.
newbie
Activity: 29
Merit: 0
Save your money, go play with an open source project and try to fix bugs. You learn more about coding by actually coding, once you have that experience on a real project, then supplement it with extra reading.

The best topics on this are free online, this is one of my favorites: http://www.aosabook.org/en/index.html
newbie
Activity: 35
Merit: 0
Hello all,

I would be interested in buying Ebooks and stuff for programming using third party libraries and such. I am finding it difficult to get into other people's code as the amount of actual programming experience I have (outside of theory) is low.

I would be interested in the core concepts on how to program with libraries such as OpenSSL, ZeroMQ, RabbitMQ, Server side development (how to write server side handlers to process requests and such), Postgresql, Reddis, CouchDB, Nginx, Mongrel2, and other such libraries (and learn how to write wrappers and APIs).

The languages I am currently interested in are C/C++/C#, Python, Perl, and Erlang (I'm open for suggestions).

Other general advice would be appreciated and I'll toss BTC 0.02 for good comments.

Post an offer or send a message,


-Romoku
Jump to: