Thrift (Facebook API) newbie question

Posted on 2011-09-12
Last Modified: 2012-05-12
Hi all,

I'm about to implement a TCP/IP communication infrastructure for communicating between C# & C++ applications on windows platform.
I considered implementing this from scratch, but then I stumbled upon Thrift (Facebook communication API), and from what I read it looks quite nice.
However, after downloading it and attempting to implement a basic sample, I feel a bit at loss...

Any help would be appreciated.
Thanks in advance.
Question by:AUROS
  • 3
  • 3

Accepted Solution

AUROS earned 0 total points
ID: 36522787
Issue is no issue...
When creating thrift files using VS2010 the thrift compiler didn't like them, and generated empty output.
When creating the same files using VS2008 or notepad, all is good...
LVL 40

Expert Comment

ID: 36525699
Not sure I follow you solution. The thrift compiler doesn't use Visual studio to generate the thrift bindings from its IDL.

Glad you got it working but just slightly concerned the solution you've accepted might be a little misleading.

Author Comment

ID: 36525888
I was simply using VS to write the .thrift files.
Apparently, VS2010 saves the files as UTF8, which the compiler treats as empty files (with no errors). VS2008 saves the files as ASCII by default, which works fine for the Thrift compiler. So in VS2010 you simply have to "Save As" each thrift file, and change it's encoding - haven't found anything better (except for not using VS2010).
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

LVL 40

Expert Comment

ID: 36526659
Ok, that makes a little more sense.

You should consider using Notepad++. I have a syntax highlighting file for thrift I can share with you if you do :)

Author Comment

ID: 36527605
If you can send it, that would be great!
LVL 40

Expert Comment

ID: 36528097
To use add the <UserLang> node to the <NotepadPlus> node of your C:\Users\[USERNAME]\AppData\Roaming\Notepad++\userDefineLang.xml file.

It's possibly a little out of date but it should cover most things and you can always add to it as you wish.
    <UserLang name="thrift" ext="thrift">
            <Global caseIgnored="no" />
            <TreatAsSymbol comment="yes" commentLine="yes" />
            <Prefix words1="no" words2="no" words3="no" words4="no" />
            <Keywords name="Delimiters">&quot;00&quot;00</Keywords>
            <Keywords name="Folder+"></Keywords>
            <Keywords name="Folder-"></Keywords>
            <Keywords name="Operators">( ) , : { } &lt; &gt;</Keywords>
            <Keywords name="Comment">1/* 2*/ 0// 0#</Keywords>
            <Keywords name="Words1">final namespace throws include required extend oneway</Keywords>
            <Keywords name="Words2">enum struct service exception</Keywords>
            <Keywords name="Words3">list i64 i32 i16 double string bool void map set binary</Keywords>
            <Keywords name="Words4"></Keywords>
            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="KEYWORD1" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="KEYWORD2" styleID="6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="KEYWORD3" styleID="7" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="KEYWORD4" styleID="8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT" styleID="1" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="NUMBER" styleID="4" fgColor="804000" bgColor="FFFFFF" fontName="" fontStyle="1" />
            <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER1" styleID="14" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />

Open in new window


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question! 4 39
defining NULL or 0 10 44
The control parameters are not inputing the value when displaying in a report viewer 13 26
Name Space error VS2015 1 25
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question