Monday, November 4, 2013

Published 1:18 AM by with 0 comment

google translator


Language is the human capacity for acquiring and using complex systems of communication, and a language is any specific example of such a system. The scientific study of language is called linguistics. Estimates of the number of languages in the world vary between 6,000 and 7,000. However, any precise estimate depends on a partly arbitrary distinction between languages and dialects. Natural languages are spoken or signed, but any language can be encoded into secondary media using auditory, visual, or tactile stimuli, for example, in graphic writing, braille, or whistling. This is because human language is modality-independent. When used as a general concept, "language" may refer to the cognitive ability to learn and use systems of complex communication, or to describe the set of rules that makes up these systems, or the set of utterances that can be produced from those rules. All languages rely on the process of semiosis to relate signs with particular meanings. Oral and sign languages contain a phonological system that governs how symbols are used to form sequences known as words or morphemes, and a syntactic system that governs how words and morphemes are combined to form phrases and utterances.
Read More
    email this       edit

Friday, November 1, 2013

Published 4:21 AM by with 1 comment

Simple pagination using http://flaviusmatis.github.io/simplePagination.js


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>  
   <link rel="stylesheet" type="text/css" href="http://flaviusmatis.github.io/simplePagination.js/simplePagination.css" />  
   <script type="text/javascript" src="http://flaviusmatis.github.io/simplePagination.js/jquery.simplePagination.js"></script>  
   <script type="text/javascript" charset="utf-8">  
     $(document).ready(function () {  
       var itemsOnPage = 3;  
       $('#paging').pagination({  
         items: $('#content > div').length,  
         itemsOnPage: itemsOnPage,  
         cssStyle: 'light-theme',  
         onPageClick: function (pageNumber, event) {  
           var pageN = pageNumber != 0 ? (pageNumber - 1) : pageNumber;  
           var from = (pageN * itemsOnPage) + 1;  
           var to = (pageNumber * itemsOnPage);  
           console.log('page :'+pageNumber+' from: ' + from + ' to :' + to);  
           $('#content > div').css({ 'display': 'none' });  
           for (var i = from; i <= to ; i++) {  
             console.log('loop :'+i);  
             $('#content > div:eq(' + (i-1) + ')').css({ 'display': 'block' });  
           }  
         },  
         onInit: function () {  
           $('#content > div').css({ 'display': 'none' });  
           for (var i = 0; i <itemsOnPage; ++i) {  
             $('#content > div:eq('+i+')').css({ 'display': 'block' });  
           }  
         }  
       });  
     });  
   </script>  
  <div id="content" style="width:210px">  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">1</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">2</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">3</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">4</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">5</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">6</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">7</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">8</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">9</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">10</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">11</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">12</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">13</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">14</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">15</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">16</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">17</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">18</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">19</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">20</div>  
     <div style="width:200px;height:20px;background-color:blueviolet;margin-bottom:5px">21</div>  
   </div>  
   <div id="paging" ></div>  

Read More
    email this       edit

Monday, June 17, 2013

Published 10:29 AM by with 0 comment

Increase Virtual Box VDI disk size on MAC or Windows

Need more space on your Virtual Box disc? I installed Windows 7 on Oracle Virtual Box but didn’t estimate the size of disk correctly. The drive is now nearing it’s capacity, how do you extend the size? It will take the following steps to achieve an extended disk capacity:
  1. Create a new virtual disk
  2. Clone the old disk to this newly created virtual disk
  3. Disconnect the old disk via storage settings in Virtual Box
  4. Connect/Attach the new disk to the Virtual Machine
  5. Boot up using the new disk
  6. Go to Windows Computer Management and Extend the disk space
Let’s go each step in a bit of detail now.
1. Create new virtual disk via Settings –> Storage. Make sure you choose enough size as per your requirements when creating this new disk. Choose Dynamically expanding storage for the disk storage type.
Create new virtual disk
2. Clone the old disk to this new disk – the idea is that the bigger new disk receives a disc copy of the old one. Use the following command for this (assuming Oracle VirtualBox is installed at C:\VirtualBox on your machine, otherwise navigate to the appropriate directory first):
1C:\VirtualBox>
2C:\VirtualBox>VBoxManage clonehd [OldHDDFile.vdi] [NewHDDFile.vdi] --existing
3C:\VirtualBox>
Note: Use full path with [OldHDDFile.vdi] and [NewHDDFile.vdi]. It can take few minutes for the Clone process to complete.
3. Disconnect the old disk via storage settings in Virtual Box

