Compdigitec Labs

Patch for phpGladeTool

By admin | January 10, 2009

Although phpGladeTool is a very good tool to generate PHP from glade interfaces, it has many bugs that makes it run slowly and unstable. Below is a patch to phpGladeTool to fix some of the bugs. Keep in mind that this is only a small patch and that it does not fix all the bugs.

To install, either use the “patch” command to patch the existing installation using the patch files or just overwrite phpGladeTool.class.php and phpGladeTool.gtk.php with the pre-patched files.

Topics: PHP | 7 Comments »

Linking a shared assembly in the Mono C# compiler

By admin | December 23, 2008

If you wrote a class in C++ and wanted to use it in many applications, you could simple #include it in each application you wanted to use it in. But if you wrote a class in C# and wanted to use it in many applications, you cannot just #include it, because there is no #include in the C# language! The solution to this is to reference the library. This article will show you in easy steps:

  1. After you have written the class, compile it into a library with “gmcs ClassXyz.cs -target:library” (replace ClassXyz.cs with your class’s filename)
  2. The command above should generate a shared library/assembly called ClassXyz.dll.
  3. Now you can compile the application with “gmcs ProgramXyz.cs -reference:ClassXyz.dll”.

If you found this article useful or helpful, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux | 7 Comments »

Fixing MonoDevelop’s translation functions

By admin | December 21, 2008

When you install MonoDevelop in Linux, you will find that you cannot open a translation file. The error given is “CodePage 37 not supported”. A workaround for this is to install the libmono-i18n2.0-cil package.

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful or interesting posts!

Topics: Linux | 9 Comments »

Disable the jump box of the FAQ in phpBB 3

By admin | December 20, 2008

If you think that the “jump to” box at the bottom of the FAQ in the phpBB 3 package is annoying or unessesary, you can use this article to disable it in four easy steps.

  1. Download faq.php from your phpBB3 installation.
  2. Open it with a text editor.
  3. Comment out (add a #) line 170 (“make_jumpbox(append_sid(“{$phpbb_root_path}viewforum.$phpEx”));”).
  4. Reupload and you’re done! Go to http://yourforum.example/phpbb_installation_folder/faq.php to test it.

If you found this article useful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!

Topics: PHP | 11 Comments »

phpBB force login hack

By admin | December 16, 2008

To set up a private forum in phpBB, you could simply make all the forums “No Access” to guests and bots. But if they can still view your member list and profiles, that is a security leak. Here is a patch to remedy that by forcing the guest or bot to login before they can see the forum:

  1. Open up index.php from your phpBB installation.
  2. After line 25 (“$auth->acl($user->data);“), add the following code:
    // Hack to disable anonymous viewing
    if ($user->data[‘user_id’] == ANONYMOUS || $user->data[‘is_bot’])
    {
    login_box();
    } else {
  3. After the line “page_header($user->lang[‘INDEX’]);“, add the following code:
    // end hack to disable anonymous viewing
    };
  4. Re-upload index.php to your web server. Don’t forget to clear your cache and log out to see the effect.

Topics: PHP | 12 Comments »

How to fix GCC 4.3’s removal of old headers

By admin | December 15, 2008

GCC 4.3 has many new feautures. But unfortunately, it may break many of your application as it removes legacy and backwards compactible headers. Compiling in this case may result in errors such as “error: iostream.h: No such file or directory“. This article will describe how to fix it in 3 easy steps:

  1. Go to http://gcc.gnu.org/gcc-4.3/porting_to.html‘s “Removal of Pre-ISO headers” section.
  2. For every header on the left, create it with contents of “#include <header_on_the.right>“.
  3. Compile your app with your regular compile arguments, adding “ -I.” to the end of it. The dot at the end is very important. Example: “g++ foo.cpp -o foo -I.

If you found this article useful or interesting, please help Compdigitec by spreading the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux | 10 Comments »

Mount a FTP share in Ubuntu as a folder

By admin | December 7, 2008

There are several GUI interfaces for FTP on Linux, such as gFTP and FileZilla. But what if you need to use the powerful Linux command lines on an FTP share? This article will help you mount a FTP share as a folder so you can use your regular Linux tools (grep,nano,mv,rm,ls,etc.) on a FTP share. This can be accomplished using cURLFTPfs.

  1. If you don’t already have curlftpfs installed, install it with sudo apt-get install curlftpfs.
  2. Replacing the appropriate settings, mount the share with sudo curlftpfs -o umask=0777,uid=1000,gid=1000,allow_other ftp://username:password@your.ftpserver.here /media/ftpmountedhere. Make sure that the location to mount to is already created and readable and writable by all users.
  3. To make this permanent, add it to the end of /etc/init.d/rc.local to be able to access the share after reboot.

Topics: Linux | 18 Comments »

Setting up a samba share in Ubuntu 8.04 and above

By admin | November 30, 2008

After the “Network Shares” option was removed in Ubuntu 8.04, there was no longer a unified process to manipulate samba shares. Below is a step by step guide to setting up shares in Ubuntu 8.04 and above.
Nautils-share in Ubuntu

  1. Open Nautilus in root: Type gksudo nautilus in the terminal or Alt-F2 (run dialog). This is due to the fact that nautilus will not allow you to create shares without the root account.
  2. Navigate to the folder you want to share. Right click the folder and select Properties. Then click on the share tab.
  3. Check the checkbox that is labeled “Share this folder”. Type your share name in the “Share name” textbox. When you are done, click “Modify Share” to apply your settings.
  4. Close ‘root’ nautilus.
  5. The folder should now be shared. Check by going to Places => Network on your menu bar and typing in smb://localhost/ in the address bar.
  6. (Note) If you cannot get into your share even though you typed in correct username and password information, it may be that you have not set a samba password. Do this by typing smbpasswd in the terminal. Enter your Ubuntu login password when it asks for a password.

If you found this article interesting or useful, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!

Topics: Linux | 8 Comments »

A few gFTP user interface oddities

By admin | November 29, 2008

gFTP is a very good and lightweight FTP client on Linux. However, a few oddities of the gFTP user interface have been noticed. They are listed below.

Besides the above oddities, I think that gFTP is a very good and lightweight FTP client. If you found this article useful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!

Topics: Linux | 8 Comments »

Simple timer script for command-line PHP

By admin | November 12, 2008

Are you looking for a simple timer script written in command-line PHP? If so, here is one pre-written (released under the GPL v2 or later):

<?php
define("endl","\n");
// Timer script
if($argv[1] == "") {
 	echo "Usage: ".$argv[0]." minutes".endl;
 	die();
}
$dtime = strtotime("+".$argv[1]." minute");

while(true) {
 	echo "Enter to check time: ";
 	$tt = fgets(STDIN);
 	$i = date("i",$dtime-time());
 	$s = date("s",$dtime-time());
 	echo "$i minutes, $s seconds".endl;
}
?>

Usage: When launching use first parameter as number of minutes to count (0-59 min). Press enter to check the time.

If you found this script useful or helpful, please help Compdigitec by spreading the word. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!

Topics: PHP | 10 Comments »

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles! « Older Entries Newer Entries »