<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Aniszczyk&#039;s (zx) diatribe &#187; facebook</title>
	<atom:link href="http://aniszczyk.org/tag/facebook/feed/" rel="self" type="application/rss+xml" />
	<link>http://aniszczyk.org</link>
	<description>work. life. open source. diatribes.</description>
	<lastBuildDate>Tue, 06 Jul 2010 13:25:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>An Eclipse-based Facebook Application (Part 2)</title>
		<link>http://aniszczyk.org/2008/04/29/an-eclipse-based-facebook-application-part-2/</link>
		<comments>http://aniszczyk.org/2008/04/29/an-eclipse-based-facebook-application-part-2/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 16:45:00 +0000</pubDate>
		<dc:creator>Chris Aniszczyk</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[pde]]></category>

		<guid isPermaLink="false">http://aniszczyk.org/2008/04/29/an-eclipse-based-facebook-application-part-2/</guid>
		<description><![CDATA[Since we have a plug-in available to exercise the Facebook API (see Part 1), the next step is to create a &#8216;org.eclipse.facebook.ui&#8217; plug-in that will exercise that API. What I generally do when testing some new code in Eclipse is to create a simple view. In this case, I&#8217;ll create a stub view with a [...]]]></description>
			<content:encoded><![CDATA[<p>Since we have a plug-in available to exercise the Facebook API (see <a href="http://mea-bloga.blogspot.com/2008/04/eclipse-based-facebook-application-part.html">Part 1</a>), the next step is to create a &#8216;org.eclipse.facebook.ui&#8217; plug-in that will exercise that API. What I generally do when testing some new code in Eclipse is to create a simple view. In this case, I&#8217;ll create a stub view with a hyperlink to launch some Facebook login wizard (along with some other test hyperlinks):</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_2017w9FY4Do/SBdESENHDyI/AAAAAAAAAhc/j5w5WOOwucM/s1600-h/fig2.png"><img style="cursor: pointer;" src="http://bp0.blogger.com/_2017w9FY4Do/SBdESENHDyI/AAAAAAAAAhc/j5w5WOOwucM/s320/fig2.png" alt="" id="BLOGGER_PHOTO_ID_5194695772352220962" border="0" /></a></p>
<p>Now that I have the basic code infrastructure in place, let&#8217;s get our Web 2.0 on by using that Facebook API! In Eclipse land, to take advantage of another plug-ins&#8217; classes, you need to express a dependency on it. So in order for me to use the Facebook API plug-in I created in Part 1, we need to depend on it. We can do this in the plug-in manifest editor by going to the dependencies page and adding a dependency for the &#8216;com.facebook.api&#8217; plug-in:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_2017w9FY4Do/SBdDgUNHDxI/AAAAAAAAAhU/9W33Og4i1Xc/s1600-h/fig1.png"><img style="cursor: pointer;" src="http://bp1.blogger.com/_2017w9FY4Do/SBdDgUNHDxI/AAAAAAAAAhU/9W33Og4i1Xc/s320/fig1.png" alt="" id="BLOGGER_PHOTO_ID_5194694917653729042" border="0" /></a></p>
<p>After reading the Facebook API in detail&#8230; it seems the API for logging in is straightforward albeit a bit <a href="http://developers.facebook.com/documentation.php?doc=login_desktop">tricky</a> for a deskop-based application. In essence, you have to point to a special URL given to you by Facebook to login&#8230; once a user logs in, you need to capture a token that you use to create a REST client for Facebook API access. Ok, translating this into Eclipse terms, I figure all I need is a popup dialog and an SWT <a href="http://www.eclipse.org/swt/snippets/#browser">Browser</a> widget with a clever listener. So here it is:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_2017w9FY4Do/SBdF9kNHDzI/AAAAAAAAAhk/QhbxyiAij8g/s1600-h/fig3.png"><img style="cursor: pointer;" src="http://bp2.blogger.com/_2017w9FY4Do/SBdF9kNHDzI/AAAAAAAAAhk/QhbxyiAij8g/s320/fig3.png" alt="" id="BLOGGER_PHOTO_ID_5194697619188158258" border="0" /></a></p>
<p>All this code does is create an embedded browser within a popup dialog and fishes for a particular authentication token from Facebook. If it finds the particular token, it will create a session with Facebook, if not, it will keep the dialog open until the user properly authenticates.</p>
<p>I was initially having trouble logging in to the service because I was stupid in how I was parsing the authentication token. I didn&#8217;t solve the problem until I enabled some tracing information. One interesting way to allow tracing for your Eclipse-based applications is to use the Platform debug <a href="http://wiki.eclipse.org/FAQ_How_do_I_use_the_platform_debug_tracing_facility%3F">facilities.</a></p>
<p>The basic gist is to create a .options file in the root of your plug-in. Here is how the &#8216;org.eclipse.osgi&#8217; plug-in .options file looks like:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_2017w9FY4Do/SBdIf0NHD0I/AAAAAAAAAhs/JfLW0s9LuLQ/s1600-h/fig4.png"><img style="cursor: pointer;" src="http://bp3.blogger.com/_2017w9FY4Do/SBdIf0NHD0I/AAAAAAAAAhs/JfLW0s9LuLQ/s320/fig4.png" alt="" id="BLOGGER_PHOTO_ID_5194700406621933378" border="0" /></a></p>
<p>Pretty simple right&#8230;? Now, when you go to launch Eclipse applications, there is a tracing tab that allows you to tweak this options on and off to see what type of tracing information you would like:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_2017w9FY4Do/SBdIskNHD1I/AAAAAAAAAh0/k4nqqQBNSqQ/s1600-h/fig5.png"><img style="cursor: pointer;" src="http://bp2.blogger.com/_2017w9FY4Do/SBdIskNHD1I/AAAAAAAAAh0/k4nqqQBNSqQ/s320/fig5.png" alt="" id="BLOGGER_PHOTO_ID_5194700625665265490" border="0" /></a></p>
<p>I basically enabled this tracing ability within the facebook plug-in:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_2017w9FY4Do/SBdJf0NHD2I/AAAAAAAAAh8/mmH9FgpX6nA/s1600-h/fig6.png"><img style="cursor: pointer;" src="http://bp3.blogger.com/_2017w9FY4Do/SBdJf0NHD2I/AAAAAAAAAh8/mmH9FgpX6nA/s320/fig6.png" alt="" id="BLOGGER_PHOTO_ID_5194701506133561186" border="0" /></a></p>
<p>I then peaked at the console after I logged into see some tracing output:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_2017w9FY4Do/SBdJpUNHD3I/AAAAAAAAAiE/uviy-L9CBEA/s1600-h/fig7.png"><img style="cursor: pointer;" src="http://bp1.blogger.com/_2017w9FY4Do/SBdJpUNHD3I/AAAAAAAAAiE/uviy-L9CBEA/s320/fig7.png" alt="" id="BLOGGER_PHOTO_ID_5194701669342318450" border="0" /></a></p>
<p>So there, now I have a simple little framework to enable configurable tracing within my Eclipse-based applications.</p>
<p>That&#8217;s it for Part 2. In Part 3, we will cover things like separating core code from user interface code, <a href="http://www.eclipse.org/articles/Article-Forms/article.html">Eclipse Forms</a> and amongst whatever else pops up in my head.</p>
<p><span style="font-weight: bold;">Lessons Learned</span>
<ul>
<li>Start simple and iterate as you make progress</li>
<li>A simple view provides a good way to test code</li>
<li>Trace early, trace often</li>
<li>Platform debug tracing provides a simple way to enable configurable development time debugging</li>
</ul>
<p>Thanks for listening.</p>
]]></content:encoded>
			<wfw:commentRss>http://aniszczyk.org/2008/04/29/an-eclipse-based-facebook-application-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Eclipse-based Facebook Application (Part 1)</title>
		<link>http://aniszczyk.org/2008/04/21/an-eclipse-based-facebook-application-part-1/</link>
		<comments>http://aniszczyk.org/2008/04/21/an-eclipse-based-facebook-application-part-1/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 15:08:00 +0000</pubDate>
		<dc:creator>Chris Aniszczyk</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[pde]]></category>

		<guid isPermaLink="false">http://aniszczyk.org/2008/04/21/an-eclipse-based-facebook-application-part-1/</guid>
		<description><![CDATA[So, the first thing I do when I write an Eclipse-based application, or any application for that matter is set a quick baseline of what I want done. For my first milestone, I decided I simply wanted to be able to log into Facebook. I figured, this would be a good start&#8230; it would require [...]]]></description>
			<content:encoded><![CDATA[<p>So, the first thing I do when I write an Eclipse-based application, or any application for that matter is set a quick baseline of what I want done. For my first milestone, I decided I simply wanted to be able to log into Facebook. I figured, this would be a good start&#8230; it would require me to use the Facebook API in some fashion. This would force me to create a plug-in for the Facebook API which I would reuse when I started to do things like update my status from Eclipse. So my first stop was to look at the Facebook Java APIs since that would make life easier for me.</p>
<p>I found a cool project hosted at <a href="http://code.google.com">Google Code</a> that contained some <a href="http://code.google.com/p/facebook-java-api/">Java APIs</a>. The only problem was that it seemed you needed a million jars to use these APIs. As an Eclipse plug-in afficiandio, I knew how to handle this&#8230; I&#8217;ll create a new plug-in! I downloaded all the jars and then launched the &#8216;New Plug-in Project from Exisiting Jars&#8217; wizard which allows me to quickly create a plug-in by pointing to those existing jars.</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_2017w9FY4Do/SAxZ1BI6lSI/AAAAAAAAAfk/PsViRolRH1o/s1600-h/fig1.png"><img style="cursor: pointer;" src="http://bp0.blogger.com/_2017w9FY4Do/SAxZ1BI6lSI/AAAAAAAAAfk/PsViRolRH1o/s320/fig1.png" alt="" id="BLOGGER_PHOTO_ID_5191623237825107234" border="0" /></a></p>
<p>To give my newly created plug-in some polish, I&#8217;ve decided to do a couple things. First, I&#8217;ll only export the packages that my consumers will need to work with the Facebook API:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_2017w9FY4Do/SAxZ6hI6lTI/AAAAAAAAAfs/f5s8xC41iHg/s1600-h/fig2.png"><img style="cursor:pointer; cursor:hand;" src="http://bp2.blogger.com/_2017w9FY4Do/SAxZ6hI6lTI/AAAAAAAAAfs/f5s8xC41iHg/s320/fig2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5191623332314387762" /></a></p>
<p>In the Eclipse and <a href="http://www.osgi.org">OSGi</a> world, Java packages are the unit of modularity. My consumers shouldn&#8217;t care about the other packages and I don&#8217;t feel like supporting those packages downstream so I won&#8217;t expose them. Since I don&#8217;t expose them, my consumers won&#8217;t be able to use any classes from those non-exported packages. This provides a nice way to keep your API really &#8220;internal.&#8221; For my next magic trick, I will make sure to set the <a href="http://wiki.eclipse.org/index.php/Execution_Environments">Bundle-RequiredExecutionEnvironment</a> (BREE) for my plug-in to J2SE-1.5:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_2017w9FY4Do/SAxZ_RI6lUI/AAAAAAAAAf0/Ykh49m4Uoqc/s1600-h/fig3.png"><img style="cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_2017w9FY4Do/SAxZ_RI6lUI/AAAAAAAAAf0/Ykh49m4Uoqc/s320/fig3.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5191623413918766402" /></a></p>
<p>BREEs are a way of telling Eclipse and OSGi that your plug-in at a minimum, requires Java 5.0 to run. This is cool because the Eclipse runtime won&#8217;t activate your plug-in if it&#8217;s running on Java 1.4&#8230; only Java 5.0 and above. The runtime will also give a message out stating that the plug-in can&#8217;t activate because the mininum BREE hasn&#8217;t been yet&#8230; also cool!</p>
<p>So with my new Facebook API plug-in setup and polished to my liking, we can go and start exercising that API in interesting ways. The first way will be finding a way to log-in to Facebook and that will be discussed in Part 2.</p>
<p></insert></insert></insert>
<ul>
<li style="font-weight: bold;"><insert picture="" here=""><insert picture="" here=""><insert picture="" here="">Lessons Learned</insert></insert></insert></li>
<ul>
<li><insert picture="" here=""><insert picture="" here=""><insert picture="" here="">Start simple and iterate as you make progress</insert></insert></insert></li>
</ul>
<ul>
<li><insert picture="" here=""><insert picture="" here=""><insert picture="" here="">Use the &#8216;New Plug-in Project From Existing Jars&#8217; wizard to package your dependencies</insert></insert></insert></li>
</ul>
<ul>
<li><insert picture="" here=""><insert picture="" here=""><insert picture="" here="">Don&#8217;t forget to set BREEs, they can save your consumers some heartache!</insert></insert></insert></li>
</ul>
<ul>
<li><insert picture="" here=""><insert picture="" here=""><insert picture="" here="">Export packages from plug-ins that consumers are only interested in</insert></insert></insert></li>
</ul>
</ul>
<p><insert picture="" here=""><insert picture="" here=""><insert picture="" here=""><br />If you like this type of material, let me know. If there&#8217;s a good response, that&#8217;s usually motivation for me to do things faster.</insert></insert></insert></p>
]]></content:encoded>
			<wfw:commentRss>http://aniszczyk.org/2008/04/21/an-eclipse-based-facebook-application-part-1/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Facebook on a Plane</title>
		<link>http://aniszczyk.org/2008/04/21/facebook-on-a-plane/</link>
		<comments>http://aniszczyk.org/2008/04/21/facebook-on-a-plane/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 08:59:00 +0000</pubDate>
		<dc:creator>Chris Aniszczyk</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://aniszczyk.org/2008/04/21/facebook-on-a-plane/</guid>
		<description><![CDATA[So, for the past couple of weeks, I&#8217;ve been doing some hacking while being on long airplane flights. Usually, I hack Eclipse-related things that somehow end up in milestone releases, but I figured I needed to enlighten myself with something new and refreshing. For inspiration, I went and talked to an old college buddy of [...]]]></description>
			<content:encoded><![CDATA[<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_2017w9FY4Do/SAxY-BI6lRI/AAAAAAAAAfc/ToNcmCkveuM/s1600-h/fblogo.jpg"><img style="cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_2017w9FY4Do/SAxY-BI6lRI/AAAAAAAAAfc/ToNcmCkveuM/s320/fblogo.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5191622292932302098" /></a></p>
<p>So, for the past couple of weeks, I&#8217;ve been doing some hacking while being on long airplane flights. Usually, I hack Eclipse-related things that somehow end up in milestone releases, but I figured I needed to enlighten myself with something new and refreshing. </p>
<p>For inspiration, I went and talked to an old college buddy of mine I trust. I happen to trust crazy people who preferred to do back-tracing solvers in PHP instead of LISP or C++ given a choice, but that&#8217;s another story (those were the days). This college buddy of mine ended up drinking the web 2.0 koolaid recently&#8230; he told me I should be writing <a href="http://www.facebook.com">Facebook</a> applications (because Facebook is the greatest thing ever). He also called me an <a href="http://www.urbandictionary.com/define.php?term=old+fart">old fart</a> for not writing Web 2.0 applications. Since I trust him and I don&#8217;t want to be an old fart, I took the bait and said OK, I&#8217;ll give this stuff a try at least.</p>
<p>So I went on my quest to write a facebook application and when I was going through the <a href="http://developers.facebook.com/documentation.php">online documentation</a>, I found that I could write a <a href="http://developers.facebook.com/documentation.php?doc=login_desktop">desktop-based facebook application</a>. Furthermore, there were some <a href="http://code.google.com/p/facebook-java-api/">Java APIs</a> available. I thought to myself, Java&#8230; Desktop&#8230; I know that space pretty well&#8230; why not throw some Eclipse love in there? So within about 20 minutes of reading facebook documentation, I was on my way to writing an Eclipse-based facebook application.</p>
<p>As I was about to start coding, I thought to myself, why not do a blog series about this topic to help people better understand how to create Eclipse-based applications? Maybe it will be useful, may it won&#8217;t, but it should be fun! And to be honest, I also had some selfish goals. First, I needed something to kill the time on long airplane flights. Second, I want to be able to update my facebook status in Eclipse and to be able to <a href="http://www.facebook.com/help.php?page=20">poke</a> other Eclipse committers like Dave Steinberg, <a href="http://wassim-melhem.blogspot.com/">Wassim Melhem</a> and <a href="http://pookzilla.net/wp">Kim Horne</a>. Also, I didn&#8217;t like being called an old fart. So, if you&#8217;re interested, I&#8217;ll be posting things in parts as time passes and if people show interest. In the end, I want something that kind of looks likes this:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_2017w9FY4Do/SAxbpxI6lVI/AAAAAAAAAf8/0n_CBcn3BHU/s1600-h/fig4.png"><img style="cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_2017w9FY4Do/SAxbpxI6lVI/AAAAAAAAAf8/0n_CBcn3BHU/s320/fig4.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5191625243574834514" /></a></p>
<p>To start, continue reading on to creating <a href="http://mea-bloga.blogspot.com/2008/04/eclipse-based-facebook-application-part.html">An Eclipse-based Facebook Application (Part 1)</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://aniszczyk.org/2008/04/21/facebook-on-a-plane/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
