7
Posted on 4:17 AM by prajeesh and filed under ,
Sometimes you may be want to show your latest twitter tweets in your website or blog, most of the cases you are doing this by using widgets with limited customization facilities and showing ads or links to other websites, here is an easier way to achieve this using twitter API and javascript.
Step 1:
  1. <div id="twitter_update_list">  
  2. </div>  

First, decide where about on your page you want your last tweet to display. Then paste following html code there.
Step 2:
Next you need to put these 2 lines of JavaScript below the code in step 1. On the 2nd line of code where it says prajeeshkk.json, you need to replace prajeeshkk with your twitter username.
  1. <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js">  
  2. </script>  
  3. <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/prajeeshkk.json?callback=twitterCallback2&count=1">  
  4. </script>  

Step 3:(Optional)
You can apply css and make the div displaying the tweet stylish.
  1. #twitter_update_list li {  
  2. list-style-type: none;  
  3. }  
  4. #twitter_update_list span a  
  5. {  
  6. display: inline;  
  7. color: #008080;  
  8. }  
  9. #twitter_update_list span a:hover  
  10. {  
  11. text-decoration: underline;  
  12. color: #66CCFF;  
  13. }  
  14. #twitter_update_list span  
  15. {  
  16. color: #000000;  
  17. background: white;  
  18. }  


See how my tweet design looks :

Shout it kick it on DotNetKicks.com
0
Posted on 4:06 AM by prajeesh and filed under ,
In some applications we may need to reset all controls in using a single "Reset" button click, here is the c# code to achieve this.
  1. public  static void ResetControls(ControlCollection pagecontrols, bool txtbox, bool dropdownlist, bool label)  
  2.   {  
  3.       foreach (Control cntrl in pagecontrols)  
  4.       {  
  5.           foreach (Control mycontrols in cntrl.Controls)  
  6.           {  
  7.               if (txtbox)  
  8.               {  
  9.                   if (mycontrols is TextBox)  
  10.                   {  
  11.                       (mycontrols as TextBox).Text = string.Empty;  
  12.                   }  
  13.               }  
  14.               if (dropdownlist)  
  15.               {  
  16.                   if (mycontrols is DropDownList)  
  17.                   {  
  18.                       (mycontrols as DropDownList).SelectedIndex = 0;  
  19.                   }  
  20.               }  
  21.               if (label)  
  22.               {  
  23.                   if (mycontrols is Label)  
  24.                   {  
  25.                       (mycontrols as Label).Text = string.Empty;  
  26.                   }  
  27.               }  
  28.           }  
  29.       }  
  30.   }  

We can call this function using following format if you want to clear all controls except label
  1. FormControl.ResetControls(this.Controls, truetruefalse);  
Shout it kick it on DotNetKicks.com
0
Posted on 8:54 AM by prajeesh and filed under
Sometimes you may need to update an online database with some stored procedure you have modified in your local system, but in most of the cases you may be confused about what are the stored procedures or tables you modified last, here is a quick solution for this.
1.Query to sort Stored Procedures on modified date.
  1. SELECT name, create_date, modify_date,type   
  2. FROM sys.objects  
  3. WHERE type = 'P' order by modify_date  desc  

2.Query to sort Stored Procedures on created date
  1. SELECT name, create_date, modify_date,type   
  2. FROM sys.objects  
  3. WHERE type = 'P' order by create_date  desc  

3.Query to sort user defined tables on created date
  1. SELECT name, create_date, modify_date,type   
  2. FROM sys.objects  
  3. WHERE type = 'u' order by create_date  desc  

4.Query to sort user defined tables on modified date
  1. SELECT name, create_date, modify_date,type   
  2. FROM sys.objects  
  3. WHERE type = 'u' order by modify_date  desc  
Shout it kick it on DotNetKicks.com