Posts Tagged ‘How-To’

Sunday, September 20th, 2009

EasyPHP on Windows 7

EasyPHP on Windows 7


Apache

I am accustomed in using EasyPHP on a Windows platform. Installation, running, and configuring it is always a breeze (on Windows XP that is). Recently I’ve installed Windows 7 RTM on my MSI notebook and installed EasyPHP 5.3.0, though the Installation goes flawlessly but then when I launch the stack software, Apache wouldn’t start.

I turned off the firewall but no luck. So I did a search on google, again no luck with Windows 7 specific solution but I found one for Windows Vista. I tried it anyway, then BAM! It worked! I finally got Apache to start, tried opening the local default web and it worked perfectly. Here’s the error message and how to fix it:

Apache cannot be runned: another Web server use the Web port
or port is blocked by firewall.
  1. Click the EasyPHP icon beside “Apache” button.
  2. Click “Configure” then click “EasyPHP“.
  3. Uncheck “Check server’s TCP port before starting” then click “Apply” button and then “Close” button.
  4. Click “Apache” button and then click “Start“.

That would fix the “Apache cannot be runned…” problem.

MySQL

Got the Apache server to work but after I closed EasyPHP and run it again, I’m hit with another error message:

Unexpected end of MySql... See log file?

Now it’s from MySQL. After a few head scratching and inspection. And then it hit me! I figure that must be a permission problem. So I changed my user’s permission for the EasyPHP directory and Viola! MySQL finally start. Solved the MySQL problem. Here’s what I did:

  1. Go to “Computer“, open/view Drive C, then double click “Program Files (x86)“.
  2. Right click on “EasyPHP5.3.0” folder then click “Properties“.
  3. On “Security” tab click “Edit…” button.
  4. Select the user that you are currently using.
  5. Under “Permissions for Users” box, tick “Full control” on “Allow” column.
  6. And then click “OK” button to apply the changes.

Now you’ll be able to start MySQL server by clicking “MySQL” button on EasyPHP dialog and then click “Start“.

Hope this helps!

Sunday, May 17th, 2009

If you are a PHP developer, you know that code refactor, code completion, and code assist is a very essential features that you’ll want to have on an IDE and Adobe’s Dreamweaver couldn’t give that to you. Don’t get me wrong, I love Dreamweaver, actually I’m still using it (on my Windows desktop) for HTML and web design mockups and it’s still one of the best HTML editor out there but that’s about it, an HTML editor, nothing more.

Have you ever tried Aptana? Well you should! If you’re a Web developer, building the next biggest, greatest, and newest application of the future then Aptana will be a great tool for you. It has code refactor, PHP code completion, code assist, FTP, SFTP, and SSH support and it’s FREE (Aptana Community Edition)! Plus it also has support for Ruby (Rails), Python, Adobe Air, and other language or platform. But wait there’s more! Ajax libraries (jQuery, Prototype/Scriptaculous, Adobe Spry, Dojo, etc). And if you’re a code version control freak, no worries! It has CVS, Subversion, or Git plugin support.

Enough with the promotion! Cause I will not get paid even doing so. But if you want an IDE with tons of support and features then Aptana is one of the best out there. Especially their code assist feature, it’s a top-notch. Aptana’s code completion for PHP’s common methods are default, you’ll have to install PHP plugin first to get this feature and for Aptana to recognize PHP codes and files.

To enable PHP Code Assist in Aptana, follow the simple instructions below. This will be useful if you have classes and methods that you want to be visible all over your project.

Code Assist will only work locally which means your source file must be in your local drive (not on a remote). But there’s a workaround for this, and we’ll get to that later on.

This is how to enable PHP Code Assist:

Local Projects

  1. Click “Project” tab (found on the left panel of Aptana environment).
  2. Create a new project (right click, New -> Project…).
  3. (on New Project window, under Aptana Projects) Select “PHP Project“.
  4. Click “Next” button, type in your project name then click “Finish” button.
  5. Select and right click on the newly created project and click on “Properties“.
  6. Select “Project Natures“.
  7. Tick “com.aptana.ide.editor.php.phpnature (PHP Nature)“.
  8. Then click “Ok” button.

