Archive | How to RSS for this section

How to create several Box.net accounts on one email address


Box.com announced that they`ll be giving 50GB free to LG Android users as well(they already have limited offer for iPhone/iPad users). And during the registration I found out that you can register several accounts on one email address. So here is a tip on how it is done if anyone needs several 50GB accounts for free:
Apparently their system doesn`t filter the dots in the email address. So if you register on email example@gmail.com you can also register on:
e.xample@gmail.com
ex.ample@gmail.com
exa.mple@gmail.com
exam.ple@gmail.com
exampl.e@gmail.com

Bind your server`s dynamic ip address to DynDNS.org(for both Linux and Windows)

Recently I built up a server for developing purposes, and after I set it up I realized that my ISP provides me with only a dynamic ip address. So the solution was obvious…set my router to use DynDNS(they has a free service of course). Of course it didn`t work(obviously as I`m writing this). DynDNS changed their API and my router didn`t have firmware update to fix it….So I decided to write an application which syncs the current IP address with dyndns using their API. I wrote the application on C# using Mono to run it on the  linux server. The code is just a mockup I`m open for any suggestions or optimizations…

What it actually does is check your current IP at checkip.dyndns.org and compares the result with the last checked IP(if any). If the IP got changed the application connects with the DynDNS API and renews the IP address.  You can change the period on which the application checks for IP changes from System.Threading.Thread.Sleep(). It is in ms so for 1 minute you should set it to System.Threading.Thread.Sleep(60000).

In order to use it you should change exampleusername, examplepassword and example.dyndns.org to your actual username, password and hostname and compile the Application(You can use Compilr if you don`t have Visual Studio installed).


using System;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace ConsoleApplication1
{
 class Test
 {
 static void Main(string[] args)
 {
 int repeat = 1; //Used for the infinite loop
 Console.WriteLine("DynDNS sync system");
 Console.WriteLine("==================");
 string lastIP = "";
 do
 {
 string myRequestURL = string.Format("http://checkip.dyndns.org/");
 string strippedIP2 = "";
 HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(myRequestURL);
 string myResponse = new StreamReader(myRequest.GetResponse().GetResponseStream()).ReadToEnd();
 Console.WriteLine("Your current IP is: ");
 Console.WriteLine("==================");
 string RegexPattern = @"<html><head><title>Current IP Check</title></head><body>Current IP Address: .*?</body></html>";
 System.Text.RegularExpressions.MatchCollection matches = System.Text.RegularExpressions.Regex.Matches(myResponse, RegexPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
 foreach (System.Text.RegularExpressions.Match match in matches)
 {
 string strippedIP1 = Regex.Replace(match.Value, "<html><head><title>Current IP Check</title></head><body>Current IP Address: ", "");
 strippedIP2 = Regex.Replace(strippedIP1, "</body></html>", "");
 }
 int ipComparison = string.Compare(strippedIP2, lastIP, true);

if (ipComparison != 0)
 {
 lastIP = strippedIP2;
 Console.WriteLine("The IP address has changed...The new address is: "+strippedIP2);
 Console.WriteLine("==================");
 string dnsUpdateURL ="http://exampleusername:examplepassword@members.dyndns.org/nic/update?hostname=example.dyndns.org&myip="+ strippedIP2 +"&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG";
 try
 {
 // Get HTML data
 WebClient client = new WebClient();
 client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
 client.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("exampleusername:examplepassword")));
 Stream data = client.OpenRead(dnsUpdateURL);
 StreamReader reader = new StreamReader(data);
 string str = "";
 str = reader.ReadLine();
 while (str != null)
 {
 Console.WriteLine(str);
 str = reader.ReadLine();
 }
 data.Close();
 }
 catch (WebException exp)
 {
 Console.WriteLine(exp.Message, "Exception");
 }
 }
 else
 {
 Console.WriteLine("IP hasn`t changed!");
 }
 System.Threading.Thread.Sleep(300000); //The period on which the application will re-check the IP
 }
 while (repeat > 0);
 }
 }
}

