How to find pen drive hidden folder

Sometimes due to virus attack, our pen drive data is hidden.  We think, all folders are deleted. So, check first before you format your Usb otherwise you will lose your data forever.  Sometimes hidden files are not displayed even if you “Show hidden files and folders” in the Folders Options. To find hidden folder in your pen drive. Just run the following command in your command window.

attrib -h -r -s /s /d g:\*.*

For accurate command just copy the above command and pest it. Here g: is considered your pen drive.  Replace g by your pen drive “drive letter”

Create, Drop, Insert, Update, Delete and Select – The Basic SQL

This topic for those who are very beginner of SQL. Here I will show some basic SQL by Microsoft SQL Server.

1. Create a table: Here I created a table name hrm_employee. Here emp_gid is int type, primary key and identity. Identity means its value will increment automatically by the sql server. You don’t need to insert it’s value.

--Create Table : hrm_employee---
CREATE TABLE hrm_employee
(
emp_gid INT PRIMARY KEY IDENTITY,
emp_fullnm VARCHAR(100),
emp_nicknm VARCHAR(50),
emp_designation VARCHAR(100)
)

2. Insert data in hrm_employee table: In this occasion, I have inserted 3 data i.e 3 rows. If you see in closer look, you will see that I didn’t insert any value of emp_gid because it increments its value automatically because it is an identity column.

--Insert data ito table: hrm_employee----

-- Insert data i.e. row-1 ---
INSERT INTO hrm_employee
(
emp_fullnm
, emp_nicknm
, emp_designation
)
VALUES
(
'Md. Mahedee Hasan'
, 'Mahedee'
, 'Senior Software Engineer'
)

-- Insert data i.e. row-2 ---
INSERT INTO hrm_employee
(
emp_fullnm
, emp_nicknm
, emp_designation
)
VALUES
(
'Md. Asrafuzzaman'
, 'Emon'
, 'Senior Software Engineer'
)

-- Insert data i.e. row-3 ---
INSERT INTO hrm_employee
(
emp_fullnm
, emp_nicknm
, emp_designation
)
VALUES
(
'Md. Khondakar Enamul Haque'
, 'Rony'
, 'Broadcast Engineer'
)

4. Infromation Retrive: Get all information of hrm_employee. Here I showed two ways to retrive data and I suggest to use second one. Second one is best practiced.

--Get all data from hrm_employee--
SELECT * FROM hrm_employee
--or
SELECT emp_gid, emp_fullnm, emp_nicknm, emp_designation FROM hrm_employee

5. Update hrm_employee: Is very easy to update a row or multiple rows against a condition. Lets look on the following query.

--update data from table: hrm_employee --
UPDATE hrm_employee
SET emp_fullnm = 'M.K. Enamul Haque'
, emp_designation = 'Senior Broadcast Engineer'
WHERE emp_gid = 3


6. Delete Information:
If you want to delete information from hrm_employee against a condition follow
the query.

---Delete data from table: hrm_employee---
DELETE FROM hrm_employee WHERE emp_gid = 3

7. Drop Table: Drop table means remove table for database. Use the query to drop hrm_employee table.

---Drop table i.e remove table from Database--
DROP TABLE hrm_employee

How to find the size of all tables in SQL Server database

SQL Server gives you everything its stored procedure sp_spaceused. Unfortunately this SP does not support iterating over all tables in a database, so we needed to leverage another (undocumented) Stored Procedure sp_msForEachTable.

SET NOCOUNT ON

DBCC UPDATEUSAGE(0)

-- Find DB size.
EXEC sp_spaceused

-- Create a table to counts row and sizes.
CREATE TABLE #tbl
(
[name] NVARCHAR(128),
[rows] CHAR(11),
reserved VARCHAR(18),
data VARCHAR(18),
index_size VARCHAR(18),
unused VARCHAR(18)
)

INSERT #tbl EXEC sp_msForEachTable 'EXEC sp_spaceused ''?'''

SELECT * FROM #tbl

-- # of rows.
SELECT SUM(CAST([rows] AS int)) AS [rows]
FROM #tbl

DROP TABLE #tbl

After executing this, you will get the size of all tables in your database.

How to release port 80

Few days ago, I fall in a problem. I could not start apache server by XAMP control panel. There was a message shown port 80 busy. However ultimately, I found the solution this was due to IIS server. IIS Server was running on port 80 at that time.

Here is the step by step procedure, how I release port 80

1. Go to command prompt.
2. Check which process is using port 80

  • On the command prompt window, type the following command.

    netstat -o -n -a | findstr 0.0:80

  • You will see the following screen

1
The last column is process Id column

Open Task Manager to check the process ID

  1. Right click on the taskbar to open the the task manager.
  2. Go to the Processes tab.
  3. Click the View menu
  4. And make sure you select the PID (Process Identifier) as shown in the image below.

Now you can see which process is using which PID and description like the following

Stop the services

  1. Go to Task Manager.
  2. Click the Services tab
  3. Arrange the Services by description or by
  4. For IIS I found Service name as IIS Admin
  5. Right click on it and select Stop Sevice.

Global variable of ASP.net

Global variables are those variables that can be accessed anywhere in the application. Global variable should always be used with caution. It stores data. The most common way of accessing global variables in ASP.net are by using Application, Cache, and Session Objects.

Application - Application objects are application level global variables, that need to be shared for all user sessions. Thus, data specific to a user should’nt be saved in application objects. While using application objects, the objects are locked so that multiple page requests cannot access a specific application object. Below is a code example for usage of application object…

Application.Lock();
Application("UserData") = "dotnetuncle";
Application.UnLock();
Response.Redirect("DestinationPage.aspx");
//DestinationPage.aspx gets the value from the Application State
String sString = Application("UserData").ToString();

Cache - The cache object is similar to the application object in scope, however, it does not need any explicit locking and unlocking. Code below shows usage of Cache object…

Cache("Userdata") = "dotnetuncle";
Response.Redirect("DestinationPage.aspx");

//Destination.aspx retrieves the value from Cache object
String sString = Cache("Userdate").ToString();

The cache object also shares data across all user sessions. The cache object has features like it can automatically expire cached content after specified time periods or once memory consumption has reached a maximum.

Session - The session object is used to store the data specific to a user for the entire length of a user’s visit to a website. Below is a code that shows usage of the session object in ASP.NET …

//InitialPage.aspx stores the user’s credentials in Session state
Session("UserName") = txtUserName.Text;
Server.Transfer("DestinationPage.aspx");

//DestinationPage.aspx gets the user’s name from Session state
String sString = Session("UserName").ToString();

ASP.NET stores session values in the server memory. If there are plenty of active user’s of a website, then the memory consumption on the server increases by leaps. Because of this reason, large websites use very less Session Variables. Session state can be configured to be automatically stored in a SQL Server database, or it can be configured to be stored centrally in a state server within a server farm. By default, a user’s session ends 20 minutes after their last page request and their data goes out of scope, freeing it from memory. In case user information is to be tracked by a large website, then a oookie is preferred.

Cookie – A cookie is a piece of data that is stored on a user’s browser. Thus, a cookie does not use any server memory.