Amira's profileeMerooPhotosBlogLists Tools Help

Amira

View Amira Aboulrous's profile on LinkedIn
 
follow eMeroo at http://twitter.com

eMeroo Blog Network

Weather

Loading...

eMeroo

IF WE DON'T HELP EACH OTHER, WHO WILL?

eMeroo

Loading...
September 21

How to add a community link to your msn space?


Adding FaceBook profile link to your space (Link FaceBook to MSN Space).

1. Login to your Facebook account

2. Click Profile on the top menu.

3. Scroll to the very button of your profile and click Create a profile badge.

4. Click the button Create Badge.

5. Customize facebook link.

6. Click Save button, now you get the code for facebook link.

7. Copy the entire code.

8. Login to your Msn Space

9. Click Edit your profile.

10. Click Customize tab, and select Add Modules

11. On Other section, move to Custom HTML and click Add.

12. Close tab, and save.

13. Edit the custom html and add the coppied link, and drag and drop it any where you desire.


Adding LinkedIn link to your space (Link LinkedIn to MSN Space).

1. Login to your LinkedIn account

2. Click Account & Settings on the top of page.

3. at the Profile Settings section, click My Profile

4. Under Public Profile, you will see section for  Promote your public profile!

5. click Promote your profile, you will be provided with set of choices for LinkedIn link to your space

6. choose one and copy the entire code.

Follow the steps from (8 to 13)  such as adding facebook link.


Adding Twitter Link to your space (Link Twitter to MSN Space).

1. Login to your Twitter account

2. Click Settings on the top of page.

3. Under the section of More Info URL

4. Click (You can also add Twitter to your site here).

5. Choose your Blog or community (Our choice here is MySpace).

6. Choose twitter link type and customize the link as desirable.

7. Copy the provided link.

Follow the steps from (8 to 13)  such as adding facebook link.

Hope this helps Wink

Amira

September 17

Branding and customizing sharepoint 2007


Branding sharepoint Site is one of the problems that you may face while working with MOSS 2007.
Simply you can build a feature to customize the most of sharepoint menus, by working with the ElementManifest file say “elements.xml”.
Here's the
Default Custom Action Locations and IDs that will help in customizing menus, and this topic illustrates How to: Add Actions to the User Interface .

This topic will illustrate another branch of branding sharepoint, which is customizing context menu in Document Library. You can add item to this context menu by following the way that is illustrated in the previous links. You will use the location of "EditControlBlock". But if you target an advanced actions for example adding sub context menu to the main context menu, you should follow this topic.

Problem:
I need to add sub context menu named (Document Library) to "Send To" menu, and add items to Document Library. as shown below

CustomContextMenu


Solution:
The workaround of this problem is editing at JavaScript file of MOSS located @ "\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\Core.js".

Step1: You will go to this function AddSendSubMenu(m,ctx) at CORE.JS, where
          - m is the menu object.
          - ctx provides HTTP context information about the web request.

Step2: and after those two lines

1:      var sm=CASubM(m,strDisplayText,"","",400);
2:      sm.id="ID_Send";
@Line 1: define sm which instructs to add strDisplayText to m, where 
            - strDisplayText: is now assigned to “Send To”
            - m: is representing the main Context Menu

Step3: Start writing this JavaScript code snippet
   1: //start override
   2:  
   3:         //add "Document Library" item to "Send To"
   4:         var L_DocumentLibrary_Text="Document Library";
   5:         strDisplayText =L_DocumentLibrary_Text;
   6:         var docLib=CASubM(sm,strDisplayText,"","",400);
   7:         docLib.id="id_L_DocumentLibrary_Text";     
   8:  
   9:         var Const_DocLibs_Array=["DocLib1","DocLib2"];        
  10:  
  11:         //add all document ibraries exists to "Document Library" Menu
  12:         for(var cnt=0;cnt<Const_DocLibs_Array.length;cnt++)
  13:         {
  14:         var L_Doc_Text=Const_DocLibs_Array[cnt];
  15:         strDisplayText=L_Doc_Text;
  16:         strAction= "STSNavigate('"+                ctx.HttpRoot+                "/_layouts/SendToDoc.aspx" + "')";
  17:         strImagePath=ctx.imagesPath+"existingLocations.gif";
  18:         menuOption=CAMOpt(docLib,strDisplayText,strAction,strImagePath);
  19:         menuOption.id="id_"+L_Doc_Text;
  20:         }     
  21:     //end override
Inside AddSendSubMenu you can add sub items or menus to “Send To”.