Remote Projects

If your working with remote files (remote server or hosted site) then steps are different but almost similar to the above.

  1. Click “Project” tab (found on the left panel of Aptana environment).
  2. Create a new project (right click, New -> Project…).
  3. (on New Project window, under Aptana Projects) Select “Existing Hosted Site“.
  4. Click “Next” button, type in your project name then click “Next“.
  5. Choose or create a new remote location (FTP or SFTP) then click “Finish” button.

    Please note that the source file needs to be downloaded into your local drive, so choose “Yes” in the Download prompt/window. Be patient and wait for the download to complete.

  6. Select and right click on the newly created project and click on “Properties“.
  7. Select “Project Natures“.
  8. Tick “com.aptana.ide.editor.php.phpnature (PHP Nature)“.
  9. Then click “Ok” button.

After doing the changes in the source file, you can use the “Smart Sync” feature of Aptana to synchronize your local and remote source files. Another cool feature of Aptana.

Hope this helps!

Saturday, May 2nd, 2009

Microsoft Visual C# Express Edition

Microsoft Visual C# Express

For the past couple of days, I’ve been learning C# language. Thus far, I really enjoy learning C#. Actually after an hour of reading articles/posts and sample codes on the Internet, I was able to dive in and create a simple application. No, not that “Hello world” app, but a useful app for me.

Building Windows application was not new to me. 3 or 4 years ago I’ve built an enterprise application for a medical company using Visual Basic, version 6. I have a lot of fun building that application. Well, it’s an Inventory system, not an average inventory system but a real mind boggling system that will really turn your brain upside-down. What really makes it complicated is the integration of the company’s Business Model. We try to automate everything but within the Business Model there are a lot of complicated processes that will surely twist your brain. But anyway I’m trough with it, solved the problems, and release it just in time. What I am proud of is the result application, which is a very stable and efficient enterprise application. 3+ years running without a glitch, imagine that!

Anyway, I really like C# language. Coming from Visual Basic, C, and PHP, I haven’t had the hard time learning it. I you have the same programming background as I am; surely you’ll be able to learn the language in no time, especially if you’re into OOP paradigm. If you’re a Java developer then transition will be swift.

The first thing to remember before diving right in is in C# language “Everything is an object.” If you’re into OO then you’ll know what I mean.

Don’t worry how messy your codes will be. Just built it! Refactor later! The most important thing right now is for your app to work. Hey! Nobody gets it for the first time. Unless you’re me, right! Haha enjoy and happy programming with C#.

What’s the taste? Sweeeeettt!

Reminders and things to-do:

  1. Download Visual C# Express from Microsoft website. It’s FREE!
  2. Read a lot of samples and article/post on the Internet. Here’s a couple I’ve found (Though I haven’t read them, It might come useful to you.)
    1. Introduction to C#
    2. Learning C# by example
  3. Think of a useful project to do. Plan it and build it!
  4. While building your app, spent the time to refactor your code. You’ll be saving yourself from a lot of headaches when your app turns into a monster code-base.
  5. Always think OO!
  6. Continuously improve your processes.
Saturday, March 21st, 2009

Here’s the scenario:

You have this really cool idea of an OSS project and you have already coded some of its source, though not stable enough for release you’d decided to create and uploaded it on Google Code repository to track the development history. “Trunk tree should only have the stable source”, with this in mind you’d decided to create a branch directory (/1.0) and upload your unstable source in there. After days of hacking and cracking, you finally have a source candidate for the trunk tree. So, how do you copy your candidate branch to the empty trunk?

Remember that when you create a new project on Google Code, your initial repository will already have a branches, tags, and trunk tree.

Using “svn merge” will not do, because you still have an empty trunk.

But how about “svn copy“?

> svn copy https://your-project.googlecode.com/svn/branches/1.0 \
   https://your-project.googlecode.com/svn/trunk/

That wouldn’t do either. Yes it’ll copy all the files and directories inside the “/branch/1.0” directory but it’ll include the “/1.0” directory. Meaning the end result will be “/trunk/1.0“.

https://your-project.googlecode.com/svn/trunk/1.0

