Author Archives: Silver Moon

About Silver Moon

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected].

How to Get IP Whois Data in C with Sockets on Linux – Code Example

By | August 7, 2020

Theory The whois information of an ip address provides various details like its network, range, isp etc. This information is maintained by various regional registry servers. Read the wikipedia article on regional internet registries for more information. There are a total of 5 regional registries spanning various geographical regions of the world. For example if… Read More »

Compile wxwebconnect on Ubuntu 11.04 64 bit

By | February 2, 2012

wxwebconnect is a control for wxwidgets that allows to embed a gecko browser in a wxwidgets application. So lets try to install it on Ubuntu 11.04 wxWidgets can be installed from synaptic. Look for packages called libwxgtk2.8-* 1. Download wxwebconnect source from http://www.kirix.com/labs/wxwebconnect/downloads.html Extract them in home directory. Inside the webconnect directory you would see… Read More »

Winsock tutorial – Socket programming in C on windows

By | July 25, 2020

Socket programming with winsock This is a quick guide/tutorial to learning socket programming in C language on Windows. “Windows” because the code snippets shown over here will work only on Windows. The windows api to socket programming is called winsock. Sockets are the fundamental “things” behind any kind of network communications done by your computer…. Read More »

str_replace for C

By | December 22, 2011

Php has a useful function called str_replace which can search and replace a certain string in another big string. However there is no such function in C. So I wrote up one for myself. Here is the code. /* * Search and replace a string with another string , in a string * */ char… Read More »

Easy to use C/C++ IDE for Ubuntu Linux

By | October 19, 2012

Here are some IDEs that work very well on Ubuntu ( and other Linuxes ) and can be used as an alternative to the terminal gcc or g++ thing. Geany Url : http://www.geany.org/ Install with sudo apt-get install geany Open any C/C++/PHP/Html/Python/Perl file and start coding. Compile with F8 , Build with F9 and execute… Read More »

Traceroute command not working on Ubuntu

By | August 4, 2012

The traceroute utility can be installed from synaptic : $ sudo apt-get install traceroute Some Information : $ traceroute -V Modern traceroute for Linux, version 2.0.15, Oct 17 2010 Copyright (c) 2008 Dmitry Butskoy, License: GPL v2 or any later Doing some test runs $ traceroute www.google.com traceroute to www.google.com (74.125.235.20), 30 hops max, 60… Read More »

Get ip address from hostname in C with Linux sockets

By | July 31, 2020

Socket applications often need to convert hostnames like google.com to their corresponding ip address. This is done through dns requests. The socket api in linux provides functions like gethostbyname and getaddrinfo that can be used to perform the dns requests and get the ip address. 1. gethostbyname The first method uses the traditional gethostbyname function… Read More »

5 Linux Commands to Check Distro Name and Version

By | April 30, 2023

Linux distro name and version When working with an unknown server, the first task of a sys admin is to gather some information about the system, like what OS is it running, what version, what services are running and so on. And there is no single command that can detect distribution specific information consistently across… Read More »

Run Apache as a specific user with mpm itk on Ubuntu Linux

By | December 8, 2011

Install mpm itk On ubuntu mpm itk can be installed from synaptic. Look for the package called apache2-mpm-itk sudo apt-get install apache2-mpm-itk Configure Configuration for mpm itk can be done in the file sites-enabled/000-default $ gksudo gedit /etc/apache2/sites-enabled/000-default In the VirtualHost *:80 section add this just before the end of the VirtualHost tag [xml] <IfModule… Read More »

Convert simplexml object to array in php

By | December 6, 2011

The simplexml extension of php is quite simple and easy to use when it comes to parsing “well-formatted” xml files. Well formatted means , xml that is not broken or does not have too many errors. One of the most handy functions of this extension is simplexml_load_string. Here is an example : &lt;?php $xml =… Read More »