4. Connect/Attach the new disk to the Virtual Machine
5. Boot/Start the Virtual Machine
6. Go to Windows Computer Management –> Disk/Storage management and Extend the disk space on C drive to use the newly created/unallocated disk space
That’s all enjoy the extended sized disk!!
Read More
    email this       edit

Sunday, June 9, 2013

Published 1:14 AM by with 0 comment

Abstract Classes C#

Abstract


The abstract modifier can be used with classes, methods, properties, indexers, and events.
Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes.
Abstract classes have the following features:
  • An abstract class cannot be instantiated.
  • An abstract class may contain abstract methods and accessors.
  • It is not possible to modify an abstract class with the sealed modifier, which means that the class cannot be inherited.
  • A non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors.
Use the abstract modifier in a method or property declaration to indicate that the method or property does not contain implementation.
Abstract methods have the following features:
  • An abstract method is implicitly a virtual method.
  • Abstract method declarations are only permitted in abstract classes.
  • Because an abstract method declaration provides no actual implementation, there is no method body; the method declaration simply ends with a semicolon and there are no braces ({ }) following the signature. For example:
public abstract void MyMethod();

  • The implementation is provided by an overriding method, which is a member of a non-abstract class.
  • It is an error to use the static or virtual modifiers in an abstract method declaration.
Abstract properties behave like abstract methods, except for the differences in declaration and invocation syntax.
  • It is an error to use the abstract modifier on a static property.
  • An abstract inherited property can be overridden in a derived class by including a property declaration that uses the override modifier.
An abstract class must provide implementation for all interface members.
An abstract class that implements an interface might map the interface methods onto abstract methods. For example:
interface I 
{
   void M();
}
abstract class C: I 
{
   public abstract void M();
}

Example

In this example, the class MyDerivedC is derived from an abstract class MyBaseC. The abstract class contains an abstract method, MyMethod(), and two abstract properties, GetX() and GetY().
// abstract_keyword.cs
// Abstract Classes
using System;
abstract class MyBaseC   // Abstract class
{
   protected int x = 100; 
   protected int y = 150;
   public abstract void MyMethod();   // Abstract method

   public abstract int GetX   // Abstract property
   {
      get;
   }

   public abstract int GetY   // Abstract property
   {
      get;
   }
}

class MyDerivedC: MyBaseC
{
   public override void MyMethod() 
   {
      x++;
      y++;   
   }   

   public override int GetX   // overriding property
   {
      get 
      {
         return x+10;
      }
   }

   public override int GetY   // overriding property
   {
      get
      {
         return y+10;
      }
   }

   public static void Main() 
   {
      MyDerivedC mC = new MyDerivedC();
      mC.MyMethod();
      Console.WriteLine("x = {0}, y = {1}", mC.GetX, mC.GetY);    
   } 
}
Abstract classes are closely related to interfaces. They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented. One key difference between abstract classes and interfaces is that a class may implement an unlimited number of interfaces, but may inherit from only one abstract (or any other kind of) class. A class that is derived from an abstract class may still implement interfaces. Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed. They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code.



// C#
abstract class WashingMachine
{
   public WashingMachine()
   {
      // Code to initialize the class goes here.
   }

   abstract public void Wash();
   abstract public void Rinse(int loadSize);
   abstract public long Spin(int speed);
}

// C#
class MyWashingMachine : WashingMachine
{
   public MyWashingMachine()
   {  
      // Initialization code goes here.    
   }

   override public void Wash()
   {
      // Wash code goes here.
   }

   override public void Rinse(int loadSize)
   {
      // Rinse code goes here.
   }

   override public long Spin(int speed)
   {
      // Spin code goes here.
   }
}
Ref:http://msdn.microsoft.com/en-us/library/sf985hc5(v=vs.71).aspx
Read More

    email this       edit
