Switching to a third party Domain Name System (DNS)?

31 12 2011

Hi everyone, today we will discuss on Domain Name Systems and usage of them. First lets see what is DNS? DNS stands for Domain Name System. And DNS is actually a database system that handle IP addresses and related domain names. When we type a web address and hit the Enter key, the ISP(Internet Service Provider) will look up the DNS for requested domain name. Then the DNS will return and direct to the correct IP address. Then we will see the requested web page. 🙂

Usually your Internet Service Provider maintains a DNS server for handle the DNS quires, so you don’t have to worry about that. It hold a list of all the IP addresses and domain names within the network, and a cache of IP addresses which recently accessed computers outside the network.  This DNS servers are also responsible for your Internet speed. But sometimes you may realise your Internet speed is not enough. Most of the time this happens not because of your bandwidth but because of your ISP’s slow DNS server. Because some IPS’s don’t pay much attention for expanding DNS server resources.

As clients we can do something to speed up our Internet speed ourself. That is switching to a third party DNS . Here is list of some great DNS servers.

  • Open DNS                                        208.67.222.222       208.67.220.220
  • Google Public DNS                        8.8.8.8                       8.8.4.4
  • BitGravity
  • EdgeCast
  • CDNetworks

As a example lets see how to configure Open DNS for Ubuntu computer.

First  click on  network icon and go to Edit connections

Then you will see a window like this

Select your existing connection or you can create a new one. Then click edit

In the DNS servers field type these two IP addresses   with comma separated.  208.67.222.222     208.67.220.220

And follow the same procedure for other DNS service providers if you are interested. And the related IP addresses to configure are in the above list.

After set up the connection, check whether you actually use the Open DNS. So click on network icon and go to Connection Information.

Now Open firefox and try to load a web page, then you will notice your Internet speed has increased. 😀

 

Ok, now it’s all for today and this is the last post for this year and….. this is the last day of 2011. And I wish you ………..

 

Very Happy New year for All

Happy 2012!

Thank you 😀

Gihan De Silva

gihansblog.com





Joomla 1.7 installation with XAMPP problem solved

1 11 2011

Hi, Recently Joomla 1.7 was released and obviously that is an excellent product. And new features also added. If you need any guide regarding installation these articles may help you , I think.

How to install and configure Joomla 1.6 with XAMPP on Ubuntu 11.04

Though this is Joomla 1.6, there are not different between installation of 1.6 and 1.7, So thought not to add a new post on it.

In Joomla installation on XAMPP some guys are talking Joomla is giving some errors with XAMPP. Actually they are not errors, they are warnings. Is the nature of the software to give warnings. In standalone software solutions we normally do something called “error handling”, right!. We need to care about Errors but we don’t need to care warnings too much. So simply we can ignore them. Now the problem arises, “how to turn off the warnings”, I think now I have entered to our today’s topic :D.

First you need to find php.ini configuration file on your XAMPP installation. It may be located at your

(In windows) C:\xampp\php\php.ini

(In Ubuntu Linux) /opt/lampp/etc/php.ini

Then open it on a suitable text editor.

Now find error_reporting on php.ini ( Ctrl+F ) and change it’s value to

E_ALL | E_STRICT = E_ALL & ~E_DEPRECATED

There are three options on error_reporting. By default this value may have E_ALL & ~E_NOTICE or E_ALL | E_STRICT

  • Default Value: E_ALL & ~E_NOTICE
  • Development Value: E_ALL | E_STRICT
  • Production Value: E_ALL & ~E_DEPRECATED

In first two cases, XAMPP will show errors and Warnings. These things are not good when considering Production Level. That means , a live web site should not give errors for user. But it may useful considering development of web site.

And you need to find display_errors on php.ini file and change it’s value to

display_errors = off  to make it clearly work! Now save the work and restart the XAMPP server. Joomla will work without any errors. 😀

 

Thank you

Gihan De Silva

gihansblog.com





How to create a GUI(Graphical User Interface) using C programming Language.. (part 4)

