Apr 232017
 

It’s easy to uninstall using apt-get tool (if you used apt-get tool before to install the application package).

To search for name of the package in the system, type:

dpkg --list | grep <search term>

for example: dpkg –list | grep “Grub” (try to find grub in the package list command)

In order to remove the application with app-get, type in:

sudo apt-get --purge remove <application name>



For example: sudo apt -purge remove grub-customzier

Feb 262017
 

Reference link: https://help.ubuntu.com/community/How%20to%20Create%20a%20Network%20Share%20Via%20Samba%20Via%20CLI%20(Command-line%20interface/Linux%20Terminal)%20-%20Uncomplicated,%20Simple%20and%20Brief%20Way!


Use samba server installed on your Ubuntu server allow you to easily share a folder from Ubuntu Linux with other network users.

1. Install Samba Server:

sudo apt-get update
sudo apt-get install samba

2. Set a password for a user in Samba. This is the user name password combination you will use when you try to access the Samba share from the network. Such as from your Windows PC.

sudo smbpasswd -a <user name>

3. Create a folder to be shared on Samba:

mkdir /home/<user name>/ShareUbuntu

Note that you have to have permission to that folder you want to shared.

4. Edit the Samba Configuration file:

sudo nano /etc/samba/smb.conf

5. Add the following lines to the end of the config file:

[ShareUbuntu]
path = /home/<user name>/ShareUbuntu
valid users = <user name>
read only = no

valid users is list of the users you added Samba password in step #2.

6. Restart the Samba server:

sudo service smbd restart

Now you can access this share folder called ShareUbuntu from inside of your network.

Feb 252017
 

In Linux, you can try use this command:

netstat -tlnp

Normally it’s set to run on port 3306. This command shows you something like:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      25934/mysqld

Alternatively, you can login to MySQL, and run the following:

mysql> SHOW GLOBAL VARIABLES LIKE 'PORT';
Feb 242017
 

It’s fairly easy to export all the records that are on your Data Grid View to Excel. The code below shows you how to Run Microsoft Excel Interop and go through each rows and columns in data grid view, and write manually to an Excel worksheet, save the excel file.

The good thing is that you can export anything that you can load into the Data Grid View. The bad thing is that it’s manual dumping of each values in data grid into Excel cells, if you have a lot of data in the grid, it could take a while to populate.



Pre-requisite: to use this, you need to add a new reference to the assembly Microsoft Excel.
Go to Add reference >> COM >> Add “Microsoft Excel 12” or Microsoft Excel 15 depends on the version of Office you have installed.

The dgv_SQL is a DataGridView Control.