Published 1:13 AM by with 0 comment

Abstract Classes C#


Read More
    email this       edit

Wednesday, May 29, 2013

Published 12:31 PM by with 0 comment

Installing Active Directory Domain Services (AD-DS)


Method 1 – Server Manager/Initial Configuration Tasks

Roles can and should be added from Server Manager (but they can also be initiated from the Initial Configuration Tasks wizard that auto-opens the first time you log on to the server).
    1. Open Server Manager by clicking the icon in the Quick Launch toolbar, or from the Administrative Tools folder.
    2. Wait till it finishes loading, then click on Roles > Add Roles link.
    1. In the Before you begin window, click Next.
    1. In the Select Server Roles window, click to select Active Directory Domain Services, and then click Next.
    1. In the Active Directory Domain Services window read the provided information if you want to, and then click Next.
    1. In the Confirm Installation Selections, read the provided information if you want to, and then click Next.
    1. Wait till the process completes.
    1. When it ends, click Close.
    1. Going back to Server Manager, click on the Active Directory Domain Services link, and note that there's no information linked to it, because the DCPROMO command has not been run yet.
    1. Now you can click on the DCPROMO link, or read on.
      1. To run DCPROMO, enter the command in the Run command, or click on the DCPROMO link from Server Manager > Roles > Active Directory Domain Services.
      1. Depending upon the question if AD-DS was previously installed or not, the Active Directory Domain Services Installation Wizard will appear immediately or after a short while. Click Next.
      Note: The Advanced features of DCPROMO will be discussed in a future article.

      1. In the Operating System Compatibility window, read the provided information and click Next.
      1. In the Choosing Deployment Configuration window, click on "Create a new domain in a new forest" and click Next.
      1. Enter an appropriate name for the new domain. Make sure you pick the right domain name, as renaming domains is a task you will not wish to perform on a daily basis. Click Next.
      Note: Do NOT use single label domain names such as "mydomain" or similar. You MUST pick a full domain name such as "mydomain.local" or "mydomain.com" and so on.
      The wizard will perform checks to see if the domain name is not already in use on the local network.
      1. Pick the right forest function level. Windows 2000 mode is the default, and it allows the addition of Windows 2000, Windows Server 2003 and Windows Server 2008 Domain Controllers to the forest you're creating. Read my "Understanding Windows Server 2008 Active Directory Domain and Forest Functional Levels" article for more information on that.
      1. Pick the right domain function level. Windows 2000 Native mode is the default, and it allows the addition of Windows 2000, Windows Server 2003 and Windows Server 2008 Domain Controllers to the domain you're creating.
      Note: If you select "Windows Server 2008" for the forest function level, you will Not be prompted to pick a domain function level. Read more about domain and forest function levels on my "Understanding Windows Server 2008 Active Directory Domain and Forest Functional Levels" article.
      1. The wizard will perform checks to see if DNS is properly configured on the local network. In this case, no DNS server has been configured, therefore, the wizard will offer to automatically install DNS on this server.
      Note: The first DCs must also be a Global Catalog. Also, the first DCs in a forest cannot be a Read Only Domain controller.
      1. It's most likely that you'll get a warning telling you that the server has one or more dynamic IP Addresses. Running IPCONFIG /all will show that this is not the case, because as you can clearly see, I have given the server a static IP Address. So, where did this come from? The answer is IPv6. I did not manually configure the IPv6 Address, hence the warning. In a network where IPv6 is not used, you can safely ignore this warning.
      1. You'll probably get a warning about DNS delegation. Since no DNS has been configured yet, you can ignore the message and click Yes.
      1. Next, change the paths for the AD database, log files and SYSVOL folder. For large deployments, carefully plan your DC configuration to get the maximum performance. When satisfied, click Next.
      1. Enter the password for the Active Directory Recovery Mode. This password must be kept confidential, and because it stays constant while regular domain user passwords expire (based upon the password policy configured for the domain, the default is 42 days), it does not. This password should be complex and at least 7 characters long. I strongly suggest that you do NOT use the regular administrator's password, and that you write it down and securely store it. Click Next.
      1. In the Summary window review your selections, and if required, save them to an unattend answer file. When satisfied, click Next.
      1. The wizard will begin creating the Active Directory domain, and when finished, you will need to press Finish and reboot your computer.
      Note: You can automate the rebooting process by checking the Reboot on Completion checkbox.
      To automate domain controller installations, you can use an answer file or you can specify unattended installation parameters at the command line. More on that in my "Creating an Unattend Installation File for DCPROMO in Windows Server 2008" article.
      Note: As written in my "Installing Active Directory on Windows 2008 Server Core" article, configuring a Windows Server 2008 Server Core machine REQUIRES you to perform an automated installation of Active Directory on that server, as there is NOT DCPROMO GUI on Server Core.
      Your server now acts as a Domain Controller. Make sure you properly back it up. You can test functionality by using AD management tools such as Active Directory Users and Computers, examine the Event Logs, services and folders and shares that have been created.

      Links

