Search This Blog

Monday, November 18, 2013

BLOB (Binary Large Object) Oracle Data Type

Oracle > Data Type > BLOB

A BLOB (Binary Large Object) can hold up to 4 GB of data. BLOB's are designed for storing digitized information like images, audio, video.

Example:

CREATE TABLE blob_table (id NUMBER, doc BLOB);
INSERT INTO blob_table VALUES (1, EMPTY_BLOB());

select * from blob_table




Thursday, November 14, 2013

HyperText Markup Language (HTML)

HyperText Markup Language (HTML) is markup language used for creating web pages and other data that can be displayed in a web browser.




Fix div at the bottom of the page

HTML > DIV > Fix at the bottom of the page





<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    Content
    <div style="position: fixed; bottom: 0px;">
        This is div fixed at the bottom of the page</div>
</body>
</html>
 
 

Create new WCF Service Application Example

WCF > Create WCF application

Example: use WCF method to return connection string to windows forms application in order to protect discover sensitive data using decompiling software.






1. Create new WCF Service Application

Start New Project > WCF > WCF Service Application



Go to Web.config file and set directoryBrowse to false to avoid directory browsing.

<directoryBrowse enabled="false"/>

2. Add your own methods

Open IService1.cs and add method GetConnString method


     public interface IService1
     {
        [OperationContract]
        string GetData(int value);
        [OperationContract]
        CompositeType GetDataUsingDataContract(CompositeType composite);
 

        // TODO: Add your service operations here

        [OperationContract]
        string GetConnString(string username);
    }

Open Service1.svc and add method GetConnString
 

 
    public string GetConnString(string username)
    {
            string connstring = "Your connection string set in Wcf Service";
            // check user, etc
            return connstring;
    }
  

Press F5 and than stop  debugging.
   
3. Create new Windows Form  Application in the same solution



Go to Service reference and add (press Discover button!)



Set this project as Start-up project in your solution.

Add the following code:

ServiceReference1.Service1Client sc = new ServiceReference1.Service1Client();
MessageBox.Show(sc.GetConnString("xxx"));

Run your application:






How to set a value of char to null?

C# > Char > Null value

char filter = '\0';






Wednesday, November 13, 2013

=> Operator (lambda)

C# > Operators > => Lambda Operator 

The => operator is called the lambda operator. 
It is used in lambda expressions to separate the input variables on the left side from the lambda body on the right side.
                   (input parameters) => expression
The parentheses are optional only if the lambda has one input parameter, otherwise they are required:
             (x, y) => x == y
Zero input parameters with empty parentheses:

                    () => MyMethod()

Examples

1. Power

delegate int Power(int i);

Power myDelegate = x => x * x;
int j = myDelegate(7); //j = 49

MessageBox.Show(j.ToString());

2. Lambda expressions in query














DataSet C#

C# > System.Data   > DataSet

DataSet represents an in-memory cache of data.
DataSet consists of a collection of DataTable objects.

Example: