AkraTech

Impacting lives through technology - www.akra-tech.com

Speed up your Magento Webstores

clock June 6, 2013 09:48 by author salam

I have noticed that there are many shops that are not using Magento’s default feature to merge JavaScript files. At the time prior to Magento 1.4, JavaScript merging was included.

All you need to do is:

 

1) Go to admin section
2) Go to System->Configuration->ADVANCED (Developer)
3) Set “Merge JavaScript Files” to Yes (“No” is default)
4) What left is to Flush Javascript/CSS Cache at Cache management admin interface.

 

That’s it!, All Javascripts of the page will be merged into one, and reduces the page requests.
Take a look at this images to compare before and after:

BEFORE:

AFTER:

 

 

You Can also use third party plugins like Fooman,GTspeed. To speed up your Webstore You can get the plugins from MagentoConnect.

What these Plugins will Actually do?

They'll minify your css by eliminating whitespaces, comments, and merges them all.

Enables Caching, Which Prevents unnecessary requests.

Merges the Javascripts, and reduces the Page loading time.

This is a simple idea, can help your Webstore to load faster.

Hope this one helps you.

 

 



Installing Bigbluebutton in Ubuntu

clock June 5, 2013 19:45 by author AkraTech

 

Step 1: Download the virtual box from UBUNTU SOFTWARE CENTER

Step 2: Download the “vm” disk from http://www.bigbluebutton.org

Step 3: Run the “vm” disk in the virtual box

Step 4: Change Default Password

When it's done, you'll see a login prompt. NOTE: The VM has been pre-configured to have the following user-id/password:

user-id: firstuser

password: default

Step 5: They will be asked to change the password for security reasons and hence do it

Step 6: Upgrading the BigBlueButton VM

# sudo apt-get update

# sudo apt-get dist-upgrade

Step 6a: In BigBlueButton Settings>>Network>>Adaptor 1(Bridged adaptor)

Step 6b: In Virtual box File>>Preferences>>Network>>Add host-only network (lns)

              Double Click vboxnet0 and give adapter “IPv4” and “netmask” address

Step 7: In the terminal type “sudo vi /etc/network/interfaces” and give static ip

                        For ex: auto eth0

                                     iface eth0 inet static

                                     address 192.168.0.190

                                      netmask 255.255.255.0

                                       gateway 192.168.0.1

                       

Step 8:In the terminal type “sudo vi /etc/resolv.conf” and edit the file to

       nameserver : “your DNS”    For ex: “8.8.8.8”

       nameserver : “your DNS”   “8.8.4.4” is mine

Step 9:Then type “sudo /etc/init.d/networking restart” .

Step 10: First, check in VMWare Player that has networking set to bridged. Next, type

   ping google.com

You should get some ping results

   PING google.com (72.14.204.99) 56(84) bytes of data.

   64 bytes from iad04s01-in-f99.1e100.net (72.14.204.99): icmp_seq=1 ttl=54 time=4.54 ms

   64 bytes from iad04s01-in-f99.1e100.net (72.14.204.99): icmp_seq=2 ttl=54 time=4.42 ms

Step 11: If not, it means that the VM is unable to acquire an IP address from a DHCP server on the network. If there is a DHCP server, you can try

   sudo /etc/init.d/networking restart

Step 12: Next, you can manually finish the setup to BigBlueButton with the following commands:

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install bigbluebutton

Step 13: Install API Demos

To interactively test your BigBlueButton server, you can install a set of API demos.

    sudo apt-get install bbb-demo

Step 14: Do a Clean Restart

To ensure BigBlueButton has started cleanly, enter the following commands:

   sudo bbb-conf --clean

   sudo bbb-conf –check

The --clean option will clear out all the log files for BigBlueButton. The --check option will grep through the log files looking for errors.

The output from sudo bbb-conf --check will display your current settings and, after the text, " Potential problems described below ", print any potential configuration or startup problems it has detected.

This will check your setup to ensure the correct processes are running, the BigBlueButton components have correctly started, and look for common configuration problems that might prevent BigBlueButton from working properly. For example, here's the output on one of our internal servers

Step 15: If you see text after the line ** Potential problems described below **, then bbb-conf detected something wrong with your setup.

Dependencies are not met

