Archive for the ‘Javascript’ Category
No Fluff Just Stuff 2011, Madison, WI
I attended the No Fluff Just Stuff conference in Madison, WI this weekend. It was a great chance to learn the newest Java trends and share struggles in programming with people much like myself, even if most of them were cheeseheads. Here are some of my reflections on the state of Java tech post-conference:
-Java 7 is underwhelming, mostly because it will not have closures. It will however introduce enhancements to speed up Groovy, JRuby, and Scala
-If I read between the lines what features are in HTML and any of them are supported by Chrome, then I think that HTML5+Chrome could easily turn into a gaming platform!
-There is no question that Groovy is the “next big thing” for Java. Get on board.
-A java developer could easily add Hadoop to his resume (and dollars to his pocket), by learning Hadoop with Cascading. Hadoop-worthy scale data sets are available for free from amazon: http://aws.amazon.com/publicdatasets/
Grails is really cool. I wish there was a hosting platform available that was anything close to Heroku for Rails. I think it is unlikely that we will hear any good Startup stories with Grails for that reason.

Facebooker2 Demo Video
I published my first ever screen cast tonight. enjoy!
The source code is available here: https://github.com/clickonchris/facebooker-demo
Facebook Javascript SDKs – Old vs. New
There are two ways to handle initializing your fb:serverFBML tags
1 – using the New Javascript SDK
doc: http://developers.facebook.com/docs/reference/javascript/
(identified by the js library http://connect.facebook.net/en_US/all.js)
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({appId: 'your app id',
status: true,
cookie: true,
xfbml: true});
FB.Event.subscribe('auth.sessionChange', function(response) {
if (response.session) {
// A user has logged in, and a new cookie has been saved
} else {
// The user has logged out
}
});
</script>
2 – Using the Old Javascript SDK
which is what our friends at StackOverflow have done. I reference this thread because it kept coming up while I was solving this problem, and the solution they give is outdated.
http://stackoverflow.com/questions/820421/can-i-use-facebooks-fbfriend-selector-in-an-iframe
(identified by the js library http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php and xd_receiver.html)
doc:http://developers.facebook.com/docs/reference/oldjavascript/
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript">
FB_RequireFeatures(
["CanvasUtil"],
function(){
FB.XdComm.Server.init('/xd_receiver.html');
FB.CanvasClient.startTimerToSizeToContent();
}
);
</script>
<script type="text/javascript">
FB_RequireFeatures(["XFBML"], function(){ FB.Facebook.init("Your Facebook API Key", "/xd_receiver.html"); });
</script>
JavaScript Documentation
It can be tough to find a decent JavaScript reference. This one is my favorite:
JavaScript Language Reference: https://developer.mozilla.org/en/JavaScript/Reference
Other great javascript links:
JQuery Reference: http://docs.jquery.com/Main_Page
Closure Compiler: http://code.google.com/closure/compiler/
A Better Window.onLoad with jQuery
I have recently come to discover the javascript library jQuery. My favorite feature is the window.onLoad replacement, which is actually faster than window.onLoad and can be used multiple times in one document.
<span style="color: #008000;"> $(document).ready(function(){
// Your code here...
});</span>Any code in the Your code here.. block will execute as soon as the page is loaded. This is useful for referencing DOM elements which would have been “undefined” before the page was fully loaded by the browser.

