Posts

Showing posts from September, 2011

How to Convert Image to Byte Array or Bitmap

This time I present code that can help you work with images ( System.Drawing ). I showed how to convert Image to Byte Array and how to convert Image to Bitmap . here is the code: /// <summary> /// Image Converter from Image to byte array /// </summary> /// <param name="img">Image</param> /// <returns>byte</returns> public static byte [] ImageToByte( Image img) {      ImageConverter converter = new ImageConverter();      return ( byte [])converter.ConvertTo(img, typeof ( byte [])); } /// <summary> /// Image Converter from Image to Bitmap /// </summary> /// <param name="img"></param> /// <returns></returns> public static Bitmap ImageToBitmap( Image img) {      ImageConverter converter = new ImageConverter();      return ( Bitmap )converter.ConvertTo(img, typeof ( Bitmap )); } Yours, Roi

Whether the current user belongs to a SharePoint group policy

This time I will present the work Code which provides the current user has identification.      #region Permission      /// <summary>      /// return true is the CurrentUser has Permission in CurrentWeb      /// groupNames is the groups that split by ';'.      /// </summary>      /// <param name="groupNames"></param>      /// <returns></returns>      public static bool IsUserHasPermission( string groupNames)     {       SPUser user = SPContext.Current.Web.CurrentUser;       SPWeb web = SPContext.Current.Web;        return IsUserHasPermission(groupNames,web,user);     }      /// <summary>      /// re...

Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm

Image
Did you receive the following error when you tried to compile a project of SharePoint 2010? Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm. So - the solution is simple You should be Full Permission on the SharePoint Farm - including a data base (DB owner). After it is completed - open the visual studio as administrator. Cheers, Roi Kolbinger

Date and Time in JavaScript

Image
And this time I will present a snippet of code in javascript that shows the date and time. You can put it wherever you like - in nearly every segment SharePoint Designer or in the Content Editor WebPart. The JS code shows Date and Time <!-- Clock --> < script language ="JavaScript"> var clockID = 0; function UpdateClock() {    if (clockID) {       clearTimeout(clockID);       clockID   = 0;    }    var tDate = new Date();    var roiClock = window.document.getElementById( "roiClock" );    roiClock.innerHTML = ""     + tDate.toLocaleDateString()     + "&nbsp;&nbsp;&nbsp;&nbsp;"      + tDate.getHoursTwoDigits() + ":"      + tDate.getMinutesTwoDigits()    clockID = setTimeout( "UpdateClock()" , 6000); } function StartClock() {    clock...