You don’t want that, do you? Remember that Trunk directory should always contain the latest and stable source. So the “/1.0” directory will be inappropriate. What you wanted to achieve in your project repository tree, is to look like this:

  • /svn/branches
    • /1.0
      • source.file.1
      • source.file.2
  • /tags
  • /trunk
    • source.file.1
    • source.file.2

Solution

The way to do this (without temporarily deleting the trunk directory) is to first, checkout the candidate branch, change working directory and import.

  1. Checkout the candidate/stable branch:
    > svn co https://your-project.googlecode.com/svn/branches/1.0 branch-1.0
    > cd branch-1.0
    
  2. Import to the empty trunk:
    > svn import https://your-project.googlecode.com/svn/trunk \
       -m 'Stable source from branches/1.0, revision 26.'
    

Pros: Quick and easy, without deleting the current trunk tree.
Cons: What happened on the branch (history) stays on the branch.

Got another solution? I’d love to hear from you.

Sunday, March 8th, 2009

While I was tinkering with my blog site, trying to (somehow) optimize it. I’ve noticed that the “Meta-Description” in which the Add-Meta-Tags generates, included the “[ caption ]” shortcode in the header’s meta-description, that is if I have an embedded image on my post. SEO professionals would say that “it’s a big No no!”. So, what’s a guy gotta do? Remove it! But then I still want a caption for my embedded images (on posts). So, editing every post and removing the code manually will not do.

I’d searched a fix on google but no luck. But, I’ve found one for All-In-One-SEO-Pack using regular expression to strip all shortcode. Tried it on Add-Meta-Tags and you guessed it! It worked!

Here’s how to you do it:

  1. Edit your ‘add-meta-tags.php‘ from ‘/wp-content/plugins/add-meta-tags-1.6‘ directory.
  2. Search for the function ‘amt_clean_desc
  3. Then add this code (one line before ‘return trim($desc);‘):
    $desc = preg_replace('|\[(.+?)\](.+?\[/\\1\])?|s', '', $desc);
    
  4. Save it then upload it back to the server.

That’s it!

Wednesday, March 4th, 2009

Have you tried sharing a folder in Linux, especially in OpenSuse? If you open your File Browser/Nautilus and you right clicked on a folder, you will see a “Sharing Options” and when you try to share a folder and hit on the “Create Share” button, there’s an error prompting at the window: ‘net usershare’ returned error 255: net usershare: usershares are currently disabled.

Well the solution to this problem is quite simple:

Note: Before starting make sure that Samba is already installed and that the Samba daemon are already started:

Starting the Samba daemon

As root:

rawswift:~ # /etc/init.d/smb start
Starting Samba SMB daemon                                            done
rawswift:~ #

Now here’s what you will do next (as root):

  1. Edit ‘/etc/samba/smb.conf’.
    rawswift:~ # vi /etc/samba/smb.conf
    

    add the following under the “[global]” category:

    usershare allow guests = Yes
    usershare max shares = 100
    usershare owner only = False
    
  2. Create the ‘usershare’ directory (this is where Samba will store the lists of shared folders).
    rawswift:~ # mkdir /var/lib/samba/usershares
    rawswift:~ # chgrp users /var/lib/samba/usershares/
    rawswift:~ # chmod 1770 /var/lib/samba/usershares/
    
  3. Then finally, restart Samba daemon:
    rawswift:~ # /etc/init.d/smb restart
    Shutting down Samba SMB daemon                                       done
    Starting Samba SMB daemon                                            done
    rawswift:~ #
    

That’s it! Simple, eh?

Share a folder

  1. Open your file browser/Nautilus.
  2. Right click the folder you want to share.
  3. Click ‘Sharing Options’.
  4. Tick ‘Share this folder’ and ‘Guest access (for people without a user account)’.
  5. And hit ‘Create Share’ button.
Sunday, February 15th, 2009

Since I’ve started an account on Facebook, I was always fascinated with the bottom fixed application bar. And now I got a chance to hack one for my own and share it, with you guys.

Check out the sample I’ve made: http://ryan.rawswift.com/sandbox/fixed-bottom-bar/

