Skip to main content

Posts

creating a facebook messaging system using php and facebook access tokens

Here is the procedure that was used to write posts in facebook by allowing the user to signin using their facebook id and then writing a post in their facebook profile page. 1. use the following url with your own application id created in facebook facebook login     Then after the page is reloading, get the access token returned by facebook for the logged in user     3. use the following lines of code to get the facebook access token from the set cookie above and use it to send the post data via curl to facebook if(isset($_COOKIE['access_token_fb'])) {     /* NEVER DELETE THIS LINE. THIS IS THE MOST IMPORTANT LINE IN USING FACEBOOK */     json_decode(file_get_contents('https://graph.facebook.com/me?access_token=' .$_COOKIE['access_token_fb']));         /* new testing code */         $url = "https://graph.facebook.com/me/feed";     $ch = curl_init();     $attachment =  array(   'access_token'  => $_COOKIE['access

HTML to C# Color Conversion

To convert a System.Drawing.Color to the HTML color format (Hex value or HTML color name value) and back. System.Drawing.Color c = System.Drawing.ColorTranslator.FromHtml("#F5F7F8"); String strHtmlColor = System.Drawing.ColorTranslator.ToHtml(c);

Client Script for GUID Generator

To create GUID's or Pseudo-Random numbers in Javascript, use the following function guidGenerator() { var S4 = function() { return (((1+Math.random())*0x10000)|0).toString(16).substring(1); }; return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); } This was adapted from the Original Work

jQuery Fiddles

The following are js fiddles 1. For demo on how to append an option tag between another option tag dynamically using jquery link 2. A demo of sortables using jQuery UI [1.7.2] and jQuery [1.3.2] link 3. The following JS fiddle is used to check how the value of an emtpy text box is recevied at Javascript link

jQuery Tips

The following are useful tips for handling jQuery - Javascript library 1. To change the selected option based on the option tag's value , use the following code. $('#element option[value="no"]').attr("selected", "selected"); However, if multiple options can be selected, first deselect them using the following code HTML MarkUp Default Selection 1 Selection 2 -- Javascript with jQuery -- $("document").ready(function() { $("#b1").click(function() { $(".selDiv select.opts option").each(function() { $(this).removeAttr("selected"); }); var optSelValue = $("#txt").val(); $(".selDiv select.opts option[value=\"" + optSelValue + "\"]").attr("selected", "selected"); }); }); Full Sample