Search This Blog

Tuesday, October 22, 2013

SQL Statements - DML, DDL,DCL

SQL Server > SQL Statements

SQL Statements are used for querying with database

Data Manipulation Language (DML)

Data Definition Language (DDL)

Data Control Language (DCL)
  • Grants or remove rights to database and structures within it






Monday, October 21, 2013

Run exe from SQL Server

SQL ServerSystem Stored Procedures > xp_cmdshell

xp_cmdshell is an extended stored procedure provided by Microsoft and stored in the master database.
This procedure allows you to issue operating system commands directly to the Windows command shell via T-SQL code.

Example: How to run executable from SQL Server?

exec master.dbo.xp_cmdshell 'mkdir "c:\MyDir\"'









Thursday, October 17, 2013

Class and object C#

C# > OOP > Class and object


A class is an abstraction of the characteristics and behavior of an object type. Classes can inherit from one other class, but can implement multiple interfaces.
A class is a template for defining objects.
A class should not be confused with an object.
An object is an instance of a class.




Difference between class and object

Class is like a template or blueprint of the object and resides on hard disk.
Object is real world implementation of a class and resides on RAM.

Example:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public class Person // define Person class
    {
        public string Name { get; set; } // Name property
    }

    public partial class Form1 : Form
    {
        private void Form1_Load(object sender, EventArgs e)
        {
            Person p1 = new Person(); // create new Person object
            p1.Name = "Dan";
        }
        public Form1()
        {
            InitializeComponent();
        }
     }
}

 





Wednesday, October 16, 2013

Determine control ToolStripItem was clicked on

C# > Controls > ContextMenuStrip


Scenario:
We have many labels on forms and one ContextMenuStrip. How can we find the control which was clicked?

Solution:

private void copyToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            ToolStripItem menuItem = sender as ToolStripItem;
            if (menuItem != null)
            {
                ContextMenuStrip owner = menuItem.Owner as ContextMenuStrip;
                if (owner != null)
                {
                    Control sourceControl = owner.SourceControl;
                    Label lbl = sourceControl as Label;
                }
            }
        }





Monday, October 14, 2013

Print preview dialog full screen C#

C# > PrintPreviewDialog > Full Screen



PrintPreviewDialog dlg = new PrintPreviewDialog();
((Form)dlg).WindowState = FormWindowState.Maximized;
dlg.ShowDialog();





Center DIV

CSS margin property sets all the margin properties (top, right, bottom, left).

<div style="border: thin solid #C0C0C0; width: 800px;margin:0 auto;">
        centered content
</div>





Sunday, October 6, 2013

Remove Qone8 browser hijacker malicious software

Qone8 is a browser hijacker, which is installed via other free downloads, and once installed it will change your browser homepage to start.qone8.com and default search engine to search.qone8.com.
It is considered malicious because it will append the argument http://start.qone8.com/ to random Windows shortcuts on your desktop and your Windows Start Menu.






Remove instructions:

1. Go to your software browser shortcut. Right click and then click on Properties

2. Goto to Shortcut Tab and than delete the text appears rights to name of the executable (argument value)


3. Goto to Internet options and change the home page

4. Close and restart your browser