@Line 6: define docLib which instructs to add strDisplayText to sm, where
             - strDisplayText: is now assigned to “Document Library”.
             - sm: is representing “Send To” menu, as descriped @ setp2.
@Line 9: define an array of the sub menu items of “Document Libray”.
@Line 15: reassign strDisplayText to new name represents text defined in array.
@Line 16: define the action of each item.
@Line 17: assign strImagePath to the image that represents each menu item.
@Line 18:  call CAMOpt to assign the action (strAction) to each item (strDisplayText) at the menu (docLib).

Conclusion:
     * Use the function CASubM(menuObject,strDisplayText,"","",400) to add a menu.
     * Use the function CAMOpt(menuObject,strDisplayText,strAction,strImagePath) to assign an action to item of a menu.

P.S. Here is some variables at Core.js which is defined while you are in a document Library

  • ctx.HttpRoot --> http://amira-pc/NewSite
  • ctx.ListTitle  --> Shared Documents
  • ctx.listBaseType –> 1
  • ctx.listTemplate –> 101
  • ctx.listName—> {63BAFD2F-6478-45B1-B487-D454470ED346}
  • ctx.view—> {FE013DBB-809C-478D-922A-5DE78471F78E}
  • ctx.listUrlDir—> /NewSite/Shared Documents
  • ctx.HttpPath—> /NewSite/_vti_bin/owssvr.dll?CS=65001
  • ctx.displayFormUrl—> /NewSite/Shared Documents/Forms/DispForm.aspx
  • ctx.editFormUrl—> /NewSite/Shared Documents/Forms/EditForm.aspx
  • currentItemCanModify --> true
  • ctx.imagesPath—> /_layouts/images/
  • originalFormAction ---> display current view page (AllItems.aspx or any custom view)

,and While the context menu of a specific item is opened,

  • currentItemAppName --> Microsoft Office Word
  • currentItemFileUrl --> /NewSite/Shared Documents/New Microsoft Office Word Document.docx
  • currentItemIcon --> icdocx.gif
  • currentItemID --> 24
  • currentItemUrl --> /NewSite/Shared Documents/New Microsoft Office Word Document.docx

Guide while branding and customizing menu
Add FireBug Blug-in to your FireFox and follow DOM values to get the rest of variables’ value of core.js at any area of sharepoint.

Hope this helps Smile

Amira

August 25

Installing DotNetNuke

You can easily Install DotNetNuke. To do, follow these steps:

Step -1-
Install IIS,Visual Web Developer, SQL Server 

Step -2-
Download DotNetNuke  Extract the downloadable file Extract the file DotNetNuke_04.08.04_Install.zip to another folder,(I extracted it to a folder "DotNetNuke434" located in "C:\Inetpub") 

Step -3-
*Run DotNetNuke_04.08.04_StarterKit.vsi , the installation wizard will appear as shown in Figure 1-1.

Figure 1-1

*Click "Next" and the install will start. Before the actual install starts, however, you may see a message like the one in Figure 1-2, click "Yes".

Figure 1-2

*Now you will see a window like Figure 1-3, click "Finish" to continue installation.

Figure 1-3

*Finally the installation complete successfully like Figure 1-4. 

Figure 1-4

Step -4-
Go to the directory where you extracted DotNetNuke "DotNetNuke434", Right click and select "properties", move to "Security" tab, and set permission for Users to "Full Control" as shown in Figure 2-1. 

Figure 2-1

Step -5-
Continue installation as explained here
http://www.adefwebserver.com/DotNetNukeHELP/DNN4_DevelopmentEnvironment/DNN4DevelopmentEnvironment1.htm 

P.S.
You may fail in setting up DotNetNuke with some errors like those :
Error 1 --> FAILURE 400 - Access to the path 'c:\inetpub\DotNetNuke434\Portals\_default\03.00.08.txt' is denied.
Suggested Solution 1 --> http://www.dotnetnuke.com/News/SecurityPolicy/SecurityBulletinno14/tabid/1159/Default.aspx
Suggested Solution 2 --> check step -5- 

Error 2 -->Failed to update database  \APP_DATA\DATABASE.MDF" because the database is read-only.
Suggested Solution 2 --> check step -5-

Hope this help
Smile

Amira

December 27

How to Copy all Photos in a tree of Directories?

I have a Directory named photo,this directory organizes my all my photos. It contains set of subdirectories (such as Stars, Family, Work, ...etc) and inside each subdirectory there are other subdirectories, for example in Family directory I have some photos in addition to 2 directories (Father's Family and Mother's Family) and inside each one of them there are some other directories and so on.