So If your router doesn`t support DynDNS and you want your server/PC to be accessible over the internet for free this is the easiest way you can do that.

When I wrote this i found the API documentation(which is great btw) to be very helpful.
DynDNS API Documentation 

If anyone needs to ask a question, finds this article helpful, or needs the compiled source feel free to post a comment 🙂

How to: Make your home server (XAMP/WAMP) accessible worldwide

Assigning a free domain to your local server
I`ve been working with all kinds of CMS systems lately and the easiest way to show your clients the developed product is to find a way of giving them access to your testing server(XAMP, WAMP etc.). I`m using windows, so this tutorial is going to show you how to give people access  to your local server using your router and a free service such as DynDNS.org .
In order to give access to your testing server you need a permanent address which would be easy to access from a web browser and your server must have permanent  IP in the local network in order for you to set a port forwarding(Port:80) to its IP address.
I`ll explain it in several easy steps:

  1. First of all you need a registration at https://www.dyndns.com/account/services/hosts/add.html
    There you pick your Hostname and subdomain you like. Then you pick “Host with IP” option and rewrite the ip given below
  2. Second you need to set your router to use the DynDNS registration
    In most of the cases the options can be found under System tools -> DDNS. There you choose your provider, username, password and domain and you probably need a restart of the router to apply the settings. 
  3. Then it is time for you to set the Static IP of the server in your local network
    You login to your router find the DHCP Server options (in my case DHCP list&binding). In the MAC option you put the MAC address of your server`s LAN and in the IP any free IP in the range of your local network. After you choose Add and restart your Machine the IP you choose will be its permanent IP in your local network.
  4. Now it is time for you to set your port forwarding.
    In most of the consumer routers the Port forwarding options can be found under Virtual Server category in the web interface of the router. When you find it in the Port range type 80 – 80, in the IP address the static IP you set to your server, click Enable and Apply and you`re all set.

If you followed these 4 easy steps your local testing server must be accessible through the DynDNS domain you register. It is a good idea to turn of your firewall, because it might block the local content.
If you have any questions or face any difficulties while doing this ask in the comment section of the article. I`ll be happy to answer your questions.

How to turn your PC on using nothing, but your android cell phone and your home router

Let`s say, that in the middle of the workday you realize that you`ve forgotten the report laying in C:\ on your PC. And just when you thought “Thanks god I installed LogMeIn“, you realize your home PC is powered off. The point of this article is to explain you how to set your PC to use its WOL(Wake on lan) function. The first thing you have to do is enable your lan card to “wake” your PC up, when receiving a “Magic Packet“.

  1. In order to turn on your WOL functionality, you have to log into your BIOS, in the “Power Management” tab and change the Wake on LAN tab to “Enabled”
    BIOS Screenshot
  2. You have to make sure that the WOL functionality is enabled for the lan card you use for your Internet connection
  3. Now it is time for the trickiest part. 90% of the Internet users have Dynamic IP addresses and are practically undiscoverable from outside the home LAN. In order for you to be able to wake your PC on you have to make it discoverable for the rest of the world. The easiest way to do that is link your home router with DynDNS.org, giving it a subdomain name. When you finish your registration in DynDNS you`ll receive a username password, and the unique subdomain name I mentioned.
  4. Now the last thing you have to do is log in your router and submit your DynDNS registration details in the Dynamic DNS tab.

Turning your configured PC on from your Android phone.

Install WOLdroid from the Android market

  1. Run the application
  2. Type your MAC address of your lan card(You can find it out by typing ipconfig /all in the cmd)
  3. In the name tab write the name of the subdomain you registered in DynDNS
  4. Press OK and Wake

Now the only thing you have to do is wait for several seconds and launch LogMeIn

If you have any questions feel free to ask them in the comment section below.