Tuesday, September 19, 2017

6 Days of Allah ?



Allah said in Quran that HE create this univers in 6 days and earth in 2 days.


Here is proof:


Quranic Age of Universe and Earth:
Universe Age : 6 days
Earth Age: 2 days
2/6 = 1/3 = 0.33

Scientific Age of Universe and Earth:
Universe Age : 13.7 billion years
Earth Age: 4.57 billion years
4.57 / 13.7   = 1 / 3 = 0.33 

Allah 1 day is not same as Earth 1 day:

Theory of Relative by Albert Einstien
If the object is bigger, then time pass slowly like if you are near pyramids the time will pass slowly than some far from pyramids.
or
If you are near very big object like black hole and spend 5 years then come back to earth you will find 10 years are passed on earth.


Allah is the Greatest of everything ( Allahu Akbar  الله أكبر ) in this Universe so time near Allah is very slowly passed than Earth time so  by the scientific query we can easily find the time of Allah one day which can be or cannot be exact.  ( Allah knows best  الله اعلم)

13.7 billion years of earth = 6 days of Allah

13.7 / 6 = 2.28 billion years of earth = 1 day of Allah. (May be or may not be ) 



Monday, September 18, 2017

How to Run Powershell Script using C#?






Step1: Add System.Management.Automation.dll to project.

this is normaly not available so download it.

public string RunPowerShell()

{



Runspace runspace = RunspaceFactory.CreateRunspace();


//Opening Powershell RunSpace
runspace.Open();

//Opening pipeline to pass the powershell script
Pipeline pipeline = runspace.CreatePipeline();

//sending commands 
pipeline.Commands.AddScript(@"Get-ADUser  -Filter * -Properties displayName,mail,samaccountname,title,department,company,l,co,mobile,facsimileTelephoneNumber,manager,extensionAttribute2,extensionAttribute4,EmployeeType,canonicalName,enabled | select displayName,mail,samaccountname,title,department,company,l ,co,mobile,facsimileTelephoneNumber,manager,extensionAttribute2,extensionAttribute4,EmployeeType,canonicalName,enabled ");

//ending the script
pipeline.Commands.Add("Out-String");

//Creating PoweShell Object for result
Collection<PSObject> results = pipeline.Invoke();

//Closing Powershell RunSpace
runspace.Close();

StringBuilder stringBuilder = new StringBuilder();
foreach (PSObject obj in results)
  {
    stringBuilder.AppendLine(obj.ToString());
  }
return stringBuilder.ToString();

}

Wednesday, July 12, 2017

How to Upload a Photo using Asp .Net File Upload?






Step 0:


Add <img src="defaultpic.jpg" runat="server" id="imgSoftLogo" width="50" height="50">




Step 1: On Upload Image Click Event



 protected void btnUpload_Click(object sender, EventArgs e)
    {
        try
        {
           // checking the file exists in <asp:FileUpload>
            if (btnFileUpload.HasFile == true  )
            {          
               // acceptable extentions
                List<string> extentions = new List<string> { ".jpg", ".gif", ".png" };

                // if file extention exists in acceptable extention
                if (extentions.Contains(  Path.GetExtension(btnFileUpload.FileName).ToLower()))
                {                                                  

                   // get the directory path complete path to save image into asp .net web folder
                    String filePath = Server.MapPath(@"~/SoftwareImages/" + btnFileUpload.FileName);
                   // saving the pic to folder
                   btnFileUpload.SaveAs(filePath);
                                     
                    // converting the pic 
                    image_base64String = ConvertImageTo_base64String(filePath);

                   imgSoftLogo.Src = @"data:image/gif;base64," + image_base64String;

                    Session["image"] = image_base64String;
                 
                }
                           
            }

        }
        catch (Exception ex) {  }
    }      


Step 2: Add Function to convert the File to image_base64String;


public string ConvertImageTo_base64String(string path)
    {
        using (System.Drawing.Image image = System.Drawing.Image.FromFile(path))
        {
            using (MemoryStream m = new MemoryStream())
            {
                image.Save(m, image.RawFormat);
                byte[] imageBytes = m.ToArray();
                image_base64String = Convert.ToBase64String(imageBytes);
            }
        }
        return image_base64String;

    }
    public string image_base64String { get; set; }


Step 3: Once Uploaded the pic will display on <Img> then save it to database.

database column is SoftwareImage

software.SoftwareImage = Session["image"].ToString();


Step 4: On Page Load

get the stored picture from database in string format and display it on page load.

1) loading from database if existed
imgSoftLogo.Src = @"data:image/gif;base64," + software.SoftwareImage;

2) if we are updating a new software and we have not updated the image yet and we also do not need to update the image so we will do the followings

// take the defaultpic.jpg

 string path = Server.MapPath(imgSoftLogo.Src);
 image_base64String = ConvertImageTo_base64String(path);
Session["image"] = image_base64String;








Sunday, April 23, 2017

How to Claim Accident in KSA?



May Allah protects you,


If you have car accident in KSA you should follow below steps to make your insurance claim.

Step 1:
Call Najm (9200 00560) and describe how accident was happen Najm will make his analysis and give you a paper narrating how many percent is your or 2nd party fault for the accident.


Step 2:
Take the car to workshop and get 3 quotation of labor cast of the car and parts needed.

Step 3:
Go to your carmaker service center and make quotation of parts.

Step 4:
Go to your bank, get the IBAN number on paper, and stamp by your bank.

Step 5:
Submit all papers to Najm, Najm will submit these papers to Insurance Company and wait for approval then repair your car.