Method 2 – Servermanagercmd.exe

Servermanagercmd.exe is the command prompt equivalent of the Add Roles and Add Features wizards in Server Manager. Through the use of various command line options, you can quickly and easily add or remove features and roles to or from your server, including the AD-DS role.
To install AD-DS by using Servermanagercmd.exe, simply enter the following command in the Command Prompt window:
Servermanagercmd.exe –I ADDS-Domain-Controller
Let the command run and when it finishes, AD-DS will be installed on the server.

Method 3 – Letting DCPROMO do the job

Oh yes. If you forget to install AD-DS or simply want to skip clicking on some windows, you can run DCPROMO from the Run command and before it is executed, the server will check to see if the AD-DS binaries are installed. Since they are not, they will auto-install.
After you complete the Add Roles Wizard, either click the link to start the Active Directory Domain Services Installation Wizard, or close Server Manager and manually run DCPROMO from the Run command.

Running DCPROMO

After installing the AD-DS role, we need to run DCPROMO to perform the actual Active Directory database and function installation.
Note: This guide assumes this is the first Domain controller in the forest, thus creating a new domain in a new forest. For a guide on how to add additional Domain Controllers to existing domains, please read my upcoming "Installing Additional Windows Server 2008 Domain Controllers in your Existing Active Directory Domain" article.
Read More
    email this       edit
Published 12:06 PM by with 0 comment

Create and map shared folder in VirtualBox


VirtualBox is a great virtualization software from Sun Microsystems. I’ve previously written many articles on how to create a virtual machine in VirtualBox and how to install Windows 7 using VirtualBox.
If you’ve had any experience with virtualization software, you’ve probably also heard of VMWare and Virtual PC. I’ve previously used Virtual PC from Microsoft for all my needs and one feature that I really liked was the ability to easily share files and folders between the guest and host operating system.
In Virtual PC, all you had to do in order to share files from the host OS to the guest OS was drag and drop onto the desktop. Super easy. When I switched over to VirtualBox, I realized that sharing folders in VirtualBox is not as simple as dragging and dropping.
virtualbox share folders
This was really annoying to me at first and it took me a little while to figure out exactly how to do it! In this article, I will walk you through the steps for sharing folders between guest and host OS in VirtualBox.
First, you have to install VirtualBox Guest Additions in the guest OS. You can do this by going to Devices and clicking onInstall Guest Editions.
share folders between guest and host
Once installed and your guest OS rebooted, you need to create a virtual shared folder. You can do this by going to Devicesagain and clicking on Shared Folders.
shared folders
Now click on the Add New Shared Folder button on the right.
share files virtualbox
In the Folder Path box, click the down arrow and then click Other. Browse to the folder on the host OS that you would like to share with the guest OS. In the Folder Name box, give your share a name. You can choose to make it read-only and to make the shared folder permanent.
add a shared folder
Click OK and the new shared folder will show up under Machine Folders if you chose to make it Permanent, otherwise it will show under Transient Folders.
share folders virtualbox
Now click OK to close the Shared Folders dialog. You have to do one more thing in order to be able to actually access the folder on the host OS. Depending on whether the Guest OS is running Windows or Linux (Ubuntu, etc), the method is different.

Windows Guest

