Snippet : TinyURL API in PHP

This snippet helps you to shorten your URLs with TinyURL API(Function with usage)

  1. <?php
  2. function TinyURL($url){
  3.     return file_get_contents('http://tinyurl.com/api-create.php?url='.$url);
  4. }
  5. echo TinyURL('http://www.ultimateprogrammingtutorials.info');
  6. ?>
You need to replace http://www.ultimateprogrammingtutorials.info with the URL you want to shorten

Snippet : HTTP Redirection In PHP

This snippet helps you to redirect to another website/webpage.


  1. <?php
  2.     header('Location: http://www.example.com');
  3. ?>
Replace http://www.example.com with your website URL/webpage URL

Snippet : Detect HTTP User Agent in PHP

The code below helps you to detect the HTTP user agent I mean the browser version.


  1. <?php           
  2.     $useragent = $_SERVER['HTTP_USER_AGENT'];
  3.     echo "<b>User Agent </b>: ".$useragent;
  4. ?>
Return

User Agent : Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36

Down For Everyone Or Just Me in VB.NET

Down for everyone or just me is a website that can check whether your website is down or up.

Required components
  • One Button
  • One TextBox
Coding :
Add these codes to Button click_event & don't forget to add the namespace Imports System.Net.
    
'Imports System.Net
 'defining strin as a string & setting it to download strings from the website & the URL
        Dim strin As String = New WebClient().DownloadString(("http://downforeveryoneorjustme.com/" + TextBox1.Text))
        'checking string
        If strin.Contains("It's just you.") Then
            'return
            MsgBox(TextBox1.Text + " is up", MessageBoxIcon.Information, MessageBoxButtons.OK)
            'checking string
        ElseIf strin.Contains("It's not just you!") Then
            'return
            MsgBox(TextBox1.Text + " is down", MessageBoxIcon.Information, MessageBoxButtons.OK)
            'checking string
        ElseIf strin.Contains("Huh?") Then
            'return
            MsgBox("Invalid website", MessageBoxIcon.Error, MessageBoxButtons.OK)
        End If
Now to check you can just enter the URL you want to check in TextBox and click on the Button you added.

How To Make A Lyrics Fetcher In VB.NET

Description of the program : You can get the lyrics of songs with the artist name & the song name from this program.

 As usual just create a new fresh project and add the following tools to your form

  • 2 Buttons
  • 2 TextBoxes
  • 1 RichTextBox
  • 1 SaveFileDialog
Usage of the tools that you have added(Don't forget to change the buttons text : 
  1. Button1 - Fetch
  2. Button2 - Save
  3. TextBox1 - Artist Name
  4. TextBox2 - Song Name
  5. RichTextBox1 - Lyrics
You have to add System.Web reference, select add reference from project menu then search for it and click ok :

Adding reference to VB.NET

How To Make Login Form in PHP

PHP (PHP: Hypertext Processor) is a very widely-used scripting language, and the reasons why are obvious:   PHP integrates perfectly with plain HTML documents, is supported by the vast majority of Web hosting providers and has an easy-to-learn syntax, which you can also find in JavaScript, in some cases.

In this tutorial, we'll be experimenting with one of the much appreciated features of PHP: form processing.

Facebook : Embedded Posts Now Available For Everyone

Today facebook introduced embedded posts for everyone. To make your posts appear in any web page it should be a public post, you could easily get the code to embed the post in any web page you just need to select Embed Post from the dropdown menu of the post :
You would get a simple dialog when you click it, in that dialog just copy the code and paste it on your web page.

Here is the code that I got for my post : 

Here is a preview of the code :


You can learn more about this from here

How To Get Assembly Information In C#

I am sorry guys that I was not able to write articles regularly because I have some issues with my ISP so no internet. I just wanted to write something so I chose something interesting! it's about getting information about the assembly. Just create a console application in C#, import this namespace using System.Reflection; after that go to the main event and add these codes.
 Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyName assemblyName = assembly.GetName();
            string assembly_information = string.Format("{0}, {1}, {2}, {3}, {4}", assemblyName.Name, assemblyName.VersionCompatibility, assemblyName.ProcessorArchitecture, assemblyName.HashAlgorithm, assemblyName.Version.ToString());
            Console.WriteLine(assembly_information);
            Console.Read();
What that does is, first it defines the assembly events and then there’s a string with 5 slots to get the assembly information one by one. You can get more information such as KeyPair, FullName, EscapedCodeBase, ContentType, CultureInfo etc.

Just run the program to get the information and by the way don’t forget to add more slots to the string if you want to get more information about the assembly(I don’t know how it’s called I just call it slot).

How To Force/Prompt Your C# & VB.NET Program To Run As Administrator

If your code will target or access secured files or libraries, then your program needs Administrator Privilege. It's easy to run your program as Administrator, simply you can right click your program and select run as administrator, and in C# & VB.NET theres a XML Manifest that tells the .NET Framework to prompt the user to run the program as Administrator, we can easily configure your program to prompt the user to run the program as administrator.

How to configure your program to prompt the user to run your program as Administrator?

1 : Go to Project(in your visual studio menustrip) and select Add New Item(or simply CTRL+SHIFT+A shortcut to open Add New Item)

outling





















2 : Choose Application Manifest File and click add(actually your debug folder has a manifest file but we are adding a new one)
man

























3 : You will find a new file in your Solution Explorer called app.manifest and you will fall into that file automatically lol, inside that file you would have some text(of course XML)

  
  
    
      
        
        
      
    
  

  
    
      

      
      

      
      

      
      

    
  

  
  


4 : Inside that file find  <requestedExecutionLevel level="asInvoker" uiAccess="false" />

5 : Replace asInvoker with requireAdministrator

6 : That's all

Now whenever you run your program, your program will prompt to run the program as Administrator.