if (dgv_SQL.DataSource != null)
            {
                try
                {
                    //this code requires Excel object
                    // go to add reference, COM, Microsoft Excel 12 or 15 object
 
                    // creating Excel Application
                    Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application();
                    // creating new WorkBook within Excel application
                    Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing);
                    // creating new Excelsheet in workbook
                    Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
                    // see the excel sheet behind the program
                    app.Visible = true;
 
                    // get the reference of first sheet. By default its name is Sheet1.
                    // store its reference to worksheet
                    worksheet = workbook.Sheets["Sheet1"];
                    worksheet = workbook.ActiveSheet;
 
                    // changing the name of active sheet
                    worksheet.Name = "Any worksheet name here is good";
 
 
                    // storing header part in Excel
                    for (int i = 1; i < dgv_SQL.Columns.Count + 1; i++)
                    {
                        worksheet.Cells[1, i] = dgv_SQL.Columns[i - 1].HeaderText;
                    }
 
                    // storing Each row and column value to excel sheet
                    for (int i = 0; i < dgv_SQL.Rows.Count - 1; i++)
                    {
                        for (int j = 0; j < dgv_SQL.Columns.Count; j++)
                        {
                            worksheet.Cells[i + 2, j + 1] = dgv_SQL.Rows[i].Cells[j].Value.ToString();
                        }
                    }
 
 
                    // save the application
                    workbook.SaveAs("c:\\output.xlsx", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
 
                    // Exit from the application, app.Quit() will close Excel
                    //app.Quit();
                }catch (System.Exception ex)
                {
 
                }
Feb 232017
 

By default, you’re not allowed to connect to your MySQL database from other machine.

To enabled that, you first need to set a password to root user in your MySQL Database:

mysqladmin -u root password 'password'

To login to MySQL, use

mysql -u root -p

Once you login to your MySQL, use the following command in MySQL:

GRANT ALL on *.* to 'username'@'localhost' identified by 'password';
FLUSH PRIVILEGES;
Feb 232017
 

Here’s the simplest way to enable SSH Remote login with Putty to your Ubuntu Linux server.

In your Ubuntu Linux server:

sudo apt-get update
sudo apt-get install openssh-server
sudo ufw allow 22

the first line tells linux to update package
the 2nd line tells Linux to install openssh-server
the 3rd line tells linux firewall to allow access to port 22 (used by Putty).

Now you should be able to remote login to your Ubuntu Linux server by using Putty.

Feb 172017
 

In Oracle PL/SQL, you can put in your script that would give the user a choice to either go on or quit. The following example gives you a prompt then a user choice of Y or N. Based on the user choice Y or N. Selected block is executed.

 


SET ECHO OFF
SET FEEDBACK ON
SET PAGES 99999
SET verify off
 
Spool AUDIT_INCREMENTS_FIX.log
 
select 'Current Audit related Increments in table: ' FROM dual;
select MINOR, LASTVAL FROM INCREMENTS where MAJOR = 'AUDITOR';
 
select 'Max DATA: ' || max(DATA) from AUDIT_DATA;
select 'Max EVENT: ' || max(EVENT) from AUDIT_EVENT;
select 'Max TRANSACTION: ' || max(TRANSACTION) from AUDIT_TRANSACTION;
 
accept choice prompt 'Fix Increments for audit (Y/N)?';
begin
    if '&choice' = 'Y' then
        -- update the increments
        update INCREMENTS set LASTVAL = (select max(DATA) from AUDIT_DATA) 
        WHERE MAJOR = 'AUDITOR' and MINOR = 'DATA';
 
        update INCREMENTS set LASTVAL = (select max(EVENT) from AUDIT_EVENT) 
        WHERE MAJOR = 'AUDITOR' and MINOR = 'EVENT';
 
        update INCREMENTS set LASTVAL = (select max(TRANSACTION) from AUDIT_TRANSACTION) 
        WHERE MAJOR = 'AUDITOR' and MINOR = 'TRANSACTION';
 
        commit;
    else
        SELECT 'Did not update.' from dual;
    end if;
end ;
 
 
SELECT 'Audit related Increments After the fix: ' from dual;
SELECT * FROM INCREMENTS where MAJOR = 'AUDITOR';
 
spool off
Feb 012017
 

To allow others from access an alias directory on your apache server, so you can always login to something like phpmyadmin, or phpsysinfo from outside. You need to update the .conf file for the alias.

the config file is located in your /alias/ folder.

The most important thing is Required all granted, and Allow from all.

After you updated the conf file, need to start apache.

For example, to allow access from remote access to my alias phpmyadmin.conf


Alias /phpmyadmin "E:/wamp64/apps/phpmyadmin4.6.4/"
 
&lt;Directory "E:/wamp64/apps/phpmyadmin4.6.4/"&gt;
	Options Indexes FollowSymLinks MultiViews
  AllowOverride all
 
		Require all granted
 
 
		Order Allow,Deny
    Allow from all
#   Allow from localhost ::1 127.0.0.1
	
 
# To import big file you can increase values
  php_admin_value upload_max_filesize 128M
  php_admin_value post_max_size 128M
  php_admin_value max_execution_time 360
  php_admin_value max_input_time 360