9 09 2011

Hi,  after a long time I was able to find a time to write the blog, because these days I’m very busy with my exam and it will end 29th  September. So until that I doubt I’d be able to write much. So sorry for that my all friends who read this.

Related articles..

1) How to create a GUI(Graphical User Interface) using C programming Language..

2) How to create a GUI(Graphical User Interface) using C programming Language.. (part 2)

3) How to create a GUI(Graphical User Interface) using C programming Language.. (part 3)

And this article focus on  how to use a Text Entry with button action signals.  And the purpose of this program is display the string in the label,which user enter in the text entry.

Contents…

1) Open a Code Blocks projects

2) Open a Glade Project

3) Set properties for the components

4) Code the C Gtk project

5) Run the project

Components

1) Window= mainWindow

2) Label= displayLabel

3) Text Entry= textEntry

4) Button= displayButton

5) Button= exitButton

Set properties

  • For the main Window

General–> Name= mainWindow
General–>Resizable= No
Common–>Height request = 400
Common–>Width request=200

  • For Display Label

General–>Name=displayLabel

General–>Label=Display

  • For Display Button

General–>Name=displayButton

General–>Label=Display

Signals–>Clicked=on_displayButton_clicked

  • For Exit Button

General–>Name=exitButton

General–>Label=Exit

Signals–>Clicked=on_exitButton_clicked

  • For Text Entry

General–>Name=textEntry

Then save it as TextEntry.glade in libglade format in the CodeBlocks project folder.

In this C project I divided the whole project into three files.

1) main.c

2) callback.c

3) callback.h

The source code of main.c 

#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>

/*
Author : Gihan De Silva
gihansblog.com

Purpose: This program displays the string in the label,which user enter in the text entry.
*/
GladeXML *xml;
GtkWidget *widget;

int main(int argc, char *argv[])
{

gtk_init(&argc, &argv);

/*import glade file*/
xml = glade_xml_new(“TextEntry.glade”, NULL, NULL);

/* get a widget (useful if you want to change something) */
widget = glade_xml_get_widget(xml, “mainWindow”);

/* connect signal handlers */
glade_xml_signal_autoconnect(xml);

/*show widget*/
gtk_widget_show (widget);

gtk_main();

return 0;
}

The source code of callback.c

#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>

GladeXML *xml;
GtkWidget *display;
GtkWidget *textValue;

gchar *d_string;

G_MODULE_EXPORT void on_displayButton_clicked(GtkButton *button,gpointer *data)
{

/* Pull the widgets out of the tree */
display= glade_xml_get_widget(xml, “displayLabel”);

textValue= glade_xml_get_widget(xml, “textEntry”);

/* Get the string value form the Entry widgets */
d_string=gtk_entry_get_text(GTK_ENTRY(textValue));

gtk_label_set_text(GTK_LABEL(display),d_string);
}

G_MODULE_EXPORT void on_exitButton_clicked(GtkButton *button,gpointer *data)
{
gtk_main_quit();
}

The source code of callback.h

G_MODULE_EXPORT void on_displayButton_clicked(GtkButton *button,gpointer *data);
G_MODULE_EXPORT void on_exitButton_clicked(GtkButton *button,gpointer *data);

Now run the gtk project and it will look like this.


And when you hit the Display button, it will display the content in the text entry..

Display Button Code Explained…

Here I’m not going to explain all the code because I already have explained them in previous articles. If you haven’t read previous article, you’d better to read them first. But I’m going to explain the specific things related to this article.

GladeXML *xml;
GtkWidget *display;
GtkWidget *textValue;

gchar *d_string;

G_MODULE_EXPORT void on_displayButton_clicked(GtkButton *button,gpointer *data)
{
/* Pull the widgets out of the tree */
display= glade_xml_get_widget(xml, “displayLabel”);

textValue= glade_xml_get_widget(xml, “textEntry”);

In these two lines, the program will take glade widgets into Gtk widgets.

/* Get the string value form the Entry widgets */
d_string=gtk_entry_get_text(GTK_ENTRY(textValue));

We can’t directly use GtkWidgets to set gtk label, because it needs gchar* type data. So in here we convert to into gchar* .

gtk_label_set_text(GTK_LABEL(display),d_string);

Now with above line we can set it to the label.

}

