ReviewMe - WebHostingPal

Categories: ReviewMe, Web

Tags:

Time ago a friend of mine talks to me about an advertising service: “ReviewMe”.
Once you signup, they look your blog and they propose to you to write about a service or a product or a site and in return they give to you a little amount of money.
I accepted to signup because ReviewMe allows you to write all you think about the product, not only good words!

Recently they ask to me to write about the site Web Hosting Pal.This site can help you to find the best web hosting for your requirements. Immediately I visited the website which I chose to promote and I thought what I can write.
Continue Reading »

Today is Download Day

Categories: News, Web

Tags:

Set a Guinness World Record? YES WE CAN!
Download Day
Next World Record? Win browser war!

Growing String in c

Categories: C, Source Code

Tags:

This article contains the source code for a c utility that manages a growing string, and a brief explanation of the code.

To obtain this, we make something similar to a c++ class: a struct with associated functions. The functions add characters to the string in the struct, and allocate more memory space when the string is full.

This is usefull when we are working with string with an unknow length (e.g. we are reading a file).

The struct containing the string is the following:

// Struct containing the growing string
typedef struct
{
	// string
	char * text;
	// string length (with zero terminator)
	int length;
	// string capacity
	int capacity;
} growing_string;

The text variable is where the string is allocated, length is the current string lenght and capacity is the memory allocated for the string.

To better understand the difference between length and capacity, look at the next image:

Capacity-Length

Capacity is the total space allocated for the string, while length is the actual number of character of the string, including the \0 terminator (the special character that close the string). If we add enough characters and the length is greater than the capacity, we need to allocate more memory for the string.

Continue Reading »

Coders4fun Quiz #4

Categories: Quiz

Tags:

Main.java

public class Main {

  public static void main(String[] args) {
    System.out.print(Quiz.GetMagicNumber());
  }

}

Quiz.java

public class Quiz {

  static int magicNumber = 3;

  public static int GetMagicNumber()
  {
    return magicNumber;
  }
}

What we need to add in Quiz class to print 5 instead of 3?

Coders4fun Quiz #3: Will it compile?

Categories: Quiz

Tags:

Will this code compile??? Why?

foo.h

class Foo
{
	public:
		Foo();

		void fooo();
	private:
		int i;
		char c;
		short s;
	protected:
		char b;
		char e;

		char getFoo();
}

foo.cpp

#include "foo.h"

Foo::Foo()
{
	for (int i = 0; ; ) { }
}

void Foo::fooo()
{
while(true)
{
	c = 'f';
}
}

char getFoo()
{;
	return c + 2;
}

How to use poEdit

Categories: C, Source Code

Tags:

In this guide I will explain how to simplify the localization process of a software written in c++ using “wxWidget (a cross platform toolkit), with poEdit.
poEdit offers to developers a conventient approach to localizazion, and there is no need to modify the source code by hand to modify translations, because they are all stored on a catalog file that is easy editable.

Logo poEdit

To prepare the source code to the localization, we must sorround all strings that we want to localize with the macro “_()”, for example:

...
wxMessageBox( _("localized string") );
...
wxMessageBox( wxT("not localized string") );

Continue Reading »

Automatically change upload limits in aMule

Categories: Linux

Tags:

Every serious home-server should have aMule installed as daemon.
Unfortunately aMule, like all p2p programs, can slow down our connection, even if we aren’t downloading a thing or if we have few downloads remaining, because it use the upload bandwidth to share the downloaded files. We can lower the upload bandwidhth limit but if we lower it too much we will consequently download very slowly.

amule

Instead of continually, manually change the upload limit according to our needs, I use a little script that I wrote, that automatically set the bandwidth limits from the number of downloads in the queue. To use this script we must have the amulecmd utility installed (from source code or from distro packages).
Continue Reading »

First public version of USBAutoStart!

Categories: C, Source Code, USBAutoStart

Tags:

USB AutoStart

Usbautostart is a Windows utility that performs autoplay for usb mass storage device. Windows avoid the autoplay on the removable medias for security reasons, but with this program you can bypass this limit and you can choose to launch a program in the usb pen when you plug it.
The program will also close all applications running from the device when you try to “safety remove” it.

Screenshots:

Usb peripheral detection (the red icon on the left is Mozup, the program started from the usb pen):
USB AutoStart Inserting device

Usb removal:
USB AutoStart Removing device

The project is hosted on sourceforge, and it’s released under GPL license, so it’s completely free and open source! :)

Download Usb Autostart

Coders4fun Quiz #2

Categories: Quiz

Tags:

This quiz is not original and isn’t about programming but I think it’s funny, so I publish it! :D
There is a pullman with 7 girls.
Every girl has 7 rucksack.
In each rucksack there are 7 big cats.
Every big cat has 7 small cats.
Every cat has 4 legs.

How much legs there are in the pullman?

MySQLDump 2.0

Categories: MySQL, Source Code, php

Tags:

This is a guest post from Daniele

After a lot of work, I released the new version (2.0) of the MySQLDump class, already introduced by this article.
MySQLDump is a class that allows to do a complete MySQL database backup with php pages.

After the inandrea’s good work there wasn’t too much space for improvements, but I think that these addition can be usefull: now it’s possible to export structures and/or data not only for the selected database but also for a single table.

The following example will explain how to export the structure and the data for the table mytable in the db mydb (the interface to the class is slightly changed from the previous version).

//Include the library
@include_once('lib_dump.php');
//Db connection
$connection = @mysql_connect('127.0.0.1','username','password');
//Create the MySQLDump class instance
//1° parameter: db name
//2° parameter: the exported file that will contain the dump
//3° parameter: create zipped file (true = zipped, false = normal)
//4° parameter: data encode (true = hexadecimal, false = plain text)
$dumper = new MySQLDump('mydb','dumpfile.sql',false,false);
//Structure export of the table 'mytable'
$dumper->getTableStructure('mytable');
//Data export of the table 'mytable'
$dumper->getTableData('mytable');

Continue Reading »

Next »