For some VPS installations of Ubuntu 10.04, the hosting provider does not give a full /etc/apt/source.list. If you are finding you are unable to install a package, try replacing your/etc/apt/sources.list with the following

# deb cdrom:[Ubuntu-Server 10.04 LTS _Lucid Lynx_ - Release amd64 (20100427)]/ lucid main restricted

# deb cdrom:[Ubuntu-Server 10.04 LTS _Lucid Lynx_ - Release amd64 (20100427)]/ lucid main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

# newer versions of the distribution.

deb http://us.archive.ubuntu.com/ubuntu/ lucid main restricted

deb-src http://us.archive.ubuntu.com/ubuntu/ lucid main restricted

## Major bug fix updates produced after the final release of the

## distribution.

deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates main restricted

deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team. Also, please note that software in universe WILL NOT receive any

## review or updates from the Ubuntu security team.

deb http://us.archive.ubuntu.com/ubuntu/ lucid universe

deb-src http://us.archive.ubuntu.com/ubuntu/ lucid universe

deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe

deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team, and may not be under a free license. Please satisfy yourself as to

## your rights to use the software. Also, please note that software in

## multiverse WILL NOT receive any review or updates from the Ubuntu

## security team.

deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse

deb-src http://us.archive.ubuntu.com/ubuntu/ lucid multiverse

deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse

deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse

## Uncomment the following two lines to add software from the 'backports'

## repository.

## N.B. software from this repository may not have been tested as

## extensively as that contained in the main release, although it includes

## newer versions of some applications which may provide useful features.

## Also, please note that software in backports WILL NOT receive any review

## or updates from the Ubuntu security team.

# deb http://us.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse

# deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's

## 'partner' repository.

## This software is not part of Ubuntu, but is offered by Canonical and the

## respective vendors as a service to Ubuntu users.

# deb http://archive.canonical.com/ubuntu lucid partner

# deb-src http://archive.canonical.com/ubuntu lucid partner

deb http://security.ubuntu.com/ubuntu lucid-security main restricted

deb-src http://security.ubuntu.com/ubuntu lucid-security main restricted

deb http://security.ubuntu.com/ubuntu lucid-security universe

deb-src http://security.ubuntu.com/ubuntu lucid-security universe

deb http://security.ubuntu.com/ubuntu lucid-security multiverse

deb-src http://security.ubuntu.com/ubuntu lucid-security multiverse

then do

Step:16  sudo apt-get update

Step:17 Change the BigBlueButton Server's IP

A common problem is the default install scripts in for BigBlueButton configure it to list for an IP address, but if you are accessing your server via a DNS hostname, you'll see the 'Welcome to Nginx' message.

To change all of BigBlueButton's configuration files to use a different IP address or hostname, enter

     “sudo bbb-conf --setip <ip_address_or_hostname>”

Step :18 sudo apt-get install -f.

 

 



Installing Joomla on Ubuntu Server

clock June 5, 2013 18:51 by author AkraTech

Download Joomla

Step 1:To start, create a directory where you will keep your Joomla files temporarily:

mkdir temp

Step 2: Switch into the directory

cd temp

Step 3: Then you can go ahead and download the most recent version of Joomla, Currently, the latest version is 2.5.7.

 http://joomlacode.org/gf/download/frsrelease/17410/76021/Joomla_2.5.7-Stable-Full_Package.tar.gz

 

Step 4: This command will download the zipped Joomla package straight to your user's home directory on the virtual server. You can untar it with the following command, moving it straight into the default apache directory, /var/www

sudo tar zxvf Joomla_2.5.7-Stable-Full_Package.tar.gz  -C /var/www

Configure the Settings

Step 5:Once the Joomla files are in the web directory, we alter a couple of permissions to give access to the Joomla installer. First create a Joomla configuration file and make it temporarily world-writeable

sudo touch /var/www/configuration.php

sudo chmod 777 /var/www/configuration.php

After the installation is complete, we will change the permissions back down to 755, which will make it only writeable by the owner.

Create the Joomla Database and User

Step 6:Now we need to switch gears for a moment and create a new MySQL directory for Joomla. 

Go ahead and log into the MySQL Shell

mysql -u root -p