I’ve put some comments on the HTML and CSS code. So, I hope you’ll understand it clearly.

Save and modify it, to fit your need!

Hope this helps!

Update!

Bug Fix:
1. Overlapping scrollbar (vertical and horizontal) on IE7.
2. Page wouldn’t scroll down when the mouse pointer is in a white/blank space on IE7.

The sample page are optimized for 960×600 and higher resolutions. Tested on FF3, IE6, IE7, and IE8.

Download: http://ryan.rawswift.com/sandbox/fixed-bottom-bar/fixed-bar-0.2.tgz

UPDATE - Dec. 15, 2009

Thanks guys! For all the comments and suggestions. Sorry if I couldn’t reply to each and every comments below. Been busy for the past couple of months.

Anyway, I’ve just recently created a new project called jixedbar. It’s a jQuery plugin and has the same effect as seen in the above demo but with some added features like mouse hover effect, rounded corners, text tooltip, and customizable style (partly). It is still under development and currently in beta stage.

You can download the beta version at http://code.google.com/p/jixedbar/downloads/list.

Please try it and send me your comments or suggestions.

*** Compatible in IE6, IE7, IE8, Firefox, and Chrome. (Haven’t yet tested on a Safari browser)

Demo page: http://ryan.rawswift.com/sandbox/jixedbar-0.0.2/demo/

UPDATE - June 24, 2010

Here’s the latest update:

Demo page: http://ryan.rawswift.com/sandbox/jixedbar-0.0.3/demo/

*** Development version 0.0.3

Cheers!

Donation

Support the jixedbar project by donating any amount through PayPal or by simply linking back to jixedbar’s page over Google Code.


Saturday, February 14th, 2009

A few hours from now a milestone will happen for Unix world as the Unix time (Unix Epoch) will hit “1234567890″ at Friday, February 13, 2009, 11:31:30 pm UTC (since it started counting on January 1, 1970).

To find out what time it will be in your local time:

perl -e 'print scalar localtime(1234567890),"n";'

or

date -d@1234567890

Mine is ‘Saturday, February 14, 2009 07:31:30 PHT’ (Philippine Time).

Don’t have *NIX? Check out http://coolepochcountdown.com/

So! Grab your party hat and grab some beer or whatever you can grab on and party like it’s 1234567890!
If you happen to miss the celebration, then we’ll see you December 22, 2282 at 3:13:30PM ET.

Tuesday, February 3rd, 2009

Want to know your bandwidth usage? Or who among your network peers are using most it. Then install network top (ntop), with it you can monitor your network bandwidth usage using pretty graphs (rrdtool). Ntop installs out-of-the-box through YaST (I’m assuming you have SUSE). Enough talking!

Here’s how to install it:

  1. Install ‘ntop’ using YaST. So dependencies will be included.
  2. After installation, time to set the admin’s password and the user ntop should run after it initializes.
    rawswift:~ # ntop -A -u wwwrun

    If you want to access ntop’s interface from any computer in your network then edit the ntop’s configuration file and change the localhost IP (127.0.0.1) to the host’s local network IP.

    • Open ntop configuration file (as root):
      rawswift:~ # vi /etc/sysconfig/ntop
    • Change ‘NTOPD_PORT’ value:
      • From: NTOPD_PORT=”127.0.0.1:3000″
      • To (host network IP): NTOPD_PORT=”xxx.xxx.xxx.xxx:3000″
    • Then save it!
  3. Now start ntop script
    rawswift:~ # /etc/init.d/ntop start

If you want ntop to start on boot time then enable it in the init process:

rawswift:~ # chkconfig ntop on

Open you web browser and in the address box put the ntop’s host address and port (3000). You’ll now be able to see the bandwidth monitoring:

rawswift:~ # links 127.0.0.1:3000

What I like about ntop is that is uses rrdtool to graph the bandwidth usage. Really useful in tracking who uses the most bandwidth.

And if you want to go extreme, install ettercap and use ARP poison to sniff all data frames on your local area network (LAN). But be careful with playing man-in-the-middle attack in a low end computers. It’ll definitely bog down you network.

Tuesday, January 27th, 2009

