How To Login To Instagram Using The API In VB.NET

instagram picture
Instagram is a photo and video sharing app for smartphones, we can call it a social network. As I said It's a smartphone app but you can view photos, like photos, comment on photos and follow/unfollow users via their website from computer also there are more than 10 popular websites where you can view photos, like photos, comment on photos and follow/unfollow users, browse hashtags and view stats they use the API to do the works.

Without much talk let's get into it..

Remember you're just going to make a Instagram Login, you won't be able to view photos or do anything. You need two textbox and a button you can also add two labels to make it look good. The textbox1 is for username and textbox2 is for password.

Instagram Login form preview

Time for some codes...

Required Namespaces :
Imports System.IO
Imports System.Net
Imports System.Text

Functions(We need two functions) :
  
 Dim CC As New CookieContainer
    Dim RQ As HttpWebRequest
    Dim RP As HttpWebResponse
    Public Function GetResponse(ByVal url As String, ByVal referer As String) As String
        RQ = CType(HttpWebRequest.Create(url), HttpWebRequest)
        RQ.CookieContainer = CC

        If referer <> "" Then
            RQ.Referer = referer
        End If

        RP = CType(RQ.GetResponse(), HttpWebResponse)

        Return New StreamReader(RP.GetResponseStream()).ReadToEnd()
    End Function

    Public Function GetResponse(ByVal url As String, ByVal post As String, ByVal referer As String) As String
        RQ = CType(HttpWebRequest.Create(url), HttpWebRequest)
        RQ.Method = "POST"
        RQ.CookieContainer = CC
        RQ.UserAgent = "AppleWebKit/537.36 (KHTML, like Gecko) Mozilla/5.0 (Windows NT 6.1) Chrome/28.0.1468.0 Safari/537.36"

        If referer <> "" Then
            RQ.Referer = referer
        End If

        Dim byteArr() As Byte = Encoding.Default.GetBytes(post)
        RQ.ContentLength = byteArr.Length

        Dim dataStream As Stream = RQ.GetRequestStream()
        dataStream.Write(byteArr, 0, byteArr.Length)

        RP = CType(RQ.GetResponse(), HttpWebResponse)

        Return New StreamReader(RP.GetResponseStream()).ReadToEnd()
    End Function