Step 7:Login using your MySQL root password. We then need to create the Joomla database, a user in that database, and give that user a new password. Keep in mind that all MySQL commands must end with semi-colon. 

First, let's make the database (I'm calling mine Joomla for simplicity's sake—for a real server, however, this name is not very secure). Feel free to give it whatever name you choose:

CREATE DATABASE joomla;

Query OK, 1 row affected (0.00 sec)

Step 8: Then we need to create the new user. You can replace the database, name, and password, with whatever you prefer

CREATE USER juser@localhost;

Query OK, 0 rows affected (0.00 sec)

Step 9: Set the password for your new user

SET PASSWORD FOR juser@localhost= PASSWORD("password");

Query OK, 0 rows affected (0.00 sec)

Step 10: Finish up by granting all privileges to the new user. Without this command, the Joomla installer will be able to harness the new mysql user to create the required tables

GRANT ALL PRIVILEGES ON joomla.* TO juser@localhost IDENTIFIED BY 'password';

Query OK, 0 rows affected (0.00 sec)

Step 11: Then refresh MySQL

FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

Step 12: Exit out of the MySQL shell

exit

Step 13: Restart apache

sudo service apache2 restart

Access the Joomla Installer

Step 14: Once you have placed the Joomla files in the correct location on your VPS, assigned the proper permissions, and set up the MySQL database and username, you can complete the remaining steps in your browser.

Access the Joomla installer going to your domain name or IP address. (eg. Example.com) 

Once you have finished going through the installer, delete the installation folder per Joomla’s instructions and change the permissions on the config file

sudo rm -rf /var/www/installation/

sudo chmod 755 /var/www/configuration.php



Installing Moodle on Ubuntu Server

clock June 5, 2013 18:13 by author AkraTech

Moodle currently available in the officially Ubuntu repository, but it still in version 1.9. On Ubuntu server 12.04.

 

Step 1: First, Make sure Apache2 web server, MySQL database and PHP5 (called LAMP Server) already installed on Ubuntu server 12.04.

sudo apt-get install lamp-server^

Step 2: Make sure LAMP server has been installed on Ubuntu Server 12.04.

sudo apt-get install lamp-server^ php5-intl

Step 3: Download the installation archive from the Moodle download page, download it using wget command

wget -O moodle-latest.tgz http://sourceforge.net/projects/moodle/files/Moodle/stable23/moodle-latest-23.tgz/download

Step 4: Extract moodle-latest.tgz and copy or move in to directory /var/www

tar -zxvf moodle-latest.tgz

sudo mv moodle /var/www

Step 5: Change an ownership of all Drupal installation files to user and group (www-data).

sudo chown -R www-data:www-data moodle/

Step 6: Create directory for moodle data, then set access directory moodle data to user and group (www-data)

sudo mkdir /var/moodledata

sudo chown -R www-data:www-data /var/moodledata

Step 7: Create a MySQL database for moodle installation. Log in to mysql server as root user

mysql -u root -p

Step 8: Create mysql database with name “dbmoodle”

CREATE DATABASE dbmoodle;

ALTER DATABASE dbmoodle charset=utf8;

 

Step 9: Create MySQL database user with username “moodleuser”

CREATE USER moodleuser;

Step 10: Set password for user “moodleuser”

SET PASSWORD FOR moodleuser = PASSWORD("moodlepass");

Step 11: Set privilege for “moodleuser”, and then log out from MySQL server

GRANT ALL PRIVILEGES ON dbmoodle.* TO moodleuser@localhost IDENTIFIED BY "moodlepass";

quit

 