Here’s how to install VirtualBox on OpenSUSE 11.1:

  1. First, you’ll have to download the package from Sun’s website.
  2. Get the right package for your OS platform (32-bit or 64-bit). I had the mistake of installing the wrong package. You can check your platform by running ‘uname’ command with ‘-a’ (print all information) argument:
    ryan@rawswift:~/Desktop> uname -a
    Linux rawswift 2.6.27.7-9-default #1 SMP 2008-12-04 18:10:04 +0100 x86_64 x86_64 x86_64 GNU/Linux
    ryan@rawswift:~/Desktop>

    A 64-bit kernel will give you ‘x86_64 x86_64 x86_64′ and a 32-bit would show ‘i686 i686 i386′.

  3. After you’ve download the package, it time to install it:
    ryan@rawswift:~/Desktop> sudo rpm -i VirtualBox-2.1.2_41885_openSUSE111-1.x86_64.rpm
    Creating group 'vboxusers'. VM users must be member of that group!
    ryan@rawswift:~/Desktop>

That’s it! Now run ‘Sun xVM VirtualBox’ on your application menu or ‘VirtualBox’ on your shell. Enjoy!

Problems and fixes (especially on a 32-bit and OSE package)

  • VirtualBox’s library requirements. Install the following:
    pam-devel
    libqt2-32bit
    libqt4-x11-32bit
    SDL-32bit
    libxslt-32bit
  • After running VirtualBox, it doesn’t show up on screen. Run VirtualBox on shell:
    ryan@rawswift:~/Desktop> VirtualBox
    WARNING: The vboxdrv kernel module is not loaded. Either there is no module
             available for the current kernel (2.6.27.7-9-default) or it failed to
             load. Please recompile the kernel module and install it by
    
               sudo /etc/init.d/vboxdrv setup
    
             You will not be able to start VMs until this problem is fixed.
    /usr/bin/VirtualBox: line 72: /usr/lib/virtualbox/VirtualBox: Permission denied
    /usr/bin/VirtualBox: line 72: exec: /usr/lib/virtualbox/VirtualBox: cannot execute: Success
    ryan@rawswift:~/Desktop>

    If the above error appears, you should run ‘vboxdrv’ script to create the VirtualBox kernel module:

    ryan@rawswift:~/Desktop> sudo /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module                                    done
    Removing old VirtualBox netflt kernel module                         done
    Removing old VirtualBox kernel module                                done
    Recompiling VirtualBox kernel module                                 failed
      (Look at /var/log/vbox-install.log to find out what went wrong)
    ryan@rawswift:~/Desktop>

    If it fails to compile, install ‘kernel-source‘ through YaST. Then run ‘/etc/init.d/vboxdrv setup’ again.

    ryan@rawswift:~/Desktop> sudo /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module                                    done
    Removing old VirtualBox netflt kernel module                         done
    Removing old VirtualBox kernel module                                done
    Recompiling VirtualBox kernel module                                 done
    Starting VirtualBox kernel module                                    done
    ryan@rawswift:~/Desktop>
  • Permission denied:
    ryan@rawswift:~/Desktop> VirtualBox
    /usr/bin/VirtualBox: line 72: /usr/lib/virtualbox/VirtualBox: Permission denied
    /usr/bin/VirtualBox: line 72: exec: /usr/lib/virtualbox/VirtualBox: cannot execute: Success
    ryan@rawswift:~/Desktop>

    Run ‘chmod’ on ‘VirtualBox’. This will set the execute bit:

    sudo chmod +x /usr/lib/virtualbox/VirtualBox
  • Driver mismatch. If an error box appear when you ‘Start’ a virtual machine:
    The VirtualBox support driver which is running is from a different version of VirtualBox.
    You can correct this by stopping all running instances of VirtualBox and reinstalling the software.
    (VERR_VM_DRIVER_VERSION_MISMATCH).
    
    Result Code:	NS_ERROR_FAILURE (0x80004005)
    Component:	Console
    Interface:	IConsole {e3c6d4a1-a935-47ca-b16d-f9e9c496e53e}

    Check your VirtualBox package platform (64-bit or 32-bit, see the tutorial above).