Ok that’s all for today :D . If you want, you can DOWNLOAD my CodeBlock project here!. In next post I will show you how to create a simple Calculator using Gtk and Glade.

Thank you

Gihan De Silva





How to create a GUI(Graphical User Interface) using C programming Language.. (part 3)

17 08 2011

Hi, this is the third part of the How to create a GUI(Graphical User Interface) using C programming Language.. (part 2) post as I promised. In today’s post I’m going to tell you how to create and run Simple hello world GUI program.

And it includes how display a message when click a button.


Ok now open a new glade project and draw a GUI like above image. You have three components one label and two buttons.

Then set properties like this.

  • For the main Window

General–> Name= mainWindow
General–>Resizable= No
Common–>Height request = 400
Common–>Width request=200

  • For Display Label

General–>Name=displayLabel

General–>Label=Display

  • For Display Button

General–>Name=displayButton

General–>Label=Display

Signals–>Clicked=on_displayButton_clicked

  • For Exit Button

General–>Name=exitButton

General–>Label=Exit

Signals–>Clicked=on_exitButton_clicked

Then save it as hello.glade in libglade format.

Now open CodeBlock’s Gtk+ project. When you open a new it will automatically generates some codes, so erase and clear main.c .Then copy paste this code into your main.c .

Then copy your hello.glade file into CodeBlock project folder.

#include <stdio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>

/*
Author : Gihan De Silva
gihansblog.com
*/

GladeXML *xml;
GtkWidget *widget;
GtkWidget *display;

G_MODULE_EXPORT void on_displayButton_clicked(GtkButton *button,gpointer *data)
{
/* Find the Glade XML tree containing widget. */
xml = glade_get_widget_tree(GTK_WIDGET( widget ));

/* Pull the widgets out of the tree */
display= glade_xml_get_widget(xml, “displayLabel”);

gtk_label_set_text(GTK_LABEL(display),”Hello World!\n gihansblog.com”);
}

G_MODULE_EXPORT void on_exitButton_clicked(GtkButton *button,gpointer *data)
{
gtk_main_quit();
}

int main(int argc, char *argv[])
{

gtk_init(&argc, &argv);

/*import glade file*/
xml = glade_xml_new(“hello.glade”, NULL, NULL);

/* get a widget (useful if you want to change something) */
widget = glade_xml_get_widget(xml, “mainWindow”);

/* connect signal handlers */
glade_xml_signal_autoconnect(xml);

/*show widget*/
gtk_widget_show (widget);

gtk_main();

return 0;
}

Now run the project. If everything ok it will look like this and will function well :D.

The program in CodeBlocks…

Main Code Explained…

First we should initialise gtk in our code.

gtk_init(&argc, &argv);

Then we have to import our .glade file into our program and convert it into xml file format.

xml = glade_xml_new(“hello.glade”, NULL, NULL);

Now signals of widgets should be functioning with this line.

glade_xml_signal_autoconnect(xml);

And with this line, it will show the GUI at run time.

gtk_widget_show (widget);

Then call gtk main method

gtk_main();

Exit Button Code Explained…

In the exit button we call
gtk_main_quit();

to quit fro the program.

Display Button Code Explained…

Then find the Glade XML tree containing widget.
 xml = glade_get_widget_tree(GTK_WIDGET( widget ));

Now pull the label widgets out of the tree
 display= glade_xml_get_widget(xml, “displayLabel”);

Display the message on the label
gtk_label_set_text(GTK_LABEL(display),”Hello World!\n gihansblog.com”);

Ok that’s all for today :D. If you want, you can DOWNLOAD my CodeBlock project here!. In next post I will show you how to add a Text Entry widget to your application.

Thank you

Gihan De Silva