This code is for your login button :
Dim html As String = GetResponse("https://instagram.com/accounts/login/", "")
        Dim token As String = html.Substring(html.IndexOf("csrfmiddlewaretoken")).Split(""""c)(2)
        Dim username As String = TextBox1.Text
        Dim password As String = TextBox2.Text

        Dim S_B As New StringBuilder
        S_B.Append("csrfmiddlewaretoken=" & token)
        S_B.Append("&username=" & username)
        S_B.Append("&password=" & password)

        html = GetResponse("https://instagram.com/accounts/login/", S_B.ToString, "https://instagram.com/accounts/login/")

        If html.Contains("""username"":""" & username) Then
            MsgBox("Successfully Logged In", MessageBoxIcon.Information)
        ElseIf html.Contains("Please enter a correct username and password.") Then
            MsgBox("Invalid Username or Password", MessageBoxIcon.Error)
        Else
            MsgBox("Unable Login Error", MessageBoxIcon.Error)
        End If


Now run the program and test it..

If you enter correct login credentials you will get this message :

How To Login To Instagram Using The API In VB.NET

I am looking to develop a Instagram picture view if everything goes well I will let you all know. Follow me on Instagram @54j33dh4.

How To Detect Real Time Browser Size In JQuery

This JQuery script detects the dimensions of browser's size onload and resize...

Add these in your head :


Add the styles(not so important) :


Add these to your body :


Now just save the document and run in your browser :)

How To Detect Browser Size Using JQuery

All the credits goes to Michael(mikethedj4)

How To Get Environment Variables In VB.NET and C#


Environment
Environment Variables are set of values that are used for running special processes or special system files.. for example when you install java or python you must make a new environment variable in order to compile and run java or python programs that's all I know about it. Without wasting anytime let's get into it...

This is a simple code that will show you the environment variables..

For VB.NET

        Dim EV As String = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process Or EnvironmentVariableTarget.Machine)

        MsgBox(EV)

For C#

'you must add these namespaces 

using System;
using System.IO;
using System.Windows.Forms;
using Microsoft.Win32;

'add this code in an event 
string EV = Environment.GetEnvironmentVariable("PATH", 
                EnvironmentVariableTarget.Process | 
                EnvironmentVariableTarget.Machine);
            MessageBox.Show(EV);

The "PATH" defines the environment variable name so if you want to get another ones just change PATH with the variable name.

How To Check If Directory Exists In VB.NET And C#

directory in programming
I have had some hard times in solving this problem not these days but sometime ago when I started programming so I think this would be helpful for anyone who has started programming..

Here's the code to check if the directory exists in VB.NET :

Try
            If System.IO.Directory.GetDirectories("PATH").Length > 0 Then
                MsgBox("directory exists")

            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

All you need to do is replace PATH with the directory you want to check... length > 0 identifies if the directory exists.

Here's the code for C# :

try
            {
                if (System.IO.Directory.GetDirectories("PATH").Length > 0)
                {
                    MessageBox.Show("directory exists");

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

Do the same thing as given for VB.NET code.

How To Get The MD5 Hash Of A File In VB.NET

MD5 UPTUTORIALS
MD5 is a widely used cryptographic algorithm that produces a 128-BIT hash value. I think all the files you have in your computer has a unique md5 hash.. in some virus scanning process the files get identified easily with the hash value. Today we are going to make a simple application that will help you to get the md5 hash of any file.

Start a new project and do the traditions lol.. you must add a button, a label and a textbox.

user interface :)

You must add these namespaces before you could do any coding :

Imports System.Security.Cryptography
Imports System.IO
Imports System.Text

Here's the code for the application it's all under button click event.. I have explained the basic things by small comments.

  'creating the openfiledialog
        Dim Open As OpenFileDialog = New OpenFileDialog
        Open.Filter = "All Files (*.*)|*.*"
        If (Open.ShowDialog() = DialogResult.OK) Then TextBox1.Text = Open.FileName
        If Open.FileName = "" Then Exit Sub

        'accessing file & getting the hash
        Dim RD As FileStream = New FileStream(TextBox1.Text, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
        RD = New FileStream(TextBox1.Text, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
        Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
        md5.ComputeHash(RD)
        RD.Close()

        'converting the bytes into string
        Dim hash As Byte() = md5.Hash
        Dim SB As StringBuilder = New StringBuilder
        Dim HB As Byte
        For Each HB In hash
            SB.Append(String.Format("{0:X1}", HB))
        Next
        LabelHash.Text = "MD5 : " & SB.ToString()

The usage is pretty easy all you have to do is select and load the file from the button and you will get the Md5 hash for the selected file in the Label.

How To Get The Cheapest Mobile And Contract Possible

How To Get The Cheapest Mobile And Contract PossibleNeed that mobile phone and service, but don't want to pay a fortune? Today we're going to tell you the cheapest possible way to get what you want. So if you're looking to save some cash, then here's how you can do it...

Buy Mobile Phones Online...
The first thing that you're going to need is a phone. Don't fall for the incentive contracts that mobile operators are trying to sell you. These are the contracts that come with a free phone, and as tempting as they may be they're going to end up costing you a lot more. The phone you get isn't free; you pay for it in instalments that are added to the cost of your monthly mobile bill. And when you add up all the instalments you'll find that you pay more than the retail cost for the phone. In the long run you're going to save more, and get lower mobile bills, by buying your own phone. The best way to buy mobile phones is online. Online prices are always cheaper, even if you're buying directly through a mobile operator.

You can get a perfectly decent budget, touch screen, smart phone for under a hundred and fifty pounds, so don't let the thought of big prices put you off. Check out the Huawei Ascend models or the lower end Sony Xperias for good deals. If it bothers you to buy mobile phones online, go out and get a physical look at the model you're buying before you commit, but then come home and buy it over the internet. This is by far the cheapest way that you're going to get a phone.

Consider Pay as You Go...
Now you're going to need to get service for that new phone, and you have a couple of options. The first thing you should consider is pay as you go. This is where you buy a SIM card from and operator and load it up with credit. When you use your phone, credit is deducted from your account, and when the credit's gone you phone stops working (though you can still receive texts and calls), at which point you'll need to put more credit on.

This has the advantage of only paying for services that you actually use. Plus, it makes controlling your budget easier, since you can only spend money that you've already put on your phone in credit. But rates on pay as you go are higher than on contract. This doesn't mean that you don't get savings though. In general, light phone users benefit more from pay as you go contracts, since they rarely use up the monthly calling plan limits on contracts. If you use less than ten calling minutes a week, send only three to four text messages a day, and only use mobile data for casual surfing and emailing, then you're probably going to save money with a pay as you go plan. Check out Tesco Mobile for the best pay as you go deals.

Choose a Calling Plan...
If pay as you go isn't for you, then you're going to be signing a mobile contract with an operator, and this means choosing a calling plan. The right calling plan is exceptionally important when it comes to saving money. A calling plan is going to give you a set of limits for the amount of calling minutes, text messages and mobile data that you can use each month for your fixed monthly fee. If this plan is too big you're going to waste money paying for minutes, texts and data that you don't use, because your monthly fee is the same regardless of whether you use all of your limits or none of them. If your plan is too small, then you're going to consistently go over your monthly calling plan limits. When this happens, you have to pay expensive premium rates on any extra services you use on top of your regular monthly fee. There are a couple of things that you can do to make sure that you're choosing the right calling plan. If you've had a contract before, then look at some of your old phone bills. These should give you an idea of what your monthly usage looks like. If you haven't had a contract before then the best thing that you can do is to get a pay as you go plan for a month and then track your phone usage. You can do this yourself, however most modern phones will do it for you. Just look under the settings menu and see if you can find minute, text and data counters. Set these counters to zero, use your phone normally for a month, and then go back and check the numbers. This will tell you the size of calling plan that you should go for.

Shop (online, again...)...
Now you're ready to find the cheapest contract for you. Go online and find yourself a mobile tariff comparison web site. You'll put the monthly calling plan limits that you're looking for into the site, and then you'll get a list of plans with different operators that match your needs. Make sure that the plan says it's SIM only (you don't want to sign an incentive contract, remember?). Now find the cheapest plan that's the closest match to your required limits. Before you buy, there's one more step to the process. Go to the web site of the operator that the plan is with, and find the coverage map. Every operator has one on their site. Use this to make sure that the provider has good coverage in your area. If they don't, choose another plan with a different operator. Bad coverage will give you bad mobile reception, and it's just not worth paying for. You can then go ahead and buy the contract, again doing it online to get online discounts. And you'll be safe in the knowledge that you've got the cheapest mobile and service plan that you can possibly get.

Sam Jones decided that it was time to buy mobile phones again for the household.  He found the latest offers online with sites like uSwitch and managed to get great phone packages for next to nothing.

Getting A New Mobile Contract - The Questions You Should Ask Yourself

Getting A New Mobile Contract - The Questions You Should Ask YourselfBefore you start signing a mobile contract, there are a few questions that you should be asking yourself to make sure that you're getting the best deal. Most of us want to save a little money these days, and the wrong mobile contract could cost you a fortune. You have plenty of options out there, and you want to make sure that you're choosing the right one. So before you sign, ask yourself these questions...

Do I Really Need a Contract?
You do have another option; you don't have to sign a contract. Pay as you go plans are not as popular as they once were, but some customers benefit more from them than from contracts. If you're a light phone user, someone who calls for less than ten minutes a week, who sends only three to four texts a day and who uses mobile data only for email and casual web browsing, then chances are that pay as you go will be a better deal for you. It's worth keeping in mind...

Am I Choosing the Right Calling Plan?
The calling plan is the most important part of any mobile contract. This is the set of monthly limits for the amount of calling minutes, text messages and mobile data that you're allowed to use for your set monthly fee. The wrong plan is going to end up costing you money. Here's the deal. Imagine you have a plan that includes thirty calling minutes.

If you call for thirty minutes a month, you pay your monthly fee. If you call for five minutes a month, you still pay the same monthly fee. So a plan that's too big means paying for services that you don't use. Now imagine that you call for forty minutes a month, what happens now? You pay your regular monthly fee, plus premium rate charges on the extra ten minutes that you used. So a plan that's too small isn't a good financial decision either. You need the right sized calling plan, even if that means getting a pay as you go plan for a month so that you can track your usage and find out the amount of minutes, texts and data that you need.

Am I Taking Free Txt and Calling Minutes into Account?
Many operators these days will offer you free txt and calling minutes as an incentive to sign up for a contract. There's no point accepting this offer if you're not actually going to use them though. You'll want to take these free txt and calling minute offers into account when choosing your calling plan, so that you make full use of them. If you get thirty free calling minutes a month, for example, you might want to choose a calling plan that has lower calling minute limits than you would otherwise choose.

Do I Really Need that Incentive Phone?
Operators are going to offer you two contract choices, incentive and SIM only. Both of these are going to come with a calling plan of your choosing, but an incentive contract also comes with a free or low cost mobile phone. Think about this option carefully. A phone is pretty tempting, but it's not going to be free. The monthly bill on an incentive contract is going to be higher than the monthly bill on a SIM only contract, because basically you're buying a phone in instalments, and the bill will include a monthly payment for your phone. With most instalment plans you end up paying more than the actual cost of the item that you get, because you're both paying for the convenience of not having to make a big initial payment and because the company is taking a risk by giving you something without get full and immediate payment in return. Incentive contracts are no different. You will pay more than the retail cost of the phone that you get over the course of the contract.

If you already have a phone to use, or if you can afford to buy one up front, you should do so and then sign a SIM only contract, because you will save money. Don't be tempted into getting a new phone just because they're offering you one. You should only sign an incentive contract if that is the only way you can get a phone that you absolutely need.

How Long Am I Going to Sign Up For?
You will also be offered a choice of contract terms. Usually you can choose between a twenty four month, eighteen month or twelve month contract. Some SIM only contracts also come in rolling thirty day periods. This means that the contract is only for thirty days, but it will automatically renew every month unless you tell the operator that you want to stop your service. The longer your contract is the lower your payments will generally be. And if you sign an incentive contract this is especially true, since the cost of the phone is spread out over more monthly payments, making each individual payment smaller. But don't forget that once signed up, it's going to be difficult to get out of your contract. That means that switching to another operator to get a better deal could be complicated. And if your financial situation changes then you might be stuck making payments that you really can't afford to make.

Will I Have Good Service?
Your mobile reception depends on how good coverage is with your operator in you local area. If you don't get good coverage then you won't get good reception. That might mean that your phone won't work at all, but at the least it will mean that you get slow mobile data speeds and bad call quality. You should always check coverage in your area before signing up with an operator. Just go to the operator's web page and look for the coverage map that the operator is required to have there.

Sam Jones’s son knew that packages which included free txt messages would save him money.  He proved himself right when he compared deals online and started to spend less on his phone bill every month.

How To Get The Best PAYG Deal

How To Get The Best PAYG Deal
Contract mobile phones are definitely a convenience. You tend to get a free or heavily subsidized mobile phone, and you then get the comfort of never running out of credit and just receiving a monthly bill. However, there are downsides. That phone is not free of course, rather you'll be paying for it in monthly instalments on your phone bill, which over the two year contract can add up to a lot more than the actual cost of the phone. For many people, finding the best pay as you go tariff is the key to saving money on their mobiles. So how do you go about it? Read on to find out...
  • Find Out What You Need...
The key to a good PAYG tariff deal is to make sure that it matches your needs. Look at your old phone bills and find out how your phone activity is broken up, how much of the time do you spend calling, how many text messages do you send. This information will help you determine which kind of plan is best for you. If you're sending over 500 text messages a month, for example, it's probably a good idea to get a PAYG tariff that includes unlimited texting. Be warned, PAYG tariffs tend to work out as money savers only for those that plan to spend less than £25 a month. For users who regularly spend more, contract phones are still the best deal.
  • Decide What to Spend
Not being tied down to a contract means that you don't have to spend money on your phone each month. However, it's a good idea to have a budget for the month that accurately reflects what credit you'll need. This is because a lot of PAYG tariffs offer special deals for customers who top up every month. For example, putting ten pounds of credit on your phone each month will get you unlimited internet.
  • Decide Which Operator to Go With...
This decision should have two parts. First, find the operators who have plans that match your needs (they'll probably be more than one of them). Then ask around, ask your family and friends which operator they use. This is a good idea for a couple of reasons; firstly, because you'll get some recommendations, but also because many operators offer lower calling and texting prices to numbers in the same network. If you call your Mum every day, it might not be a bad idea to be on the same network as she is to get some savings for both of you.
  • Shop Around
This can take some serious time, but it's definitely worth doing. Just because you already know which network you want doesn't mean that you need to go straight to their store. There are many online sources (such as Carphone Warehouse) that offer special deals on hand sets bought with PAYG tariffs. It may be that you end up back at your mobile service operator, but it doesn't hurt to take a look around and find out what's out there.

Phil Turner is searching for the best pay as you go tariff available to him because he hardly uses his phone at all.

Pros And Cons Of AdAware Anti-Spyware Program

Pros And Cons Of AdAware Anti-Spyware ProgramOften when you surf the Internet going from site to site adware is installed on your computers. This happens when you download a free application or even give out your email. It is a marketing tool that is used for finding out what websites you go to so they can sell products or services to you. There is a debate over whether this is an ethical marketing tool as some consumers do not like these programs.

Pros of Adware Anti-Spyware Program
Adware Anti-Spyware Program is a program you install on your computer or laptop that helps you detect these adware and malware programs. When the program detects the adware it lets blocks or stop the popup ads or programs from functioning. This program scans downloaded files to check for threats. When you attach a USB to your computer the program will scan for malware and infections.

When a file is suspected of infection or malware it moves the file to a quarantined area or sandbox. This program will monitor the behavior of the file to see if it is infected. This program helps you shop and bank online more safely. When people use social networks it helps protect their identify and from virus attacks when using email or links. This program has a game mode that let's you play a video game or watch a movie without the software interrupting you with urgent updates. It scans most websites for url's that are dangerous or downloadable files that have malware or viruses. This sites are checked against a central database of sites that are known to be dangerous.

This central database is updated every five to twenty minutes preventing you from stumbling on phishing sites accidently. The program has free installation and setup assistance. You can call the company by phone and get up to 15 minutes of free advice on a problem you have. If you think your laptop or computer are infected the Lavasoft Network will try to diagnose and fix the problem. This program is for home use or professional offices. It has a fast antivirus program that goes with the Adware Anti-Spyware Program. It protects you from email threats like viruses and program that are sent as attachments through email. It keeps you protected against the latest viruses and worms as they develop. It stops infected files from downloading before they can infect your computer. On social networks it protects your passwords and personal information. If there are links on posting of social network it scans them to insure safety. It has an advanced two way firewall that protect your computer . This program has a file shredder that permanently deletes files with passwords and information you do not want to be found.

Cons of The Program
When tested against other more powerful programs Lavasoft was found to be an average program. It does not slow down your system while performing and does a fairly accurate job of identifying dangerous files and websites. When tested for protecting against malware it was not found to be as good as other program that it competes with.

Reference: http://anti-spyware-review.toptenreviews.com/ad-aware-se-pro-review.html 

+Katrina uses her technical knowledge to help people. At Rack Solutions. her passion for technology and wealth of knowledge have helped many people find the right solution in their unique situation.