Friday, August 7, 2015

Using Nano Editor to set static IP

Previously i have use to using GUI to change the IP address on Ubuntu, but now come to server and there is no GUI, so I have force to learn using command to change the IP address.

Here is the guide to set static IP address on  Linux Ubuntu  by using the Nano text editor.

sudo nano /etc/network/interfaces

so do not miss out the s in interface word, else the Linux unable to recognize your command. Due to changing system setting, it may prompt you the password for root. Once you entered the password and you may see the something as below.

auto lo eth0
iface lo inet loopback
iface eth0 inet dynamic
eth0 is the network card name, as you have more than 1 network card, it may have few name. So make sure the name of the interface. you may verify your interface card by using the ifconfig to show the list of interface and interface details.

so you may manually to change the file by using the nano editor. Below is my example and please take note that the iface eth0 inet dynamic  change to static.

auto lo eth0
iface lo inet loopback
iface eth0 inet static
 address 192.168.1.101
 netmask 255.255.255.0
 gateway 192.168.1.1

after you complete change, press Ctrl + x to save the change. The editor will promt you

Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?

Type Y to accept the change then press enter to save the file.

After you save the config file, you may restart the interface to make change. Type below command to down the interface

sudo ifdown eth0

and

sudo ifup eth0

to up the interface.

LAMP Installation guide.

Finally finsh the development for the project. Now is the time to host the application on server. Due to cost saving concern, the application will host on a Linux node in VM. So LAMP is the choice we have decide to deploy and host the application. LAMP basically is the acronym of Linux, Apache, MySQL and PHP.

As previously I am using the XAMPP to start the PHP project development on Window. So now I have to deploy all the file into this new Linux node.

It is quite difficult to me as I have little knowledge on Linux Ubuntu and all have to use command to perform the installation. After go through the installation, I found that it quite simple but 1 thing is you have to know the command and mind your typed text else the command unable to execute.

Before begin the installation, make sure that you have connect to internet.

So start with install Apache. Below is the command to install the Apache. You may just copy paste the command.

sudo apt-get install apache2

after install Apache, no need to rush to start the service. Let continue with install Mysql with command below.

sudo apt-get install mysql-server

And now install the PHP.

sudo apt-get install php5 libapache2-mod-php5

Well, we have finish the installation for Apache, MySQL and PHP. So now we going to start the service.

sudo /etc/init.d/apache2 restart

after start the Apache service, you may use a browser to test the service. You may just type http://ipaddressofthehost/ on web browser to test it. It will respond a success page with it works!


And now the LAMP is success installed.


Thursday, August 6, 2015

Window 7 Sharing issues with XP

For a network that with different OS version might have facing this issues as the older version of Windows unable to access the share folder on Window 7. The error message as below. For this error message we can know that it related to permission issues. So you might play around with the access right.


While you already make sure your access right is correct and the folder is accessible by Windows 7. This may be the window registry issues.

Solution:

1. Go the the particular Window 7 machine that sharing the folder. Locate to the following registry key and change it's value to 1. You may refer to this link for further study.

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache

2. Locate this next key and change it to 3, this is just that "Server" service (or part of it) setting

HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size

Restart the Window 7 and now the problem should be solve.

Friday, July 3, 2015

C# with MySQL Error

Recently doing a project using c# connect to MySql server. For sure the connectio is require connection driver so that I have download and install the latest version of MySql connector version (6.9.6).

This is the first time I am using c# to establish the connection with the server. Some how I hit error during the development. So now here I am to share the issues and solution. And I aware that this is MySql connector bugs.

Here the Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
 
Parser Error Message: Unable to connect to any of the specified MySQL hosts.
 
Source Error:
 

Line 283:    <siteMap>
Line 284:      <providers>
Line 285:        <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 286:      </providers>
Line 287:    </siteMap>
 
Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config    Line: 285

There is many solution say that if can resolve by commnet out the particular line of config in machine.config file. You may try this soltion since there is some people mention they albe to resolve it by this. The path of machine.config file as below:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config 
<!--        <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, 

MySql.Web.v20, Version=6.9.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" 

connectionStringName="LocalMySqlServer" applicationName="/" /> -->
Reference: http://bugs.mysql.com/bug.php?id=74080&thanks=1&notify=71
But this solution not work for me.
So the next solution is to change the installation file by go to control panel -> program -> select MySql connector and select change. un-check the web provider and next all the way. Then the issues resolve. Hope it help.


Friday, June 12, 2015

XAMPP Port Issues

When I want to start a PHP development project, I use to face port issues during setup the XAMPP. You will face this issues where the Skype, VM Ware, or team viewer installed in your PC. The port is utilize by these few software so that your Apache service is unable to start.

This problem can easily solve by changing the port number if Apache. Click on the Config button on the XAMPP Control panel that same row with the Apache service. It will show a menu and select the Apache (https.conf) and it will open the config file with notepad. Using find/search (Ctrl +F) to find port number 80 and change it to a free port and the port you prefer. In my example below i change it to 8088

Snippet for port 80.

# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 8088

#
# Dynamic Shared Object (DSO) Support


And same goes to the secure port by choosing Apache (httpd-ssl.conf).


Snippet for SSL port number

# When we also provide SSL we have to listen to the
# standard HTTP port (see above) and to the HTTPS port
#
Listen 4443

##
##  SSL Global Context




After change your port number, restart the service and now you can access your site with provide the port number as below.

http://localhost:8088/testingSite/index.php

Bind Date Time in Gridview

During development, when try to bind data to a date time control in gridview, it successfully insert data in DB from the date time control. When try to retrieve back from DB and bind it to the date time control. There is always an empty field. So here my solution.

At aspx page, add a control to hold the value and make it visible to false.

<asp:Label ID="lblDate" Text='<%#Eval("PurchaseDate", "{0:dd MMM yyyy}") %>' runat="server" Visible="false" />

When the page load or any action trigger the reload of the gridview, the RowDataBound will bound the data row by row. So that we can use RowDataBound method to bind the data from label to the date time control.
Below is the code behind snippet.

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
 {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lblDate = (Label)e.Row.FindControl("lblDate");
                DateTimeControl dtDate = (DateTimeControl)e.Row.FindControl("PurchaseDate");

                if (!string.IsNullOrEmpty(lblDate.Text))
                {
                    dtDate.SelectedDate = Convert.ToDateTime(lblDate.Text);
                }
            }
}

Wednesday, May 13, 2015

Backup MS SQL Server

In order to ensure the database data is always goes well, so here I am to blog on how to perform the backup for MS SQL. For sure you may need to have access to the database server by using the SQL Server Management Studio. Select the database that you wish to backup and right click -> task -> backup


After the action, there will be a new window pop up and that the configuration page that how the backup to be done. There is few backup type available and in my case i would like to perform a full backup to backup the entire database. At the bottom there is a destination of the backup, if you wish to change it, you may need to remove it. For adding the custom backup destination, click on add and select the destination of the directory. 


There is more backup option available which locate at top right of the window. Select the Option, you may see the overwrite media configuration. You may able to replace the backup by select Overwrite all existing backup sets. So old the old backup file will be replace with the new backup.

After finish configure, it will start the backup process


Lastly, when the backup is finish, there will prompt a message.