Note:
Never Ever fix your car before Insurance approval (sometime insurance company send someone to re-check the car).
No need to go to Maroor (Traffic Police) for stamp.
No need to go to Insurance Company by yourself.

Thursday, March 9, 2017

Best Things for Hair and Skin

Good things for Hair, Skin


Name
Use For
Axiol Oil

Hair
Miracle cream for night

Skin
Tretinoin cream for baldness

Hair
Minoxidil (5% for men and 2% for women) daily at night

Hair

Best Recipe for Hair

Best Recipe for Hair


Name
Quantity
Details
Mustard Oil
1 Pao
Put it in pan on stove
Onion
1 Onion
Small Pcs
Methi Dana
1 table spoon
Grains
Carrot or Beet Root
1 Carrot
Small Pcs
Lemon
1 whole
With grain and Skin

How to make and use?

:: Put oil in a pan on stove when heated add all ingredients. Heat it for  5-7 minute.  Once cold, strain it. Use it daily. 

:: use it for 15 days and result will be good.


Link: youtube.com Sanam Bloach (The Morning Show) program 8 MAR 2017.

Best Recepie to weight loss



Best Recepie to weight loss. 


Name
Quantity
Details
Suhaga
60 Gram
Burn it on plate it will turn to liquid then dry it.
Black Pepper
15 Gram
Powder
Elava
30 Gram
Powder
Big Cardamom
25 Gram
Grains
Aloe Vera Gel

 only to mix everything

How to make and use?

:: mix all powder and make pills like ‘Hakeem’ by hand using two finger ( small pills) and dry it.

Dosage?

:: Take two tables in the morning and two at night with water.


Link: youtube.com Sanam Bloach (The Morning Show) program 8 MAR 2017.

Wednesday, March 8, 2017

Creating the SetUp for windows Service




Creating the SetUp for windows Service


Adding Installer to Winodws Service.

Step1 : Right Click on Windows Service Page then click add installer.


Step2 : Do the Settings of installer by given below snapshots.






Step3: Add new SetUp Project by Right Click on Soultion > Add Project > Other Project Types> Visual Studio Installer > SetUp Project.


Step4: Add Project Output by right clicking on Application and Select the Primary Project as Windows Service Project.




Step5: Add Custom Action to your project will make you install, uninstall, rollback of service if you do not add this custom action your service will install but will not show in services to start or stop the service.


Step6: After Installing the Service on server Add dependent folders like Images, .html container folders to the location where service is installed so it can use those files if needed.


Monday, October 24, 2016

How to transfer multiple values from one Page to other using Session as Class?





Step1: Page A

StudentsClass object= new StudentsClass()
        {
            Name= txtName.Text,
            Class = txtClass.Text,
       };

Session["Stu"]=object;

Step2: Page B

StudentsClass obj= (StudentsClass)Session["Stu"];

string name = obj.txtName;
string class  = obj.txtClass;



Tuesday, October 4, 2016

How to Query REST API ?



> domain\username:password must be authorize to query to the REST API.
> For POST HttpRequest is content type and use charset=utf-8 to convert.
> For GET HttpRequest is Accept


POST:


Uri address = new Uri(@"https://xx.xx.xx.xx:xxxx/abc/config/anything/");

HttpWebRequest request = WebRequest.CreateDefault(address) as HttpWebRequest;
request.Method = "POST";
request.Headers["Authorization"] = "Basic " + 
Convert.ToBase64String(Encoding.Default.GetBytes(@"domain\username:password"));
request.ContentType = "application/vnd.com.cisco.ise.identity.guestuser.2.0+xml; charset=utf-8";
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });

//Inserting data 

string data="xml data";


byte[] bytes = Encoding.UTF8.GetBytes(data);

request.ContentLength = bytes.Length;
using (Stream requestStream = request.GetRequestStream())
{
  // Send the data.
   requestStream.Write(bytes, 0, bytes.Length);
  requestStream.Close();
 }


Get By Name:


string name="";


Uri address = new Uri(@"https://xx.xx.xx.xx:xxxx/abc/config/anything/name/" +name +" ");


HttpWebRequest request = WebRequest.CreateDefault(address) as HttpWebRequest;

request.Method = "GET";
request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(@"domain\username:password"));
request.Accept = "application/vnd.com.cisco.ise.identity.guestuser.2.0+xml";
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
       
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string s = reader.ReadToEnd();

}

Get All:


Uri address = new Uri(@"https://xx.xx.xx.xx:xxxx/abc/config/anything/ ");


HttpWebRequest request = WebRequest.CreateDefault(address) as HttpWebRequest;

request.Method = "GET";
request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(@"domain\username:password"));
request.Accept = "application/vnd.com.cisco.ise.identity.guestuser.2.0+xml";
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
       
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string s = reader.ReadToEnd();

}

            


Monday, October 3, 2016

How to create a web service ?



Step1: Create the Web Service

Open Visual Studio create new web site. File > New >Website

Add an item as Web Service to the project. Webservice.asmx

Now create some web methods 


 [WebMethod]
 public string GetbyId(string name){}


if the response is in Custom Created Class then return that class object as below
 
[WebMethod]
[System.Xml.Serialization.XmlInclude(typeof(Students))]
 public string GetAll(string name){}


Public Class Student
{
public string name{get; set;}
public string rollnumber{get; set;}
}

Step 2: Publishing the Web Service

To publish the web service the procedure is same as publishing the website because as we created the Web Service under Web Site Project.




Secure you Asp .NET by Web.config & Global.ascx?

Add to Global.ascx protected void Application_BeginRequest(object sender,EventArgs e)     {         //to remove x frame         Resp...