How to get a copy of all these photos inside the directory called photo and all photos inside the tree of its subdirectories up to the 3rd degree of photo directory's depth ??!

   1: using System;
   2: using System.IO;
   3:  
   4: namespace CopyPhotos
   5: {
   6:     class Program
   7:     {
   8:         public static int i = 0;
   9:         //create new directory in dirve D
  10:         static DirectoryInfo dir = new DirectoryInfo(@"D:\MyPhotos");
  11:        
  12:         //Generate a string represents the full path for each copied photo
  13:         public static string GenerateImgName()
  14:         {
  15:             string name = "IMG" + i++.ToString();
  16:             string fullPath = @dir.FullName + @"\" + name + ".jpg";
  17:             return fullPath;
  18:         }
  19:  
  20:         //copy each jpg photo in specefied directory
  21:         public static void CopyPhotosInDir(DirectoryInfo d)
  22:         {
  23:             foreach (FileInfo f in d.GetFiles("*.jpg"))
  24:                 f.CopyTo(GenerateImgName());
  25:         }
  26:  
  27:         //copy each photo in the directory D:\Library\Photo and
  28:         //also copy each photo in each subdirectory up to the 3rd depth of subdirectories
  29:         public static void CopyAllPhotosInRootDir()
  30:         {
  31:             DirectoryInfo di = new DirectoryInfo(@"D:\Library\Photo");
  32:             CopyPhotosInDir(di);
  33:             foreach (DirectoryInfo d1 in di.GetDirectories())
  34:             {
  35:                 CopyPhotosInDir(d1);
  36:                 foreach (DirectoryInfo d2 in d1.GetDirectories())
  37:                 {
  38:                     CopyPhotosInDir(d2);
  39:                     foreach (DirectoryInfo d3 in d2.GetDirectories())
  40:                         CopyPhotosInDir(d3);
  41:                 }//end second foreach
  42:             }//end first foreach
  43:         }//end CopyAllPhotosInRootDir
  44:  
  45:         static void Main(string[] args)
  46:         {
  47:             //create the directory D:\MyPhotos
  48:             dir.Create();
  49:  
  50:             //copy all photos inside D:\Library\photo Directory
  51:             CopyAllPhotosInRootDir();
  52:         }
  53:     }
  54: }

this executable assembly copies all the jpg files to D:\MyPhotos, you can copy all photos by changing Line 23 to

foreach (FileInfo f in d.GetFiles())
 
Downlod the program
hope this helps, smile_regular

Amira

December 17

Tips and Tricks for C# Constructors

Hello, Here I'll tell you some notes about constructors and some tricks that you may face while using constructors.
* Constructors never define return value (that what distinguish constructor from method).  

* If you didn't define a constructor in your class, it will be automatically supplied with the default constructor. But if you defined a constructor with parameters, the supplied default constructor will be removed and you won't be able to use it until you explicitly define it in your class.

* If you defined your class as internal and a constructor inside it as public, so you can't new use it in another assembly. Although the constructor is public, but the class is internal (accessed only inside the assembly that define it).

That's a class definition in an assembly named Constructors

using System;

 

namespace Constructors

{

     class parent

    {

       public parent()

        { Console.WriteLine("Hello"); }

    }

}

Try to use parent class in another assembly. Create console application and make reference to Constructors.dll

using System;
using Constructors;

namespace usingConstructor
{
   
class Program
    {
       
static void Main(string[] args)
        {
            parent p =
new parent();
        }
    }
}

You'll receive error.  

* The default access modifier for the constructor is private (like methods).

* If a constructor defined as private, you can't instanciate it outside the class. And also you can't define a child class inherit from parent class.Why???!!

Have a look at this code

namespace Constructors

{

   public class parent

    {

       parent()

        { Console.WriteLine("Hello"); }

    }

 

    public class child:parent

    {

    }

}

When you define child class inherit from parent class, the child class not only implicitly define default constructor but also this default constructor is implicitly call the default constructor of the parent class.

And here in child class, there isn't constructor defined explicitly, then it will be implicitly supplied with the default constructor. This default constructor will call the default constructor of the parent class. The error will be raised at this step, because the default constructor in parent class is private, so child class can't see it.

* Constructors can take any access modifier. Protected access modifier with constructor allow child class to inherit from parent class without any errors. But if you defined constructor as protected, you can't access it through object variable. Such as protected access modifier with methods. As I described it before.

So if you try to write this line of code inside child class, you'll receive an error

parent p = new parent();

* Now after defining parent class as public and its constructor as protected, try to create an object from child class inside Main in the console application that we created miniuts ago.

child c = new child();

the output is : Hello

* The first statement is executed inside the constructor is calling the default constructor of the base class(be aware that if your class didn't explicitly inherit from a base class, your class will implicitly inherit from object class. And then every constructor will call object's default constructor).

Try this

namespace Constructors

{

   public class parent

    {

     protected  parent()

        { Console.Write("Hello,"); }

    }

 

    public class child:parent

    {

        public child(){}

 

        public child(string yourName)

        {

            Console.WriteLine(yourName);

        }

    }

}

And inside the Main, try this

        static void Main(string[] args)

        {

            child c = new child("Amira");

            Console.WriteLine();

            child c1 = new child();

            Console.Read();

        }

-First line in Main, I created an object from child with a string argument "Amira"

Here it will invoke the constructor of child class that take a string and write it. But before executing this statement inside child's constructor, it'll invode the parent's default constructor(which write Hello,) so the result of that statement will be Hello, Amira

-Second line in Main, insert new line

-Third line in Main: I created another object from child class, but here it will invoke the custom default constructor with no argument. This constructor as I defined do nothing except the implicit call for parent's default constructor. So the output will be Hello,

* If parent class has no default constructor, then when the constructors inside child class try to call the parent's default constructor, they wont find it, you will receive error. Try to change the definion of the constructor inside parent class

public class parent

    {

     protected  parent(string s)

        { Console.Write("Hello,"); }

    }

Here the default constructor is removed, and you'll receive an error in that statement inside child class

public child(){} //error

* As I said before, the first statement is executed at child's constructor is thr implicit call to paren's default constructor. You can explicitly invoke the parent's constructor in child's constructors through base keyword (and the explicit call allow you to invoke any constructor defined at parent class), and that explicit call will be also the first statement executed when you instanciate the child class. If you supported child constructor with explicit call, the implicit one will be removed.

Try this

namespace Constructors

{

   public class parent

    {

     protected  parent(string str)

        { Console.Write("Hello," + str); }

    }

 

    public class child:parent

    {

 

        public child()

            : base("Amira")

        { }

        public child(string yourName)

            : base(yourName)

        { }

    }

}

 

Try again what we wrote in main the output will be

Hello, Amira
Hello, Amira  

* Also you can make explicit call to a constructor that is defined inside the class through this keyword(that is instead of the explicitly call to parent's constructor or instead of the implicitly call to parent's default constructor).

So change child class definition to

public class child:parent
  
{
public child()
   
: base("Amira")
       
{ }
public child(string yourName):this()
   
{ Console.WriteLine("\nBye"); }
}

Run the console application again, the output will be

Hello, Amira
Bye
Hello, Amira  

* you can overload the constructor, the code you wrote before, you overloded child's custom default constructor with an overloaded constructor with one parameter.

* Constructors can be defined as static, but you allowed to define only a single static constructor. And this static constructor doesn't take any access modifier and also doesn't take any parameters.

* Static constructor executes only one time, and executes before the other constructors.

Here inside StaticConstructor class, I defined static constructor which prints a message to inform the user when the static constructor is invoked and also to initialize static field (y)

    public class StaticConstrucor

    {

        public int x;

        public static int y;

 

        static StaticConstrucor()

        {

            Console.WriteLine("static constructor is invoked now");

            y = 2;

 

        }

 

        public StaticConstrucor()

        {

            Console.WriteLine("x={0} and y={1}",x,y);

        }

 

        public StaticConstrucor(int x)

        {

            this.x = x;

 

            Console.WriteLine("x={0} and y={1}", x, y);

        }

    }

* The runtime invokes the static constructor when it creates an instance of the class or before accessing the first static member invoked by the caller. Try this snippet of code inside the Main method

StaticConstrucor s = new StaticConstrucor();
StaticConstrucor s1 = new StaticConstrucor(3);
StaticConstrucor.y = 9;
StaticConstrucor s2 = new StaticConstrucor();

Here the static constructor invoked only once when I instanciated StaticConstructor class. So the output will be

static constructor is invoked now
x=0 and y=2
x=3 and y=2
x=0 and y=9

Also it can be invoked automatically before invoking the static member y, try only this statement
Console.WriteLine(StaticConstrucor.y);

Here the output will be

static constructor is invoked now
2

That all what I remembered about constructors. I wish I covered this topic well, and I hope that helps :D  

Amira