In this case, you can either browse to the shared folder by going to My Network Places – Entire Network – VirtualBox Shared Folders or you can map a drive letter to that shared folder. I prefer the second method to make it easily accessible.
net use x: \\vboxsvr\sharename
To do this, open an command prompt and type in the above command. Simply replace sharename with the Folder Name you used when adding a share. Note that you do NOT need to change vboxsvr.

Linux Guest

To mount a shared folder in a Linux Guest OS such as Ubuntu, type in the following command:
mount -t vboxsf [-o OPTIONS] sharename mountpoint
Replace sharename with the name of the share and mountpoint with the path where you want the share to be mounted (i.e. /mnt/share).
That’s it! You should get a message like “The command completed successfully” like shown below:
virtualbox shared folders
Now when you go to Explorer or My Computer, you’ll see the new drive mounted and ready for access!
mapped network drive
Not too hard eh? Of course, if you didn’t know you had to do all this, it could get quite frustrating! Now when you need to share files or folders in VirtualBox, you’ll be able to do it easily. Enjoy!
Read More
    email this       edit
Published 10:41 AM by with 0 comment

Creating a Virtual Machine using VirtualBox


 Creating a Virtual Machine ( For Guest OS)

Open Application -> System Tools -> VirtualBox ( Command name is “virtualbox” )
Click Machine -> New. This will launch a “Create New Virtual Machine” wizard. Click Next.
Enter the name of the Guest machine as you desire and choose the Operating system and Version that you are planning to install as follows, and click “Next”.
Enter the RAM size that you want to provide to your Guest machine as follows.
Now it will ask you to choose your “Virtual Hard Disk” for installing the guest OS as follows.
Since this is the first time we are installing, click “Create New Hard disk”.
Create “New Virtual Disk” wizard will open. Click Next
Now we need to choose, whether the disk has to be “Dynamically expanding disk” or “Fixed-size storage”.
Remember, for a guest machine, it sees a file residing in the host machine as the “Hard Disk”. Whenever a guest machine does any write to disk, it will be written into the file which resides on the host machine
If we select “Fixed storage” and if we choose the size as 10GB then, in host machine ( by default under .VirtualBox/Guest-Machine/Guest-Machine.vdi ) a file will be created with 10GB of size
If we select “Dynamic storage” then, .VirtualBox/Guest-Machine/Guest-Machine.vdi will initially be a small size file, but it will grow whenever the guest machine writes data to the disk.
Choose “Dynamic storage” and click Next.
Enter the maximum size that you want to allocate for the guest machine.
Click Finish. Now a file named “Guest-Machine.vdi” will be created under “.VirtualBox/Guest-Machine/”
Click “Finish” to complete the creation of Virtual Machine.
Now a new “Virtual Machine” is created and it will be in “power off” state.

3. Installing OS in a Virtual machine

We can install any OS ( personally tested windows and linux ) on a virtual machine. We can install the OS in virtual machine by 2 methods
  • Through OS-DVD
  • Through ISO image of the OS
Here we will cover the installation using an ISO image, although using DVD is very similar to this.
Make sure that the iso file of your distribution is present in the host machine.
Launch “virtualbox”. Select the newly created virtual machine. Click “Settings”.
Now a new window will open which will list out the settings group on left panel and actual setting on the right side as follows.
Select “System”. On the right panel ensure that the boot order is correct ( Similar to setting the boot order in BIOS ).
Use the “Move Up” or “Move Down” button button to change the boot order, and make sure CD/DVD is selected as the “First boot device” and click “Ok”.
The next step is to map the “ISO file” of your distribution to the virtual CD/DVD device.
Under “Settings” go to “Storage”, the following screen will appear.
Click the “CD icon” and choose the “iso file of the OS”, here I used “Debian-Lenny”.
The following screen will appear once you have choosen the ISO file. Click “Ok”.
Now select the virtual machine, and click “Start”. It will start to boot from the CD/DVD which is mapped to the ISO file.
The OS installation is similar to installing an OS in a physical machine.
Once OS is installed successfully, change the “Boot Order” to boot from HDD, and click “Start”.
Now you can start using the virtual machine as like other machines.
Read More
    email this       edit