Step 12: Now Moodle ready to install via web browser, open your favorite browser then navigate to [http://ipserver/moodle], and the installation can be completed in the browser.



A start up is an exciting place to work - here is why

clock June 5, 2013 16:13 by author AkraTech

 

Notice the table fan , and yes an environment which encourages Agile Extreme Programming 

 

 



Updating multiple rows in a table using xml datatype - Sql Server

clock June 5, 2013 15:40 by author AkraTech

We often get requirements from customers that multiple rows needs to be edited and saved at once to the database . As in the example below: 

Suppose the rows in the screen shot below need to be updated at once in a single transaction and a single update statement without multiple updates .

 

 

One way of achieving this is using the xml datatype parameter in a Stored Procedure.We can form a xml document in the code and pass it to a stored procedure

Exec UpdateStudentpercentage

 '<ID><StudentID>1</StudentID><Percentage>60</Percentage></ID>

 <ID><StudentID>2</StudentID><Percentage>70</Percentage></ID>

 <ID><StudentID>3</StudentID><Percentage>90</Percentage></ID>

 <ID><StudentID>4</StudentID><Percentage>100</Percentage></ID>

 <ID><StudentID>5</StudentID><Percentage>40</Percentage></ID>

 <ID><StudentID>6</StudentID><Percentage>60</Percentage></ID> 

 <ID><StudentID>7</StudentID><Percentage>35</Percentage></ID>'

 

 

And the xml document can be loaded from the stored procedure and updated using a single update statement as in the following code snippet.
Create Procedure [dbo].[UpdateStudentPercentage]
@values Xml
as
Begin

    Declare @tabvar table
    ( StudentId int , Percentage int )
    Insert Into @tabvar ( StudentId , Percentage )
    Select t.value ( 'StudentID[1]','int' ) As ID , t.value ( 'Percentage[1]','float') As Per
    From @values.nodes('/ID') As T (t)
 
   Declare @count int = @@ROWCOUNT
 
      Update Student
       set Percentage = t.Percentage
        From @tabvar t Left Join Student s on (t.StudentId = s.StudentID)
        
End

   



CRUD Using Dapper a lightweight ORM Framework

clock June 4, 2013 19:58 by author AkraTech

 

Dapper.NET is a Micro ORM written by the developers behind Stack Overflow. It is simple to use, and is compatible with any database which implements a provider for .NET (i.e.: provides an implementation of the IDbConnection interface).We have been using Dapper.Net extensively for our projects.

Here is Small Example to Implement Dapper.NET 

We have an Entity class Employee with following properties: 

public class Employee
{
    public int EmployeeID { get; set; }
    public string Name { get; set; }
    public string Location { get; set; }
    public string Salary { get; set; }
}

 

Ex:1 This is example shows how to retrieve values from database using Dapper

 

public IEnumerable<Employee> SelectEmployeeDetails()
{
using (IDbConnection connection = OpenConnection())
    {
        const string query = "SELECT EmployeeID, " +
              " Name,  Location , Salary FROM Employee " ;
        return connection.Query<Employee>(query);
    }
}

Ex2: Instead of writing inline query statements here it demonstrates by using stored procedure

 

public int AddNewEmployee(Employee value)
        {
            var parameters = new DynamicParameters();
            parameters.Add("@Name", value.Name, DbType.Int32, ParameterDirection.Input);
            parameters.Add("@Location",value.Location, DbType.String, ParameterDirection.Input);
            using (IDbConnection connection = OpenConnection ())
            {
                const string storedProcedure = "dbo.DeleteUsers";
               int rowsaffected = connection.Execute(storedProcedure, parameters,                                                                               commandType:CommandType.StoredProcedure);
               return rowsaffected;
            }
        }

 

 

Ex3: Dapper.NET supports Transactions. For Example, the following code deletes the employee record from company  table as well as  the employee table:

 

public int DeleteEmployeeRecord(Employee value)
{
try
{
    using (IDbConnection connection = OpenConnection())
    {               
        const string deleteEmployeeFromCompany = "DELETE FROM Company " +
                                                                                      "WHERE EmployeeID = @ EmployeeID ";
        const string deleteEmployeeDetails = "DELETE FROM Employee" +
                                                                           " WHERE EmployeeID = @ EmployeeID ";
        IDbTransaction transaction = connection.BeginTransaction();
        int rowsAffected = connection.Execute(deleteEmployeeFromCompany, new { EmployeeID = value.EmployeeID}, transaction);
        rowsAffected += connection.Execute(deleteEmployeeDetails,  new { EmployeeID = value.EmployeeID}, transaction);
        transaction.Commit();
        return rowsAffected;
    }
 }
catch (Exception ex)
     {
         transaction.Rollback();
     }
 }

 



Start / Stop Windows Services using C# / ASP.NET

clock May 28, 2013 19:27 by author AkraTech

Usually applications have windows services to be started / stopped , why have a Windows Administrator login and start / stop a service when this can be done remotely from the Asp.net Web site itself?

To accomplish this you need to add System.ServiceProcess reference in your application. This namespace holds ServiceController Class to access the windows service. By default, IIS application runs under ASP.NET account which doesn't have access rights permission to windows service. So, main thing is  Impersonation. You need to impersonate the application/part of the code with the User Credentials which is having proper rights and permission to access the windows service. Unless, If you try to access windows service it will generate "access denied" error. To Overcome this you can  impersonate the application by adding Identity tag in web.cofig as:

<identity impersonate="true" userName="XYZ" password="XYZ"/>

under System.Web and the user impersonated should have rights to access the Windows Service

You can just call ServiceController class  Start() and Stop() methods to start or stop a window service.

 

 

//Code to start the windows service

public void StartService()
    {
        try
        {
            ServiceController sc = new ServiceController();
             sc.ServiceName = "Servicename";
            if (sc.Status != ServiceControllerStatus.Running && sc.Status != ServiceControllerStatus.StartPending)
            {
                sc.Start();
            }
      }
        catch (Exception ex)
        {
             throw ex;
        }
 }

//Code to stop the windows service

 public void Stopservice()
    {
        try
        {
            ServiceController sc = new ServiceController();            
            sc.ServiceName = "Servicename";
            if (sc.Status == ServiceControllerStatus.Running)
            {
                sc.Stop();
            }

        }
        catch (Exception ex)
        {
            throw ex;
        }
  }

//Code to check the status of the windows service

 public List<string> ServiceStatus()
    {
        try
        {
	    List<string> serviceList = new List<string>();
            string[] services = new string[] { "service1", "service2", "service3", "service4" };
           ServiceController sc = new ServiceController();
	    foreach (string servicesname in services)
            {
                sc.ServiceName = servicesname;
                if (sc.Status == ServiceControllerStatus.Stopped)
                {
                    serviceList.Add("Stopped");
                  
                }
                else { serviceList.Add("Running"); }
            }
            return serviceList;
        }
        catch (Exception ex)
        {
            throw ex;
        }

    }
 

 

 

 



C# Visitor Pattern - A simple example

clock May 25, 2013 15:36 by author AkraTech

Visitor Pattern

Developers find it difficult to understand and implement the Visitor Pattern.Below is a simple example which shows how to implement and use the Visitor Pattern in C#.

 

Visitor Design pattern is a way of Injecting Operations into a concrete entity without modifying its object structure . A concrete Object is made “visitable” and Visitor “visits” the concrete object to perform operations

Class Diagram

 

Source Code

Visitor Interface

 

 interface IVisitable    {

        void Accept(IIncomeVisitor visitor);

    }

 

Visitable Interface

interface IVisitable    {

        void Accept(IIncomeVisitor visitor);

    }

A Sample Visitor

     class TaxVisitor : IIncomeVisitor

    {

        double tax;

        public void Visit(Income i)

        {

            tax = i.TotalIncome * 0.40;

        }

 

        public double ValueDeducted

        {

            get { return tax; }

        }

    }

 A  Concrete "Visitable" Class

 

    class Income : IVisitable

    {

        int m_totalIncome = 0;

 

        public int TotalIncome

        {

            get { return m_totalIncome; }

            set { m_totalIncome = value; }

        }

 

        public Income(int totalIncome)

        {

            m_totalIncome = totalIncome;

        }

 

        public void Accept(IIncomeVisitor visitor)

        {

            visitor.Visit(this);

        }

    }

 

Sample Code attached

 



About AkraTech - A Technology Startup

clock May 23, 2013 21:21 by author AkraTech

AKRA TECH established in 2007 is an IT services company providing a broad spectrum of IT services that include Enterprise Application Development , Support & Maintenance,Web Design & Development ,Consulting and Training.

Over the years we have built experience across Healthcare and Education domains and offering solutions in E-Learning,E-Commerce ,E-Reporting and Mobile development . We have a very strong expertise across various technologies in Microsoft and Open Source platforms. We have a proven track record in delivering outsourced projects, applying the right methodology keeping in line with our customer’s expectations and needs.



Calendar

<<  August 2016  >>
MoTuWeThFrSaSu
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Page List

    RecentComments

    None

    Sign In